Appendix /1 (1) database /1 generalinfo = #[ [[329.628, 0.117, 0.9949, "ex100", 1.1, 1.00221 ],[ 349.228, 0.27, 0.998, "ex0Ol", 1,........,[ 164.814, 0.368, 0.9969, "ex612", 1.0, 1.00039] ] ]; stramps = 0.1*[2.0,1.5,2.0,1.3,2.5,2.2]; GF.resetLoadedSamples; GF.loadSamplesList(samples); nofstrs = 6; /1 (2) main function /I fn = {arg synth; buffers Array.fill(nofstrs, {Signal.new(Synth.sampleRate * 0.02);1); buffers2 = Array.fill(nofstrs, {Signal.new(Synth.sampleRate * 0.02);1); basefreqs = [64, 59, 55, 50, 45, 40].midicps; basedels = 1/basefreqs; /I (3) dynamic controllers: gain, freq, fltcoefscs, frets // getrls Array.fill(nofstrs, {arg ind; MIDIController.kr(ind+1,7,0,1.0,'linear',0.001);}); gains = Array.fill(nofstrs, {arg ind; var curinfo; curinfo = at(at(generalinfo,ind),0); Plug.kr(at(curinfo,2),0.01);}); pitchHigh = Array.fill(nofstrs, {arg ind; MIDIController.kr(ind+1,1,0,127*128,'linear',0.01);}); pitchLow Array.fill(nofstrs, {arg ind; MIDIController.kr(ind+1,2,0,127,'linear',0.01); }); freqs = Array.fill(nofstrs, {arg ind; var curinfo; curinfo = at(at(generalinfo,ind),0); Plug.kr(at(curinfo,0),0.01);}); fcoefs = Array.fill(nofstrs, {arg ind; var curinfo; curinfo = at(at(generalinfo,ind),0); Plug.kr(at(curinfo, 1),0.01);}); fltcoefAndgainscs Array.fill(nofstrs, {arg ind; MIDIController.kr(ind+1,3,0.0,1.0,'linear',0.01); }); frets = Array.fill(nofstrs, {arg ind; MIDIController.kr(ind+1,4,0,127,'linear',0.0); }); /1 (4) pluck events /1 vrfn {arg chan; Voicer.ar( { arg voicer, i, synth, deltaTime, channel, note, velocity; var plckpos, curstring, output, amp, curfret, curinfo, sample, pitchcorr; plckpos = ((note/127)*0.5); amp = ((velocity/127) ** 2); curstring = (channel - 1); curfret = asInteger(value(source (at(frets,curstring)))); curinfo at(at(generalinfo,curstring),curfret); source(at(freqs, curstring)) at(curinfo,0); source(at(fcoefs, curstring)) at(curinfo,1); source(at(gains, curstring)) at(curinfo,2); sample = at(curinfo,3); pitchcorr = at(curinfo,5); output GF.samplelns([sample, 1], pitchcorr, 0, nil)*amp; output = Line.kr(at(stramps,curstring)*at(curinfo,4),0.00 1, max(0.001,if(curstring<4, {0.28*(0.13+(amp*0.05))}, {0.32*(0. 1 8+(amp*0.05))})))* LPF.ar((output- (DelayA.ar(output, 0.05, at(basedels,curstring)*plckpos, if(curstring<4, {0.35}, {0.75})))),(0300+(amp*8000)));, 1,chan, 1); }; excits = [vrfn.value(1), vrfn.value(2), vrfn.value(3), vrfn.value(4), vrfn.value(5), vrfn.value(6)]; /// (5) string models /I matLabPitchSc = 10000; deltimes = 1/(freqs * ((pitchHigh+pitchLow) / matLabPitchSc)); detunes2 [1.0001,1.0001,1.0001,1.00015,1.00018,1.0002]; finalfcoefs = fcoefs* fltcoefAndgainscs; finalgains = gains*gctrls*fltcoefAndgainscs; fltdels OnePole.ar(TapA.ar(buffers, deltimes),finalfcoefs,finalgains); fltdels2 = OnePole.ar(TapA.ar(buffers2, deltimes*detunes2),finalfcoefs,finalgains); feedbl = LPZl.ar(value(matMult, fltdels, feedbMatrix)); DelayWr.ar(buffers, excits+fltdels); DelayWr.ar(buffers2, excits+fltdels2+feedb 1); Mix.ar(Pan2.ar(Mix.ar([fltdels,fltdels2]),2* [ -0.07, -0.05, -0.02, 0.0, 0.02, 0.04 ],2)); Synth.play( {arg synth; synth.blockSize 56; value(fn, synth)});
Top of page Top of page