Created
February 1, 2016 14:28
-
-
Save kn1kn1/586cbf00fd6890c2cd71 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 | |
// cf. https://gist.github.com/kn1kn1/bfb750a57895b804907c | |
( | |
SynthDef("laserbeam", { | |
arg out = 0, pan = 0.0, freq = 440, amp = 0.1, dur = 0.25; | |
var snd, freqenv, ampenv; | |
// frequency envelope | |
freqenv = EnvGen.kr(Env([1, 0.25], [dur/2])); | |
// amplitude envelope | |
// no gate: fixed-time envelope, self-terminating. | |
ampenv = EnvGen.kr( | |
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(145, 155), | |
\midinote, 150, | |
\amp, 0.25, | |
\dur, 0.125; | |
).play; | |
) |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment