Submit
Browse
Anonymous
Login
RSS
SuperCollider Code
Fork Code: A2
name
code content
//BEGIN SYNTH DEFS//////// ( SynthDef("am1", {arg freq = 440, modfreq = 2, amp = 0.2, att = 0.5, rel = 3; var carrier, modulator, env; env = Env.perc( attackTime: att, releaseTime: rel, level: amp ).kr(2); modulator = SinOsc.ar(modfreq).range(0, 1); carrier = SinOsc.ar(freq: freq, mul: env * modulator); Out.ar(0, carrier ! 2); }).add; SynthDef("am2", {arg freq = 440, modfreq = 2, amp = 0.2, att = 0.01, sus = 0.2, rel = 3, gate = 1, pos = 0; var carrier, modulator, env; env = Env.asr( attackTime: att, sustainLevel: sus, releaseTime: rel ).kr(doneAction: 2, gate: gate, mul: amp); modulator = SinOsc.ar(modfreq).range(0, 1); carrier = SinOsc.ar(freq: freq, mul: env * modulator); Out.ar(0, Pan2.ar(carrier, pos)); }).add; SynthDef("fm2", {arg freq = 440, modindex = 10, amp = 0.1, pos = 0, gate = 1, att = 0.1, rel = 0.3; var carrier, modulator, freqdev, env, modfreq; // i = d/m, so d = m*i modindex = Line.kr(modindex, 1, att); modfreq = freq / 2; freqdev = modfreq * modindex; modulator = SinOsc.ar(freq: modfreq, mul: freqdev); carrier = SinOsc.ar(freq: freq + modulator); env = Env.asr( attackTime: att, sustainLevel: amp, releaseTime: rel ).kr(doneAction: 2, gate: gate); carrier = Pan2.ar(in: carrier, pos: pos, level: env); Out.ar(0, carrier * 0.5); }).add; ( SynthDef("snare", {arg out = 0, amp = 0.1, att = 0.01, sus = 1, rel = 0.08, ffreq = 10000, pan = 0; var env, snd; env = Env.perc(att, sus, rel, amp).kr(doneAction: 2); snd = BPF.ar( in: WhiteNoise.ar, freq: ffreq, mul: env ); Out.ar(out, Pan2.ar(snd, pan)); }).add; ) /////END SYNTH DEFS// //BEGIN PBINDS/////// ( ~bass = Pbind( \instrument, "fm2", \dur, 2, \note, Pseq([ Pseq([0, -5, Rest(1), 0, -3, Rest(2), 0, -5], 3), Pseq([0, -5, -6, -5, -4, -3, -2, -1], 1), ], inf), \ctranspose, -12, \modindex, Pseq([ 0, 3, 2, 1, 0, 2, 1, 4, 1, 3, 2, 1, 0, 1, 1, 0, 1, 2, 0, 0, 2, 1], inf), \amp, Pseq([0.3, 0.35, 0.4, 0.35, 0.4, 0.4, 0.3, 0.2], inf), \att, 0.5, \rel, 3.5, \pos, 0 ); ~mel_one = Pbind( \instrument, "am1", \midinote, Pseq([84, 79, 76, 70, 82, 79, 76, 70, 81, 79, 76, 70, 80, 77, 76, 77], 9), \dur, 1, \amp, Pwhite(0.15, 0.2), \att, 1.5, \rel, 0.5, \modfreq, Pseq([0, 8, 0, 4], inf), \pos, Pwhite(-1, 1.0) ); ~mel_two = Pbind( \instrument, "am1", \degree, Pseq([0, 2, 0, 2, 0, 2, 0, 2, Rest(1), 2, Rest(1), 2, Rest(1), 2, 0, 2, -2, 2, -2, 2, -2, 2, -2b, -2, -1b, 2, Rest(1), 2, Rest(1), 2, Rest(1), 2], 4), \modfreq, Pseq([1, 5, 1, 5], inf), \amp, 0.4, \dur, 0.5, \att, 0.01, \rel, Pwhite(0.3, 0.5), \pos, Pwhite(-1, 1.0) ); ~wn = Pbind( \instrument, "snare", \dur, Pseq([Rest(2), 2], 4), \att, 0.1, \rel, Pseq([0.1, 0.3, 0.05, 0,1], inf), \ffreq, Pseq([10000, 5000, 4000, 5000], inf), \amp, 0.01 ); ~harm = Pbind( \instrument, "am2", \freq, Pseries(200, 100, 50, 25, 12.5), \modfreq, Pseq([1, 50, 10, 500, 1000], inf), \amp, 0.1, \att, 0.02, \rel, 8, \pos, Pwhite(-0.5, 0.5), \dur, 0.1 ); ) /////END PBINDS////// //BEGIN QUICK TEST/// ~bass.play; ~mel_one.play; ~mel_two.play; ~wn.play; ~harm.play; /////END QUICK TEST// //BEGIN COMPOSITION// s.record; s.stopRecording; ( { ~bass.play; 4.wait; ~mel_one.play; 64.wait; ~mel_two.play; ~wn.play; 64.wait; ~harm.play; 4.stop; }.fork; )
code description
use markdown for formating
category tags
comma separated, i.g. "wild, siren" (do not enter default SC class names, please)
ancestor(s)
comma separated identificators, i.g. "1-C,1-1,1-4M,1-x"
Private?
the code will be accessible by direct url and not visible in public activity
signup to submit public code without captcha
comment of change