Skip to content

Instantly share code, notes, and snippets.

@pd3v
Last active April 19, 2021 17:02
Show Gist options
  • Save pd3v/0f9b4ab9a13545437cccb9a566d64cfd to your computer and use it in GitHub Desktop.
Save pd3v/0f9b4ab9a13545437cccb9a566d64cfd to your computer and use it in GitHub Desktop.
Simulating a wah effect with TidalCycles
-- with @yaxu and @bgold help
d1 $ n "c5*8" # s "supersquare" # release "0.3"
# bandf (density 3 $ saw1 * (4500 * rand) + (100 * (density 1.0001 rand)))
# bandq "5.5"
# delay "0.9" # delaytime "0.15" # delayfeedback "0.5" -- some sonic sugar
-- this one is similiar to previous one, just adding harmonic richness by replacing one note (c5) with a chord (c5 major 7th)
d1 $ n "[c5,e5,g5,b5]*8" # s "supersquare" # release "0.3"
# bandf (density 3 $ saw1 * (4500 * rand) + (300 * (density 1.0001 rand)))
# bandq "5.5"
# room "0.3" # size "0.3"
@yaxu
Copy link

yaxu commented Mar 21, 2017

A couple of thoughts.. First you don't need the second discretise because when you combine two patterns (in this case with +) the structure always comes from the left:

d1 $ n "c5*8" # s "supersquare" # release "0.3"
   # bandf (density 3 $ saw1 * (discretise 1 $ rand * 4500) + (rand * 100))
   # bandq "5.5"
   # delay "0.9" # delaytime "0.15" # delayfeedback "0.5" -- some sonic sugar

in fact along these lines you don't need the first one either, you can just swap round the left and right side of *, then the structure will come from 4500, which already is one event per cycle (being the number 4500)

d1 $ n "c5*8" # s "supersquare" # release "0.3"
   # bandf (density 3 $ saw1 * (4500 * rand) + (100 * rand))
   # bandq "5.5"
   # delay "0.9" # delaytime "0.15" # delayfeedback "0.5" -- some sonic sugar

(I swapped the second one as well to put 100 first, just for tidiness)
However there is a problem with using rand more than once in a pattern. rand is a deterministic stream of pseudo-random numbers - if you use it twice in the same pattern, it will have the same value in both cases. You can fix this by changing the density of one of the patterns, then you magically get a different stream of random numbers by 'zooming in' (as rand gives a continuous pattern, this doesn't mean you get fewer values back!).

d1 $ n "c5*8" # s "supersquare" # release "0.3"
   # bandf (density 3 $ saw1 * (4500 * rand) + (100 * (density 1.0001 rand)))
   # bandq "5.5"
   # delay "0.9" # delaytime "0.15" # delayfeedback "0.5" -- some sonic sugar

However I'm unsure about the usefulness of adding together two random streams in this way, unless you wanted the particular distribution it gives you..

Anyway sorry for the ramble, found this interesting!

@pd3v
Copy link
Author

pd3v commented Mar 21, 2017

Cool! I just changed it based on your thoughts. Added also a chord playing version.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment