Created
January 14, 2016 13:37
-
-
Save kn1kn1/bfb750a57895b804907c 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
// cf. https://github.com/brunoruviaro/SynthDefs-for-Patterns/blob/master/laserbeam.scd | |
( | |
SynthDef("laserbeam", { | |
arg out = 0, pan = 0.0, freq = 440, amp = 0.1, dur = 0.25; | |
var snd, freqenv, ampenv; | |
// frequency envelope | |
freqenv = EnvGen.ar(Env([1, 0.25], [dur/2])); | |
// amplitude envelope | |
// no gate: fixed-time envelope, self-terminating. | |
ampenv = EnvGen.ar( | |
envelope: Env([1, 0], [dur/2]), | |
levelScale: amp, | |
doneAction: 2); | |
snd = LFTri.ar(freq: freq * freqenv, mul: ampenv); | |
// snd = SinOsc.ar(freq: freq * freqenv, mul: ampenv); | |
Out.ar(out, Pan2.ar(snd, pan)); | |
}).add; | |
) | |
( | |
Pbind( | |
\instrument, "laserbeam", | |
\pan, Pwhite(-1.0, 1.0), | |
\midinote, Pwhite(140, 144), | |
\amp, 0.5, | |
\dur, 0.25; | |
).play; | |
) | |
Env.new([1, 0.25], [0.125]).plot; |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment