# Some math, please ! (calculate sample length after variable playback speed)

Mousin

Sep 17 2018 | 2:06 pm

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 !