Submit
Browse
Anonymous
Login
RSS
SuperCollider Code
Fork Code: Build It Up - A2 - 115modulations
name
code content
// ======================= // MUSC 115 Assigment 2 // ======================= // SynthDefs (AM and FM) // ======================= // Your name: Lydia Davidson ( SynthDef("am1", {arg freq = 440, modfreq = 2, amp = 0.2, 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("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("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.01); 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; SynthDef("fm1", {arg freq = 440, modfreq = 5, modindex = 10, amp = 0.1, pos = 0, gate = 1, att = 0.01, rel = 0.3; var carrier, modulator, freqdev, env; // i = d/m, so d = m*i 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("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("hihat", {arg out = 0, amp = 0.5, att = 0.01, rel = 0.2, ffreq = 6000, pan = 0; var env, snd; env = Env.perc(att, rel, amp).kr(doneAction: 2); snd = WhiteNoise.ar; snd = HPF.ar(in: snd, freq: ffreq, mul: env); Out.ar(out, Pan2.ar(snd, pan)); }).add; ) // end of SynthDef code // ======================== // Pbind collection // // tip: to work on a Pbind separately, copy and paste it // into a new window, add .play at end for convenience // (change/listen/change again/listen again), // and when you are done, copy it back here, don't // forget to REMOVE the .play from it. // Also create your own variable names that make sense to you. // ======================== ( ~beat = Pbind( \instrument, "am1", \midinote, Pseq([35, 37, 37, 39, 39, 39, 39, 37, 37, 37], inf), \ctranspose, 0, \dur, Pseq([4/8, 2/8, 2/8, 1/8, 1/8, 1/8, 1/8, 4/8, 4/8, 4/8], inf) , \amp, Pwhite(0.2, 0.5), \att, 0.01, \rel, 0.1, \modfreq, Prand([10, 20, 25, 30], inf), \pos, 0 ); ~fmletsdothis = Pbind( \instrument, "fm2", \dur, Pseq([ Pn(1/8, 6), 3/8, Pn(2/8, 5), 5/8, 3/8, 3/8, 3/8, 3/8, 4/8, Pn(2/8, 3), 1.5 ], 5) * 2, \midinote, Pseq([ 60, 56, 55, 48, 60, 56, Pn([36, 43, 52, 60], 3), Pn([37, 44, 53, 60], 2), Pn([39, 46, 55, 60], 2), 55, 56, 58, 60, Pn([41, 48, 57, 60], 1), Pn([41, 48, 56, 60], 2), Pn([39, 46, 55, 60], 2) ], inf), \ctranspose, ([11, 16]), \modindex, Pseq([6, 7, 9], inf), \amp, 0.1, \att, 0.5, \rel, Pwhite(0.5, 0.7), \pos, 0 ); ~tone = Pbind( \instrument, "fm2", \dur, Pseq([14.5]), \midinote, 60, \modindex, 0, \ctranspose, 16, \amp, 0.1, \att, 1, \rel, 0/1, \pos, 0 ); ~hihat = Pbind( \instrument, "hihat", \dur, 1/16, \att, 0.01, \rel, 0.5, \ffreq, 18000, \pan, 0, \amp, 0.05 ); ~harmonics = Pbind( \instrument, "am2", \midinote, Pseries([36, 43, 56]), \modfreq, Pseq([1, 10, 50], inf), \ctranspose, 11, \amp, Pseq([0.02, 0.02, 0.01, 0.01, 0.008, 0.005], 14.5), \att, 0.02, \rel, 4, \pos, Pwhite(-1, 1), \dur, 0.1 ); ) // end of Pbind collection // ============= // Double check your the Pbinds (listen) // Remember: some of them are inf, others are finite // you can adjust that by changing the Pbinds // ============= ~beat.play; ~harmonics.play; ~hihat.play; ~tone.play; ~fmletsdothis.play; // ============= // COMPOSITION // ============= // Build your sequence here // you can use either {}.fork or Pspawner // see Pspawner help file. ( Pspawner({arg maestro; maestro.par(~fmletsdothis); maestro.wait(14.5); ~player1 = maestro.par(~beat); maestro.wait(14.5); ~player2 = maestro.par(~hihat); maestro.wait(14.5); maestro.par(~harmonics); maestro.wait(14.5); maestro.suspend(~player1); maestro.suspend(~player2); maestro.seq(~tone); maestro.suspendAll; }).play; )
code description
https://soundcloud.com/lydia-davidson-919585173/build-it-up-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