Created
May 14, 2011 11:32
-
-
Save en45masao/972131 to your computer and use it in GitHub Desktop.
Generates and plays a wav file -- one of the most famous jingle
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
ADSR env; | |
env.set(50::ms, 250::ms, 0.5, 100::ms); | |
JCRev rev; | |
0.25 => rev.mix; | |
Chorus cho; | |
0.2 => cho.modDepth; | |
0.25 => cho.mix; | |
WvOut wout; | |
wout.wavFilename("sega.wav"); | |
Gain g; | |
0.1 => g.gain; | |
SqrOsc osc1 => env => cho => rev => wout => g => dac; | |
SqrOsc osc2 => env => cho => rev => wout => g => dac; | |
SqrOsc osc3 => env => cho => rev => wout => g => dac; | |
0.005 => osc1.gain => osc2.gain => osc3.gain; | |
osc1.freq(Std.mtof(58)); // A#3 | |
osc2.freq(Std.mtof(63)); // D#4 | |
osc3.freq(Std.mtof(67)); // G4 | |
env.keyOn(); | |
500::ms => now; | |
env.keyOff(); | |
osc1.freq(Std.mtof(55)); // G3 | |
osc2.freq(Std.mtof(60)); // C4 | |
osc3.freq(Std.mtof(64)); // E4 | |
env.keyOn(); | |
1000::ms => now; | |
env.keyOff(); | |
250::ms => now; |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment