lilypond-user
[Top][All Lists]
Advanced

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

Re: Metronome marking with non-integer value


From: Jean Abou Samra
Subject: Re: Metronome marking with non-integer value
Date: Sun, 25 Jun 2023 16:36:09 +0200
User-agent: Evolution 3.48.3 (3.48.3-1.fc38)

Le dimanche 25 juin 2023 à 15:59 +0300, Lib Lists a écrit :

Hi Valentin,

thank you so much for your time, it works perfectly and the detailed explanation is really helpful and welcome (now I need to experiment more on my own to fully understand everything).

Interestingly, and this would have been the topic of my next message, the resulting MIDI output is always correct whatever \tempo I put (it can be the same \tempo for all staves). In the example below the top staff is always set to 4 = 120 and the other staves correctly follow. I'm wondering if this is because \scaleDurations overrides any \tempo indication, or because of \cadenzaOn.

In your code below, there are no custom MIDI tempo settings, since you did not include any \set Score.tempoWholesPerMinute = ... command (\tempo adds this along with a TempoChangeEvent, as Valentin explained).

Even with \tempo, MIDI cannot have several tempi for several tracks I believe. At any rate, LilyPond will just choose the last one seen, and consistently apply it to all staves. Just try swapping the staves in

\version "2.24.1"

\score {
  <<
    \new Staff { \tempo 4 = 60 c'4 4 4 4 }
    \new Staff { \tempo 4 = 120 c'4 4 4 4 }
  >>
  \midi { }
}

to hear the difference.

\scaleDurations does not override \tempo. But, it makes notes performed at a different pace than what their written durations would normally make for. For example, “\scaleDurations 2” will turn quarter notes into half notes for MIDI, while preserving their appearance (filled note heads) in the printed output.

But it's not a problem, as it works as it should.

In any case, here below an example that uses your 'Weird tempo' marking. Also I added a rounding function found on Stack Overflow to avoid a visually too long decimal. However, the resulting MIDI file doesn't show any visible rounding issue.

What about just making your own tempo marks as \markup ? I think that's more future-proof than putting a non-integer into 'metronome-count while the parser code would only let an integer pass through and downstream code may thus legitimately (IMHO) assume it's integer.

Something like the following should do it:

\version "2.25.5"

#(ly:set-option 'midi-extension "mid")

voiceAmount = 7

\score {
  \new StaffGroup  <<
    #@(map (lambda (i)
    #{
      \new Staff {
        \scaleDurations #(cons voiceAmount i) {
          \tempo \markup {
            \rhythm {4} =
            \normal-weight #(format #f "~,2f" (* i (/ 120.0 voiceAmount )))
          }
          \relative c'' \repeat unfold #i {{c c c c }} \bar "||"
        }
      }
      #})
    (iota voiceAmount voiceAmount -1))
  >>

  \layout {
    \context {
      \Score
      \remove Metronome_mark_engraver
      \cadenzaOn
    }
    \context {
      \Staff
      \remove Time_signature_engraver
      \consists Metronome_mark_engraver
    }
  }
  \midi { }
}

Regards,

Jean

Attachment: signature.asc
Description: This is a digitally signed message part


reply via email to

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