Created
May 12, 2014 15:22
-
-
Save jkant76/3a587af63ff5c774efa4 to your computer and use it in GitHub Desktop.
This file contains 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
public class addsyn | |
{ | |
ADSR env => NRev rev => Pan2 pan => dac; | |
( 3::second, 100::ms, .5, 3::second ) => env.set; | |
// an additive synth to create wavetables | |
fun void maketable(float root, float partials[], float amps[]) | |
{ | |
SinOsc s[partials.cap()]; | |
for (0 => int j; j < partials.cap(); 1 +=> j) | |
{ | |
Math.random2f(0.1,0.5) => rev.mix; | |
Math.random2f(-1.0,1.0) => pan.pan; | |
root*partials[j] => s[j].freq; | |
amps[j] => s[j].gain; | |
s[j] => env; | |
} | |
} | |
fun void play() | |
{ | |
1 => env.keyOn; | |
} | |
fun void stop() | |
{ | |
1 => env.keyOff; | |
} | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment