After spending long enough learning lilypond and writing scores for multiple voices, I've often run into the problem of generating individual voice midi/mp3 files from the score. I was surprised to find this was not already a feature or that no one had an easy way to do this since individual voice mp3s are a precious resource for learning a multi-voice piece !
While it is possible to just remove other voices from the score temporarily, compile, rename the midi, change to another voice, compile, rename, etc.. This becomes very tedious very fast. Plus, I find it helpful to still have the other voices at low volume in the background to have a sense of the harmony.
So I need a way to generate these separate voices from a standard multi-voice score.
Here is a standard lilypond script for a 4-voice example to use as a test file :
\version "2.18.2"
global = {
\key c \major
\time 4/4
\tempo "Allegro" 2 = 60
}
% Lyrics
verseBass = \lyricmode {Ho Ho Hoo, Ho Ho Hoo !
}
verseTenor = \lyricmode {Ha Ha Haa, Ha Ha Haa !
}
verseAlto = \lyricmode {Huu Hu Hu, Hu Hu Huu !
}
verseSoprano = \lyricmode {Hi Hi Hii, Hi Hi Hii !
}
% Music
voiceBass = \relative c {\global c4 b f'2 d4 g, c2 \bar "|."}
voiceTenor = \relative c' {\global g4 b c2 b4 f g2}
voiceAlto = \relative c' {\global e2 d4 g g b, e2}
voiceSoprano = \relative c'' {\global c8e d4 a2 d4 b c2}
% Score stucture
voicePartBass = \new Staff \with {
instrumentName = "Bass"
shortInstrumentName = "B"
midiInstrument = "violin"
} {
\clef bass \voiceBass
} \addlyrics { \verseBass }
voicePartTenor = \new Staff \with {
instrumentName = "Tenor"
shortInstrumentName = "T"
midiInstrument = "violin"
} {
\clef "G_8" \voiceTenor
} \addlyrics {\verseTenor}
voicePartAlto = \new Staff \with {
instrumentName = "Alto"
shortInstrumentName = "A"
midiInstrument = "violin"
} {
\voiceAlto
} \addlyrics { \verseAlto }
voicePartSoprano = \new Staff \with {
instrumentName = "Soprano"
shortInstrumentName = "S"
midiInstrument = "violin"
} {
\voiceSoprano
} \addlyrics {\verseSoprano}
\score {
<<
\new ChoirStaff << % choirstaff adds the fancy join on voice staves
\voicePartSoprano
\voicePartAlto
\voicePartTenor
\voicePartBass
>>
>>
\layout {}
\midi {}
}
Which outputs
And a midi file with everything.