# Is there a way in Lilypond to omit entire staffs from the pdf layout but listen to them in MIDI?

I'm using Lilypond to compile music for my church choir.

I've recently discovered the use of midiMaximumVolume and midiMininumVolume so I can highlight a given staff to isolate a part.

I produce multiple Books at a time with identical 'bookOutputSuffix', often they are "All Parts", "Piano", "SATB", "Soprano", "Alto", "Tenor", and "Bass". Each book isolates the part, removing the other staves. Up to this point the MIDI files I've used also only isolated their part, but now I have all the music there, just quieter in comparison to the part I'm isolating so they have a reference point to the music.

But I want, in one \book, (possibly one \score ) the way to have just the "Tenor" part print isolated in the PDF layout without the "SAB" or "Piano" staves, but have all the music from all staves appear in the MIDI file while I use midiMaximumVolume and midiMininumVolume to make the "Tenor" part stand out.

I've done separate \books for MIDI and PDF Layout, but with having multiple books with the same \bookOutputSuffix I end up with "-Tenor.pdf" and "-Tenor-1.midi" which messes with my organizational system.

You can always create separate \score blocks for \layout and \midi. Using \tag (and \keepWithTag and \removeWithTag) to organize your source helps in avoiding duplication of most material.

• Answer could be improved with an example showing success. – Carl Witthoft Mar 2 '18 at 15:56
• I have chosen to select this answer, and I have posted my own answer to show the code for how I implemented it. – Okomikeruko Mar 7 '18 at 14:30

I've decided to accept user48549's answer, and in response to Carl Witthoft's comment, I'm going to show how I implemented the suggestion in my own workflow below:

First I set up the musical notations:

%% MUSIC %%

global = {
\tempo 4 = 88
\time 4/4
\numericTimeSignature
\compressFullBarRests
\key c \major
s1*4 \bar "|."
}
pianoUpper = {
\new Staff <<
\global
\clef treble
\relative c' {
c4 c c c | c c c c | c c c c | c c c c | c c c c |
}
>>
}
pianoLower = {
\new Staff <<
\global
\clef bass
\relative c {
c4 c c c | c c c c | c c c c | c c c c | c c c c |
}
>>
}
sopranoMusic = {
<<
\global
\clef treble
\relative c'' {
c4 c c c | c c c c | c c c c | c c c c | c c c c |
}
>>
}
altoMusic = {
<<
\global
\clef treble
\relative c' {
c4 c c c | c c c c | c c c c | c c c c | c c c c |
}
>>
}
tenorMusic = {
<<
\global
\clef "treble_8"
\relative c' {
c4 c c c | c c c c | c c c c | c c c c | c c c c |
}
>>
}
bassMusic = {
<<
\global
\clef bass
\relative c {
c4 c c c | c c c c | c c c c | c c c c | c c c c |
}
>>
}


And the lyrics:

%% LYRICS %%

commonLyrics = \lyricmode {
la la la la
la la la la
la la la la
la la la la
la la la
}
sopranoLyrics = \lyricmode {
\commonLyrics ooh
}
altoLyrics = \lyricmode {
\commonLyrics aah
}
tenorLyrics = \lyricmode {
\commonLyrics eh
}
bassLyrics = \lyricmode {
\commonLyrics hmm
}


Then I set up the parts:

%% PARTS %%

% Normal Volume Parts

piano = {
\new PianoStaff \with {
instrumentName = #"Piano"
shortInstrumentName = #"Pno."
} <<
\pianoUpper
\pianoLower
>>
}

soprano = {
\new Staff \with {
instrumentName = #"Soprano"
shortInstrumentname = #"S"
} {
\sopranoMusic
}
}

alto = {
\new Staff \with {
instrumentName = #"Alto"
shortInstrumentname = #"A"
} {
\altoMusic
}
}

tenor = {
\new Staff \with {
instrumentName = #"Tenor"
shortInstrumentname = #"T"
} {
\tenorMusic
}
}

bass = {
\new Staff \with {
instrumentName = #"Bass"
shortInstrumentname = #"B"
} {
\bassMusic
}
}


Then I add additional parts for Loud and Soft versions. I can omit the lyrics and the instrument name since these parts are only rendered in MIDI.

% Soft Volume Parts

pianoSoft = {
\new PianoStaff \with {
midiMinimumVolume = #0.2
midiMaximumVolume = #0.4
} <<
\pianoUpper
\pianoLower
>>
}

sopranoSoft = {
\new Staff \with {
midiMinimumVolume = #0.2
midiMaximumVolume = #0.4
} {
\sopranoMusic
}
}

altoSoft = {
\new Staff \with {
midiMinimumVolume = #0.2
midiMaximumVolume = #0.4
} {
\altoMusic
}
}

tenorSoft = {
\new Staff \with {
midiMinimumVolume = #0.2
midiMaximumVolume = #0.4
} {
\tenorMusic
}
}

bassSoft = {
\new Staff \with {
midiMinimumVolume = #0.2
midiMaximumVolume = #0.4
} {
\bassMusic
}
}

% Loud Volume Parts

sopranoLoud = {
\new Staff \with {
midiMinimumVolume = #0.6
midiMaximumVolume = #0.9
} {
\sopranoMusic
}
}

altoLoud = {
\new Staff \with {
midiMinimumVolume = #0.6
midiMaximumVolume = #0.9
} {
\altoMusic
}
}

tenorLoud = {
\new Staff \with {
midiMinimumVolume = #0.6
midiMaximumVolume = #0.9
} {
\tenorMusic
}
}

bassLoud = {
\new Staff \with {
midiMinimumVolume = #0.6
midiMaximumVolume = #0.9
} {
\bassMusic
}
}


Then with every book that I want to isolate a part for I can add two scores, one with the \layout {} block and the other with the \midi {} block:

%% BOOKS %%

% All Parts (No Isolation)
\book {
title = #"My Song"
instrument = #"All Parts"
}

\bookOutputSuffix "All-Parts"

\score {
<<
\new ChoirStaff <<
\soprano
\alto
\tenor
\bass
>>
\piano
>>

\layout{}
\midi{}
}
}

% Soprano (Soprano Part Isolated)
\book {
title = #"My Song"
instrument = #"Soprano"
}

\bookOutputSuffix "Soprano"

\score {
<<
\new ChoirStaff <<
\soprano
>>
>>
\layout{}
}

\score {
<<
\new ChoirStaff <<
\sopranoLoud
\altoSoft
\tenorSoft
\bassSoft
>>
\pianoSoft
>>
\midi{}
}

% Other parts omitted but similar to Soprano above.


The final output of those two books, if the file name is "My-Song.ly" should generate:

• My-Song-All-Parts.midi (playing each part normally)
• My-Song-All-Parts.pdf (containing all staves)
• My-Song-Soprano.midi (Soprano part plays loudly, and all other parts softly)
• My-Song-Soprano.pdf (containing only the Soprano staff)

\RemoveEmptyStaves or \RemoveAllEmptyStaves should work. See Hiding Staves in the documentation.

• Answer could be improved with an example showing success. – Carl Witthoft Mar 2 '18 at 15:56
• In my case the staves wouldn't be empty. There would still be music in them. I've updated my question to reflect this. – Okomikeruko Mar 2 '18 at 16:08