Some math, please ! (calculate sample length after variable playback speed)
Mousin
9月 17 2018 | 2:06 午後
Hi,
I don't know if someone could help me.
I would like to calculate the length of a sample playback after applying a speed ratio controlled by env.
if needed, to keep eventual formula simple, let's say (with a simple linear attack/decay env):
>>> env goes from a speed factor of MinSF to MaxSF in AttackT ms, and goes from a speed factor of MaxSF to MinSF in DecayT ms (Message to [line] >> "MinSF, MaxSF AttackT MinSF DecayT")
SL - the length of sample played at original speed (speed factor 1.)
MinSF - Start and End env speed factor
MaxSF - the env maximum speed factor. (a speed factor of 2 play the sample in SL/2. ms, a speed factor of 0.5 play the sample in SL/0.5 ms)
AttackT - Attack time in ms (range: any >= 0. float)
DecayT - Decay time in ms (range: any >= 0. float)
(The result should give the length when the sample is played until the end, witch can happen before or after the end of the env)
Is that possible to calculate that with Max ?
Many thanks by advance !
Floating Point
9月 19 2018 | 12:17 午前
I think this works:
but you'd need to test it.
It's derived from the kinematics equation to calculate distance given starting velocity and constant acceleration: s=ut + 1/2 at^2
which simplifies to: attack_time*(SFmin+SFmax)/2 in your parlance
and same for decay time (then just add them together)
MAXIME JERRY FRAISSE
5月 21 2023 | 6:05 午後
hello 2018! Mousin, did you find a solution? it doesn't seem to work for me.
Roman Thilenius
5月 21 2023 | 7:59 午後
if the segments are actually linear, you can safely assume the mid-point to be the average speed of that segment.
if they are not linear you should ask albert einstein or try another hobby.
MAXIME JERRY FRAISSE
5月 21 2023 | 8:59 午後
do you mean this should work ?
initial sample length = 1s
start speedRatio = 2
end speedRatio = 0.5
new time = 1,25s ?