Skip to content

Instantly share code, notes, and snippets.

View iTerentius's full-sized avatar

Isaac T Linder iTerentius

  • Medicom Health Interactive & Hypostatic Design
  • Minneapolis, MN
View GitHub Profile
// Only pull a value once per clock time - else, return the previous value
PtimeClutch : FilterPattern {
var <>delta;
*new {
|pattern, delta=0.0|
^super.new(pattern).delta_(delta);
}
embedInStream {
@iTerentius
iTerentius / CONDTIONALS
Created May 18, 2020 14:07 — forked from alptugan/CONDTIONALS
Sonic Pi Cheat Sheet
So, let’s flip a coin: if it’s heads, play a drum, if it’s tails, play a cymbal. Easy. We can emulate a coin flip with our one_in function (introduced in the section on randomness) specifying a probability of 1 in 2: one_in(2). We can then use the result of this to decide between two pieces of code, the code to play the drum and the code to play the cymbal:
loop do
if one_in(2)
sample :drum_heavy_kick
else
sample :drum_cymbal_closed
end