Submit
Browse
Anonymous
Login
RSS
SuperCollider Code
Fork Code: Assignment 2
name
code content
( SynthDef("fm2", {arg freq = 440, modindex = 10, amp = 0.1, pos = 0, gate = 1, att = 0.01, 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("am1", {arg freq = 440, modfreq = 2, amp = 0.1, att = 0.01, 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("am3", {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); freq = freq * LFNoise2.kr([2, 1/2, 1/3, 1/4, 1]).range(0.98, 1.02); carrier = Pulse.ar(freq: freq, mul: env * modulator); carrier = Mix.ar(carrier); carrier = LPF.ar(carrier, Line.kr(10000, 1000, att)); Out.ar(0, Pan2.ar(carrier, pos)); }).add; ) ( ~fmbass = Pbind( \instrument, "fm2", \dur, Pseq([1, Rest(1), 0.5, 0.5, Rest(1/64), 1/4, Rest(1/64), 1/4, 1/4, 1/4], inf), \note, Pseq([0, \rest, 0, -2, \rest, 2, \rest, 3, 3, 2], inf), \ctranspose, -18, \modindex, 6, \amp, Pseq([0.3, 0.35, 0.4, 0.45, 0.5, 0.45, 0.4, 0.3, 0.2], inf), \att, 0.01, \rel, 0.2, \pos, 0 ); ~fmbass2 = Pbind( \instrument, "am3", \dur, Pseq([1, Rest(1), 0.5, 0.5, Rest(1/64), 1/4, Rest(1/64), 1/4, 1/4, 1/4], inf), \note, Pseq([0, \rest, 0, -2, \rest, 2, \rest, 3, 3, 2], inf), \ctranspose, -18, \modindex, 6, \amp, Pseq([0.3, 0.35, 0.4, 0.45, 0.5, 0.45, 0.4, 0.3, 0.2], inf), \att, 0.01, \rel, 0.2, \pos, 0 ); ~amz = Pbind( \instrument, "am1", \midinote, Pseq([[91.8,92], [86.8,87], [88.8,89], [91.8,92]], inf), \ctranspose, -6, \dur, Pseq([Pn(0.5, 5), 0.3], inf), \amp, 0.05, \att,0.01, \rel, 0.9, \modfreq, 2, \pos, Pwhite(-0.5, 0.5) ); ~amik = Pbind( \instrument, "am3", \midinote, Pseq([67, 69, 70], [51, 53, 55], [47, 48, 49], inf), \ctranspose, -12, \dur, Pseq([1/2, 1/2, Rest(1), 1/2, 1/2, Rest(1), 1/2, Rest(1/2), 1/2, Rest(1/2), Rest(1)], inf) *(1/4), \amp, 0.15, \att, 0.1, \rel, 0.5, \modfreq, 6, \pos, Prand([-0.5, 0, 0.5], inf), ); ) s.record; ( { t=TempoClock(120/60); ~amzPlayer=~amz.play; 7.wait; ~amzPlayer.stop; ~fmbass2PLayer=~fmbass2.play; 10.wait; ~fmbassPlayer=~fmbass.play; 6.wait; ~amik.play; 6.wait; ~amzPlayer=~amz.play; 2.wait; ~amzPlayer.stop; ~fmbass2PLayer.stop; ~fmbassPlayer.stop; ~fmbass.play(t); ~fmbassPlayer.stop; ~fmbass.play; }.fork; )
code description
115modulations
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