lilypond-user
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: tag - midi


From: Hans Aikema
Subject: Re: tag - midi
Date: Wed, 7 Dec 2016 12:53:00 +0100

> On 7 Dec 2016, at 08:31, bart deruyter <address@hidden> 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


reply via email to

[Prev in Thread] Current Thread [Next in Thread]