// title: Digital Harp (and a just intonation demo) // author: akselai // description: // Digital concert harp. Requires DWGPlucked2. // code: ( SynthDef.new(\harp, { |out=0, freq=440, amp=0.5, gate=1, c3=20, pan=0| var env, inp, son, tune, pluck, sost; env = Env.new([0,1, 1, 0],[0.005,0.006, 0.0005],[5,-5, -8]); inp = amp * LFClipNoise.ar(2000) * EnvGen.ar(env,gate); tune = freq.expexp(20.midicps, 100.midicps, 1.003, 1.0001); pluck = freq.explin(20.midicps, 100.midicps, 1/3, 1/2); sost = freq.expexp(20.midicps, 100.midicps, 2, 0.1); son = DWGPlucked2.ar(freq, amp, gate, 4/7, 1/sost, c3, inp, sost, tune); son = LPF.ar(son, max(freq * 3, 2000)) * AmpComp.kr(freq, 300, 1/2); DetectSilence.ar(son, 0.0001, doneAction:2); Out.ar(out, Pan2.ar(son * 0.05, pan)); }).add; ) ( ~melody = [ 3, [7, 9, 12], [6, 8, 11], [7, 9, 12], [7, 9, 12], [6, 7, 9], 7/2, [6, 9, 11], [5, 7, 21/2], [6, 8, 10], [6, 8, 10], [5, 6, 8] ]; ~strum_patterns = [ Pseq([1, 2, 1, 1/2, 1/2, 3]), Pseq([1, 1, 2, 4/3, 4/3, 4/3]), Pseq([1, 2, 1/2, 1/2, 1, 3]), Pseq([1, 1, 1, 1/2, 1/2, 2]), Pseq([1, 1, 1, 1, 1, 1]), Pseq([1, 1, 1/2, 1/2, 1, 2]), ]; Pbind.new( \instrument, \harp, \delta, Prand(0.7*~strum_patterns, inf), \legato, inf, \amp, 0.5, \strum, Pseq(0.06*[0, 1, 1, 0, 0, 0.5], inf), \freq, Pseq([0, -1, -2, -1, 0, 1, 2, 1].dupEach +.x ~melody, inf) * 308 / 7 ).play; Pbind.new( \instrument, \harp, \delta, Prand(0.7 * [Pseq([1/2], 4), Pseq([1/3], 6), Pseq([1/4], 8)], inf), \legato, inf, \amp, 0.1, \freq, Pseq([1, 2, 1, 4, 1, 2], inf) * 308 / 7 ).play )