I watched this excellent video (1st video below) by @kindohm and have been feeling pretty inspired by the plyWith function. To that end, I started looking into custom functions to save some time writing code. @kindohm also has a super informative tutorial on writing custom functions (2nd video below) that I used to make the following:
let plyCato num amt = plyWith num (|* legato amt)
plyDown num amt = plyWith num (|* gain amt)
Here's a tldr/tldw for each function:
plyCato takes a sound and repeats it in increasing/decreasing increments determined by amt. In short, it creates a stuttery repeat trail for a sound.
plyDown does the same as plyCato but reduces/increases the gain instead of playback length.
I'd love to use this thread to share functions and help each other find new shortcuts to interesting sounds!
let sinosc min max frq = (fast frq $ range min max sine)
triosc min max frq = (fast frq $ range min max tri)
sqrosc min max frq = (fast frq $ range min max square)
sawosc min max frq = (fast frq $ range min max saw)
randosc min max = (range min max rand)
d1 $ s "bd*8" # gain (sinosc 0.4 1 1)
Get random notes in a scale
let randscale sc n f = (|+ note (scale sc (irand n))) f
d1 $ randscale "phryigian" 7 $ s "arpy(9,16,12)"
Flip your melody/harmony vertically
let invnote n = 0-n
invnote' axis x = (2*axis)-n
d1 $ note (invnote' "<5 7>/4" "<c'maj7(5,8) d'm11(<3 [3 5]>,8)>") # s "superpiano" # room 0.5 # velocity 0.8
Thanks, this could open a whole new door for me, I think! Two questions: could I put these in my BootTidal.hs so that they are ready to go? Or somewhere else? And, is it necessary to write type declarations to go with them?
Yes you could place them at the end of your BootTidal.hs. I'm assuming you're talking about Haskell's type declaration, using :: and ->. If I recall correctly that's not needed, the compiler will do the work for you, and since these are a small number of functions it shouldn't be a problem at all.
[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: