«Midterm Question 1» by Mason McCormack
on 31 Oct'16 05:31 in1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40
( SynthDef("pulsey", {arg freq = 40, amp = 0.1; var env = Pulse.kr var snd = Pulse.ar( freq: LFNoise2.kr([4,5,7]).range(0.988, 1.011), mul: Env.perc(attackTime:0.2, releaseTime: 4, level:amp).kr(2) ); LPF.ar(in: snd, freq:1000); snd = Splay.ar(snd); Out.ar(0,snd) }).add; ) ( m = [72, 79, 77, 79, 82, 79, 87, 86, 84, 82, 84, 79]; Pbind( \instrument, "pulsey", \midinote, Pseq(m, inf), \dur, Pseq([Pn(0.5, 5), 1.5], inf), \amp, Pwhite(0.15, 0.2) ).play; Pbind( \instrument, "pulsey", \midinote, Pseq(m.reverse, inf), \dur, Pseq([Pn(0.5, 5), 1.5], inf), \ctranspose, Pwrand([-12, -7, -24], [0.8, 0.1, 0.1], inf), \amp, 0.08, ).play; )
reception
SynthDef code throws an error message due to incomplete line 3. Line 3: wrong envelope spec, should be Env.perc Line 5: should be freq * LFNoise2.kr, not just LFNoise2.kr
0.5 pt
Line 3: Env.perc should be there, not a Pulse.kr
Line 3: missing semicolon at end
Line 5: missing freq * before LFNoise2. The result is that your frequencies are all between 0.988 and 1.011, which are not audible.
Line 6: Env.perc is correct, but you should have put it in the variable env on line 3.
// Code does not works as expected (no errors, and it makes sound)
// SynthDef argument freq is not used at all in the body of the SynthDef.
// Variable env is not used correctly to organize code
// UGen Pulse.kr does not belong, and freq input of Pulse is incomplete.
// As a result, example Pbind does not work.