Speed knob scaling formula?

https://vi-control.net/community/threads/what-is-the-formula-for-this.3978/
These are the only real discussions I could find on this topic, and they're from 2006. Basically I need the percent value (0-800%) that's set with the speed knob in TM2 mode. I need this value because I need to determine how long it takes for a part of my sample to play. Approximations won't work for my needs -- even a few milliseconds of error could be a problem. What is the current best solution for this? Has anyone ever figured out the formula(s)? If not, is the lookup table given in that forum post the furthest anyone has gotten? I figured I could have my speed knob snap to whole percent values and then look up the 0-1000k value to send to the real speed knob. The lookup table in those threads starts jumping by 10 at 150.
Best Answer
-
If you use SublimeKSP, you can use these two conversion functions, for engine par to real-world value, and vice versa:
define int(x) := real_to_int(x) define real(x) := int_to_real(x) function math.log2(value) -> return return := log(value) / log(2.0) end function function math.cbrt(value) -> return return := pow(value, 1.0 / 3.0) end function { USAGE E2V -> Engine Parameter to Real-World V2E -> Real-World to Engine Parameter ARGS x - input number for equation. INFO Fundamental equation: speed = 2^[K * (X^3 + 1) + A, K = 2.807354922, A = 7.380821784 E2V output and V2E input: 0.0% to 800.0% (scaled by 10) Accepts and returns only integers! } define E2V.SPEED_BASE(ep) := int(round(pow(2.0, 2.807354922 * (pow(((float(ep) - 500000.0) / 500000.0), 3.0) + 1.0) + 7.380821784) - 166.666666)) define V2E.SIGN(ep) := ((math.log2(float(ep) + 166.66666) - 7.380821784) / 2.807354922 - 1.0) / abs(((math.log2(float(ep) + 166.66666) - 7.380821784) / 2.807354922 - 1.0)) define V2E.SPEED_BASE(ep) := int(math.cbrt(abs((math.log2(float(ep) + 166.66666) - 7.380821784) / 2.807354922 - 1.0)) * (V2E.SIGN(ep) * 500000.0) + 500000.0) function E2V.speed(x) -> return return := E2V.SPEED_BASE(x) end function function V2E.speed(x) -> return return := V2E.SPEED_BASE(x) end function
0
Answers
-
@Matt @ NI knows anyone can help this guy? I never seen this before and i don't know how to help him.
0 -
This is way beyond my level of expertise 😅
It's something for @EvilDragon perhaps.
0 -
If you use SublimeKSP, you can use these two conversion functions, for engine par to real-world value, and vice versa:
define int(x) := real_to_int(x) define real(x) := int_to_real(x) function math.log2(value) -> return return := log(value) / log(2.0) end function function math.cbrt(value) -> return return := pow(value, 1.0 / 3.0) end function { USAGE E2V -> Engine Parameter to Real-World V2E -> Real-World to Engine Parameter ARGS x - input number for equation. INFO Fundamental equation: speed = 2^[K * (X^3 + 1) + A, K = 2.807354922, A = 7.380821784 E2V output and V2E input: 0.0% to 800.0% (scaled by 10) Accepts and returns only integers! } define E2V.SPEED_BASE(ep) := int(round(pow(2.0, 2.807354922 * (pow(((float(ep) - 500000.0) / 500000.0), 3.0) + 1.0) + 7.380821784) - 166.666666)) define V2E.SIGN(ep) := ((math.log2(float(ep) + 166.66666) - 7.380821784) / 2.807354922 - 1.0) / abs(((math.log2(float(ep) + 166.66666) - 7.380821784) / 2.807354922 - 1.0)) define V2E.SPEED_BASE(ep) := int(math.cbrt(abs((math.log2(float(ep) + 166.66666) - 7.380821784) / 2.807354922 - 1.0)) * (V2E.SIGN(ep) * 500000.0) + 500000.0) function E2V.speed(x) -> return return := E2V.SPEED_BASE(x) end function function V2E.speed(x) -> return return := V2E.SPEED_BASE(x) end function
0 -
Awesome, thanks ED.
0
Categories
- All Categories
- 19 Welcome
- 1.5K Hangout
- 62 NI News
- 788 Tech Talks
- 4.1K Native Access
- 16.6K Komplete
- 2K Komplete General
- 4.3K Komplete Kontrol
- 5.7K Kontakt
- 1.6K Reaktor
- 380 Battery 4
- 849 Guitar Rig & FX
- 429 Massive X & Synths
- 1.3K Other Software & Hardware
- 5.8K Maschine
- 7.3K Traktor
- 7.3K Traktor Software & Hardware
- Check out everything you can do
- Create an account
- See member benefits
- Answer questions
- Ask the community
- See product news
- Connect with creators