«Wine Glass Code - Edited» by schun
on 16 Mar'16 01:02 inThis is an addition to my first code of wine glass sound: "The friction between a finger dipped in water and the edge of a wine glass creating a sound." I have added a couple more synthdefs/codes to demonstrate the differences when modfreq is changed. A higher modfreq changes the purity of the tone.
1 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 41 42 43 44 45 46 47 48 49 50 51 52 53 54
// Wine Glass Sound ( SynthDef("AM", { arg freq = 523.25, modfreq = 1, amp = 0.5, attack = 2, dur = 5, pos = 0; var carrier, modulator, env; modulator = SinOsc.kr(modfreq).range(0, 1); carrier = SinOsc.ar(freq: freq, mul: modulator); env = Env.perc(attackTime: attack, releaseTime: dur - attack, level: amp).kr(2); carrier = carrier * env; Out.ar(0, Pan2.ar(carrier, pos)) }).add; ) ( Pbind( \instrument, "AM", \note, 15, \dur, 10, \amp, Pwhite(0.5, 0.1), \att, 1, \rel, 10 ).play; ) // changes to the modfreq in SynthDef "AM1" -- rougher rubbing against the glass ( Pbind( \instrument, "AM", \note, 15, \dur, 10, \amp, Pwhite(0.5, 0.1), \att, 1, \rel, 10, \modfreq, 10 ).play; ) // even higher modfreq -- greater number of voices ( Pbind( \instrument, "AM", \note, 15, \dur, 10, \amp, Pwhite(0.5, 0.1), \att, 1, \rel, 10, \modfreq, 1000 ).play; )
reception
comments