lilypond-user
[Top][All Lists]
Advanced

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

Re: Non-integer tempo marking


From: Aaron Hill
Subject: Re: Non-integer tempo marking
Date: Sat, 23 Feb 2019 02:11:33 -0800
User-agent: Roundcube Webmail/1.3.8

On 2019-02-22 11:29 pm, Martin Tarenskeen wrote:
I tried to create it as a \markup. For MIDI output this doesn't work
though. You could add \midi { \tempo 8 = 145 } for that.

%%%%%%%%%%

\score {
{
  \tempo \markup {
      \concat {
        \smaller \general-align #Y #DOWN
        \note #"4" #1 " = 72.5"
      }
  }
  c'
}

\layout {}
\midi { \tempo 8=145 }

%%%%%%%%%%

Should \tempo be used within a \midi block? According to a rule in convertrules.py, it was deprecated in favor of directly setting tempoWholesPerMinute, which supports being set to any rational number:

%%%%
  \midi { \context { \Score
     tempoWholesPerMinute = #(ly:make-moment 987 29) %% ~136.138 BPM
  } }
%%%%

Mind you, that rule was back in 2.9.16. And it doesn't sound like anything was actually deprecated if \tempo still works in \midi.

Regardless, it should be noted that LilyPond internally only supports specifying an integral number of quarter notes per minute. This comes from Tempo_performer::process_music casting the rational tempoWholesPerMinute to an integer after multiplying by four, since Audio_tempo::per_minute_4 is an integral type.

If we consider the crazy value in my example above, LilyPond would end up storing this as only 136 BPM before converting it to the value stored in the MIDI file.

The MIDI specification allows pretty fine granularity for tempo, letting you specify the number of microseconds per quarter note. For 136.138 BPM, that works out to 440,729 microseconds per quarter note whereas an exact 136 BPM is 441,176 microseconds per quarter note--a difference of about 447 microseconds per quarter note. After 2,237 quarter notes--roughly 16.45 minutes of music--there would be a drift of one second.

tl;dr: \tempo 8=145 will unfortunately not result in \tempo 4=72.5. Depending on rounding, it would end up as either 72 or 73.


-- Aaron Hill



reply via email to

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