Re: BPM in music software [WAS] Re: Connect pipewire to running JACK server

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

 



Fons Adriaensen <fons@xxxxxxxxxxxxxx> writes:

> On Fri, Jan 28, 2022 at 01:35:23PM +0100, David Kastrup wrote:
>
>> I cannot speak in general terms, but you need to keep several sources
>> with different note lengths in sync.  LilyPond, a music typesetter, does
>> this by using exact rational numbers.  Exponential speedups/slowdowns
>> are pretty bad at managing the mapping of a rational note length grid to
>> a rational timeline, with nominators and denominators of manageable
>> size.  So one needs to be somewhat careful about the formulas to employ.
>
> I rational arithmetic is used to avoid accumulating small errors (that is
> the normal use case) I don't see the need for it in this context.
>
> Tempo ramps happen between begin and end points and as long as these
> are accurate, there will be no accumlating error.

LilyPond uses times to keep track of simultaneousness of things
happening in different parallel constructs with potentially different
rational substructure.  There is no leeway for events from different
voices to change order.

> For example you could express time as integer microseconds and beats
> as k / N with N something like 2^8 * 3^4 * 5 * 7 which allows all
> common divisions of a beat to be exact with integer k [1].
>
> The calculations that map time to beats or beats to time _within_ a
> tempo ramp can be safely done using floating point (as an offset from
> the start point) and the results rounded to the rational format.

LilyPond does not do floating point in its timing.  It's deterministic.
Now musical timing and Midi timing are not necessarily the same, but
Midi also has requirements like needing to release a key before it gets
triggered again, and needing to have instrument changes occur before the
respective key is pressed.  When the respective events originate from
different streams only synchronised by absolute time, you don't want to
end up with too much of a mess.

The Midi way of maintaining musical time while changing real time is to
change the tempo value, and you cannot really change tempo between note
events.  So you want some formula that works consistently even with
differently spaced notes.

Bit of a headache.

-- 
David Kastrup
_______________________________________________
Linux-audio-user mailing list
Linux-audio-user@xxxxxxxxxxxxxxxxxxxx
https://lists.linuxaudio.org/listinfo/linux-audio-user




[Index of Archives]     [Linux Sound]     [ALSA Users]     [Pulse Audio]     [ALSA Devel]     [Sox Users]     [Linux Media]     [Kernel]     [Photo Sharing]     [Gimp]     [Yosemite News]     [Linux Media]

  Powered by Linux