| [ < ] | [ > ] | [ << ] | [ Up ] | [ >> ] | [Top] | [Contents] | [Index] | [ ? ] |
In addition to creating graphical output and MIDI, LilyPond can display musical information as text.
| 3.6.1 Displaying LilyPond notation | ||
| 3.6.2 Displaying scheme music expressions | ||
| 3.6.3 Saving music events to a file |
| [ < ] | [ > ] | [ << ] | [ Up ] | [ >> ] | [Top] | [Contents] | [Index] | [ ? ] |
Displaying a music expression in LilyPond notation can be
done with the music function \displayLilyMusic. To see the
output, you will typically want to call LilyPond using the command
line. For example,
{
\displayLilyMusic \transpose c a, { c4 e g a bes }
}
|
will display
{ a,4 cis4 e4 fis4 g4 }
|
By default, LilyPond will print these messages to the console
along with all the other LilyPond compilation messages. To split
up these messages and save the results of \displayLilyMusic,
redirect the output to a file.
lilypond file.ly >display.txt |
Note that LilyPond does not just display the music expression, but
also interprets it (since \displayLilyMusic returns it in
addition to displaying it). Just insert \displayLilyMusic into
the existing music in order to get information about it.
To interpret and display a music section in the console but, at the same
time, remove it from the output file use the \void command.
{
\void \displayLilyMusic \transpose c a, { c4 e g a bes }
c1
}
|
| [ < ] | [ > ] | [ << ] | [ Up ] | [ >> ] | [Top] | [Contents] | [Index] | [ ? ] |
See (extending)Displaying music expressions section ‘Displaying music expressions’ in Extending.
| [ < ] | [ > ] | [ << ] | [ Up ] | [ >> ] | [Top] | [Contents] | [Index] | [ ? ] |
Music events can be saved to a file on a per-staff basis by including a file in your main score.
\include "event-listener.ly" |
This will create file(s) called ‘FILENAME-STAFFNAME.notes’ or ‘FILENAME-unnamed-staff.notes’ for each staff. Note that if you have multiple unnamed staves, the events for all staves will be mixed together in the same file. The output looks like this:
0.000 note 57 4 p-c 2 12 0.000 dynamic f 0.250 note 62 4 p-c 7 12 0.500 note 66 8 p-c 9 12 0.625 note 69 8 p-c 14 12 0.750 rest 4 0.750 breathe |
The syntax is a tab-delimited line, with two fixed fields on each line followed by optional parameters.
time type …params… |
This information can easily be read into other programs such as python scripts, and can be very useful for researchers wishing to perform musical analysis or playback experiments with LilyPond.
Not all lilypond music events are supported by ‘event-listener.ly’. It is intended to be a well-crafted “proof of concept”. If some events that you want to see are not included, copy ‘event-listener.ly’ into your lilypond directory and modify the file so that it outputs the information you want.
| [ < ] | [ > ] | [ << ] | [ Up ] | [ >> ] |
This document was generated by gub on July 13, 2020 using texi2html 1.82.
Other languages: català, deutsch, español, français, italiano, 日本語.
About automatic language selection.