Hi folks!
[Edit:] I completely overlooked that there is already the up
function. However I have made this for using and customizing the live pitch-shifting of an input signal. So this could be helpfully anyway, I think.
I made my own function that converts the speed ratio parameter into notes. For this I wrote a speed' function which I am currently experimenting with:
-- Calculating the n'th root of a value
nroot :: (Integral a, Floating b) => a -> b -> b
n `nroot` x = x ** (1 / fromIntegral n)
-- Calculates the n'th root of all pattern values in p and use the function f (like speed)
nrootFuncs :: Pattern Double -> (Pattern Double -> ControlPattern) -> ControlPattern
nrootFuncs p f = f (fmap (12 `nroot` 2 **) (p))
-- Define custom speed function
speed' :: Pattern Double -> ControlPattern
speed' p = nrootFuncs p speed
To demonstrate this I have created a short video for you:
The video also contains the function psrate
and psrate'
. Unfortunately, you can't reproduce the in
stuff with psrate
at the moment, because there is a small bug in SuperDirt (but it's fixed and waits for the approval)
You can also download the code from the video here: