> On 7 Dec 2016, at 08:31, bart deruyter <bart.deruy...@gmail.com> wrote:
> 
> Hi all,
> 
> I'm sorry for this late reply, it has been quite busy here.
> 
> here is a minimal example:
> 
> <..>
> 
> As expected, I get two midi files, but they both contain the music of the 
> entire score. The midi blocks don't follow the \keepWithTag rules.
> 
> What I'd like to see is one score, two different midi files, each containing 
> only the music enclosed in the tags.
> 
> is something similar possible? Maybe I forgot some essential extra code...
> 
> Using different score blocks for each part seems a bit much to get one pdf 
> for the full score and chopped midi files.
> 
Bart,

With pure lilypond you will need the additional Score blocks. Both \layout and 
\midi render whatever is the current score (they do not consume a music 
expression to render, but rather take the current score to render.
Another option would require scheme code to dynamically build your midi score 
blocks. I recently discoverd the rehearsalMidi function hidden in the treasures 
of openlilylib which now is a great asset in my toolbox for creating rehearsal 
midi (and mp3 with a timidity++/lame toolchain) files for my choir. As I 
suspected (after some trial and error.. my first steps into scheme coding) it 
can be easily adapted for your needs of outputting separate midis for tagged 
music. See the attached file for the function. It needs to be included in your 
actual files. Your minimal snippet would be converted into:

\include "tagmidi.ly"

altoVoice = \relative c' {

\tag #'A {c'2  g |} \tag #'B {e'4 d  c2 }| 
  \bar "|."
}

\score {
  \new Staff \with {
    midiInstrument = "piano"
  } { \altoVoice }

  \layout { }
}

\tagMidi \altoVoice #'A
\tagMidi \altoVoice #’B

Which I think is more consise and less error-prone once you start getting more 
samples into a single file and gives you suffixes to the midi-files that match 
the tags.
 

Attachment: tagmidi.ly
Description: Binary data

_______________________________________________
lilypond-user mailing list
lilypond-user@gnu.org
https://lists.gnu.org/mailman/listinfo/lilypond-user

Reply via email to