Non-integer tempo marking

classic Classic list List threaded Threaded
9 messages Options
Reply | Threaded
Open this post in threaded view
|

Non-integer tempo marking

Tsz Kiu Pang
Hi all,

I am just wondering if there is a way to have a non-integer tempo marking (e.g. crotchet = 72.5)?

Thank you for your time.

Kind regards,
Tsz-Kiu

_______________________________________________
lilypond-user mailing list
[hidden email]
https://lists.gnu.org/mailman/listinfo/lilypond-user
Reply | Threaded
Open this post in threaded view
|

Re: Non-integer tempo marking

Brian Barker
At 12:48 23/02/2019 +1100, Tsz Kiu Pang wrote:
>I am just wondering if there is a way to have a non-integer tempo
>marking (e.g. crotchet = 72.5)?

How about \tempo 8 = 145 ?

Brian Barker


_______________________________________________
lilypond-user mailing list
[hidden email]
https://lists.gnu.org/mailman/listinfo/lilypond-user
Reply | Threaded
Open this post in threaded view
|

Re: Non-integer tempo marking

Martin Tarenskeen


On Sat, 23 Feb 2019, Brian Barker wrote:

> At 12:48 23/02/2019 +1100, Tsz Kiu Pang wrote:
>> I am just wondering if there is a way to have a non-integer tempo marking
>> (e.g. crotchet = 72.5)?
>
> How about \tempo 8 = 145 ?

The OP writes "e.g.". Your workaround can work for this particular example
(though it's not quite the same) but not for something like \tempo 4=75.2

If such a tempo marking makes practical sense is another discussion.

--

MT

_______________________________________________
lilypond-user mailing list
[hidden email]
https://lists.gnu.org/mailman/listinfo/lilypond-user
Reply | Threaded
Open this post in threaded view
|

Re: Non-integer tempo marking

Martin Tarenskeen
In reply to this post by Tsz Kiu Pang


On Sat, 23 Feb 2019, Tsz Kiu Pang wrote:

> Hi all,
>
> I am just wondering if there is a way to have a non-integer tempo
> marking (e.g. crotchet = 72.5)?

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 }

%%%%%%%%%%


MT

_______________________________________________
lilypond-user mailing list
[hidden email]
https://lists.gnu.org/mailman/listinfo/lilypond-user
Reply | Threaded
Open this post in threaded view
|

Re: Non-integer tempo marking

Andrew Bernard
In reply to this post by Tsz Kiu Pang
Hi Pang,

This won't help for MIDI, as has been pointed out, but you did not specify that.

Here's my function for metronome marks, which allows you to use notes in them. I have a whole bunch of related functions, some with boxes, some with additional text parameters and so on. You can obviously put any number you like in here. [I have edited this a little, because I use custom had made fonts for notes and I just deleted all that for this example to help, so it may not be quite so beautiful as in my own context.]


I am pretty sure every man and his dog is going to criticise the idea of a metro mark of 72.5, as players, if this is for humans, can't attain that accuracy. No metronome I have, mechanical or digital, will let me set a fractional tempo. Just saying.

Andrew

%=====

metroMark =
#(define-event-function (duration arg y-offset)
   (ly:duration? markup? (number? 0))
   #{
     ^\markup
     {
       %\with-color #(x11-color 'grey50)
       \raise #y-offset \concat {
         {
           \score {
             \new Staff \with {
               \remove "Staff_symbol_engraver"
               \remove "Time_signature_engraver"
               \remove "Clef_engraver"
             }
             { \relative c'' { \stemUp \omit Accidental c$duration } }
             \layout {
               indent = 0
               ragged-right = ##t
             }
           }
         }
         \sans \fontsize #-1 #arg
       }
     }
   #})

%====



On Sat, 23 Feb 2019 at 14:07, Tsz Kiu Pang <[hidden email]> wrote:

I am just wondering if there is a way to have a non-integer tempo marking (e.g. crotchet = 72.5)?

Thank you for your time.


_______________________________________________
lilypond-user mailing list
[hidden email]
https://lists.gnu.org/mailman/listinfo/lilypond-user
Reply | Threaded
Open this post in threaded view
|

Re: Non-integer tempo marking

Aaron Hill
In reply to this post by Martin Tarenskeen
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

_______________________________________________
lilypond-user mailing list
[hidden email]
https://lists.gnu.org/mailman/listinfo/lilypond-user
dak
Reply | Threaded
Open this post in threaded view
|

Re: Non-integer tempo marking

dak
Aaron Hill <[hidden email]> writes:

> 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
>   } }
> %%%%

It was not "deprecated" as much as illegal syntax.

> Mind you, that rule was back in 2.9.16.

And mind you, a rule reversing that rule was placed in 2.15.32 as a
followup to

commit e995ed461610c2bb9c9cd43eaa715905b8525b95
Author: David Kastrup <[hidden email]>
Date:   Sun Feb 26 19:16:00 2012 +0100

    Allow music with layout instructions in output definitions.
   
    This allows things like
   
      \layout { \accidentalStyle modern }
   
    or
   
      \midi { \tempo 4 = 80 }
   
    to work as intended.

> And it doesn't sound like anything was actually deprecated if \tempo
> still works in \midi.

It wasn't deprecated, it was invalid until 2.15.32.

> 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 BPM logic warrants eventual revision since it hardcodes 384 MIDI
clock ticks per quarter note in

lily/audio-item.cc:  return int (moment_to_real (m) * 384 * 4);
lily/midi-walker.cc:                        Real (384 * 4)) + now_ticks;
lily/performance.cc:  midi_stream.write (Midi_header (1, tracks_, 384));

and probably other locations.

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

--
David Kastrup

_______________________________________________
lilypond-user mailing list
[hidden email]
https://lists.gnu.org/mailman/listinfo/lilypond-user
Reply | Threaded
Open this post in threaded view
|

Re: Non-integer tempo marking

Tsz Kiu Pang
In reply to this post by Martin Tarenskeen
Hi Martin,

Sorry for the late reply.
Thank you very much for you help.

I should have clarified that the non-integer tempo marking is for metric modulation in the middle of the score(not shown below),
hence the situation is complicated for the midi, but I guess I will settle for the score for now.

I modified your markup a little bit to keep the tempo font consistent (with the other tempo marking without using \markup):

%%%%%%%%%%

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

%%%%%%%%%%

--
Tsz Kiu

On Sat, 23 Feb 2019 at 18:29, Martin Tarenskeen <[hidden email]> wrote:


On Sat, 23 Feb 2019, Tsz Kiu Pang wrote:

> Hi all,
>
> I am just wondering if there is a way to have a non-integer tempo
> marking (e.g. crotchet = 72.5)?

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 }

%%%%%%%%%%


MT

_______________________________________________
lilypond-user mailing list
[hidden email]
https://lists.gnu.org/mailman/listinfo/lilypond-user
Reply | Threaded
Open this post in threaded view
|

Re: Non-integer tempo marking

Tsz Kiu Pang
In reply to this post by Andrew Bernard
On Sat, 23 Feb 2019 at 18:42, Andrew Bernard <[hidden email]> wrote:
Hi Pang,

This won't help for MIDI, as has been pointed out, but you did not specify that.

That is okay. Although ideally I want to get the MIDI to work, but for now I will settle for the score.

Here's my function for metronome marks, which allows you to use notes in them. I have a whole bunch of related functions, some with boxes, some with additional text parameters and so on. You can obviously put any number you like in here. [I have edited this a little, because I use custom had made fonts for notes and I just deleted all that for this example to help, so it may not be quite so beautiful as in my own context.]

Thank you very much for your help, Andrew, and sorry for the late reply.
I think I can see what your function is trying to do,
but unfortunately despite days of looking at the lilypond documentation,
I still have not figure out the syntax for calling a function in lilypond,
in particular I am struggling with the syntax for the arguments.
Would you kindly please show me how to call your function \metroMark?

I am pretty sure every man and his dog is going to criticise the idea of a metro mark of 72.5, as players, if this is for humans, can't attain that accuracy. No metronome I have, mechanical or digital, will let me set a fractional tempo. Just saying.

Sorry I should have mentioned that using a non-integer tempo marking is for a metric modulation in the music.
The tempo is more like a reference for the musician, alongside with the tempo relationship between the two section.

_______________________________________________
lilypond-user mailing list
[hidden email]
https://lists.gnu.org/mailman/listinfo/lilypond-user