Created
October 4, 2016 23:03
-
-
Save jrsa/4e6a0e7175964938a6a8a1cce6963930 to your computer and use it in GitHub Desktop.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
class DelayLine { | |
44100 => int n; | |
float buffer[n]; | |
int pointer; | |
fun float tap(int i) { | |
pointer - i => int index; | |
if(index < 0) { | |
index + n => index; | |
} | |
return buffer[index]; | |
} | |
fun void next(float x) { | |
x => buffer[pointer]; | |
(pointer + 1) % n => pointer; | |
} | |
} | |
class comb extends Chugen { | |
DelayLine d; | |
0.7 => float g; | |
Math.random2(100, 1000) => int n; | |
fun float tick(float xn) { | |
xn + d.tap(n) * g => float yn; | |
yn => d.next; | |
return yn; | |
} | |
} | |
Impulse i => comb c=> comb c1=> comb c2 => dac; | |
1.0 => i.next; | |
0.14::second => now; | |
1.0 => i.next; | |
0.14::second => now; | |
1.0 => i.next; | |
0.14::second => now; |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment