lilypond-user
[Top][All Lists]
Advanced

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

Re: tag - midi


From: bart deruyter
Subject: Re: tag - midi
Date: Wed, 7 Dec 2016 19:48:25 +0100

Hans,

that's pretty cool :-), it first got me confused because I did not see it in frescobaldi, the midi player doesn't show the midifiles, but I checked the directory where the .ly file is 'et voila' :-) there it was.

Great, this possibility is a good thing to know. I've read on this list that lilypond is not optimal for use on a webserver, but just imagine the possibilities of these kinds of things. For example automatically generated exercises for ear training having audio and notation, with an input box where the user can enter notes and then check the results.. :-D ..

but that is out of the scope of this email, I get excited about these endless opportunities for lilypond :-).

thanks again,

Bart




2016-12-07 12:53 GMT+01:00 Hans Aikema <address@hidden>:

> 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.
 


reply via email to

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