( //INIT'S FOLLOWER var pfBuffer, pfAction; var efBuffer, efAction; //INIT FEEDBACK var feedbackBuffer, feedbackDelayTime, feedbackLevel, feedbackMethod; //INIT'S GATE var gateDensity, gateSustain, gateMethod, gateBuffer, gateOverdub; //INIT'S OSCILLATOR var grainDensity, grainPitchOffset, grainPitchRange, grainPitchBase, grainPitchMax, grainBuffer; var stretchFactor, stretchPitchBase, stretchPitchMax, stretchBuffer; var playerVoices, playerPitchOffset, playerPitchRange, playerPitchBase, playerPitchMax, playerBuffer, playerMethod, playerStretchFactor; //INIT'S FILTER var filterVoices, filterFreqOffset, filterFreqBase, filterFreqMax, filterBuffer, filterMethod; var bpfVoices, bpfFreqOffset, bpfFreqBase, bpfFreqMax, bpfBuffer; var psVoices, psPitchOffset, psPitchBase, psPitchMax, psBuffer; var bsStretch, bsShift, bsBuffer; //INIT'S DELAY var delayBuffer, delayVoices, delayMethod, delayDecay; var multitapVoices, multitapDelayOffset, multitapDelayBase, multitapDelayMax, multitapBuffer; var reverbVoices, reverbDelayOffset, reverbDelayBase, reverbDelayMax, reverbDecay, reverbCof, reverbBuffer; //INIT'S FEEDBACK // //INIT'S BUFFERS var sampleBuffer; //INIT'S VARIABLES var maxRecordTime, maxDelayTime, transitionTime; var maxrecordBuffer, maxdelayBuffer, maxoutputBuffer; var maxDelays, maxPlayers, maxGrainDensity, maxBPFs, maxAllpass, maxPS, maxCombs; var maxGateDensity, maxGateSustain, maxPlayerStretch; var delayTimes, frequenCies, delayTime; var numberOfChannels; var window1, rampWave, decayEnv; var efTime, deltaValue, bufferReset; var combFeedback, combAmp, allpassAmp, totalAmp; //INIT'S GUI var w, section; var midiChannel, midiController1, midiController2, audioInputChannel; //TESTING var sin; //PARAMETER VALUES transitionTime= 3.0; maxrecordBuffer= 4; maxRecordTime= [3.0, 2.0, 1.0, 1.0];//record1, record2, delay, feedback maxDelayTime= maxRecordTime.at(3); feedbackLevel= 0.9; numberOfChannels= 2; midiChannel= 1; midiController1= 17;//record-switch midiController2= 65;//section-switch audioInputChannel= 1;//Audio Input kanaal maxDelays= 12; maxBPFs= 12; maxPlayers= 8; maxPS= 4; maxAllpass= 4; maxCombs= 4; maxGrainDensity= 150.0;//50.0 maxGateDensity= 20.0; maxGateSustain= 0.05; maxPlayerStretch= 10.0; efTime= 0.05;//envelope follower attack- en decaytime combFeedback = -0.05; allpassAmp = 3.0; combAmp= 0.1; //INTIALIZE BUFFERS sampleBuffer= Array.fill(maxrecordBuffer, {arg i; Signal.newClear(Synth.sampleRate * (maxRecordTime.at(i)) ) }); //INITIALIZE ENVELOPES/WINDOWS window1=Env.linen(0.1, 0.8, 0.1, 1);//anti-click window rampWave=Signal.newClear(4096); rampWave.waveFill({ arg x,i; x/4096.0}, 0, 4096); decayEnv=Env.perc(0.001, 0.999, 1, -2.7182818); //GUI w=GUIWindow.new("Klep Dicht!", Rect.newBy(100,100,400,400)); section=NumericalView.new(w, Rect.newBy(20,20,80,80), "Section", 0, 0, 54, 1); //midiChannel= NumericalView.new(w, Rect.newBy(20,110,20,20), "", midiChannel, 1, 16, 1); //midiController1=NumericalView.new(w, Rect.newBy(20,140,20,20), "", midiController1, 0, 127, 1); //midiController2=NumericalView.new(w, Rect.newBy(20,170,20,20), "", midiController2, 0, 127, 1); //audioInputChannel=NumericalView.new(w, Rect.newBy(20,200,20,20), "", audioInputChannel, 1, 16, 1); //SERIES delayTimes=[68.38970332 ,30.58480512 ,44.26274578 ,14.67573299 ,25.85919284 ,1.863909976 ,33.44650742 ,8.952328389 ,0.498896162 ,18.9024491 ,21.13358057 ,26.358089 ,1.709742583 ,4.321996802 ,1.805023272 ,15.29240256 ,9.260663174 ,3.419485166 ,2.612254219 ,24.74362711 ,1.614461894 ,5.532843223 ,14.48517161 ,10.75735166 ,27.16531995 ,11.71875 ,8.798160996 ,6.34007417 ,18.40355294 ,16.09963351 ,11.56458261 ,9.759559336 ,9.355943862 ,8.548712915 ,11.06568645 ,11.06568645 ,12.37181355 ,13.83210806 ,26.20392161 ,12.37181355 ,3.82310064 ,16.19491419 ,7.646201279 ,1.306127109 ,3.419485166 ,17.6552087 ,14.73461969 ,7.646201279 ,32.38982839 ,3.82310064 ,36.21292903]; //SERIES SECTIONS // 00 01 02 03 04 05 06 07 08 09 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 pfAction= ([0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 1, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 1, 0, 0, 0, 0, 0, 1, 1, 0, 0, 1, 1, 0, 0, 0, 1, 0, 0, 0, 0, 0, 0, 0, 0, 0]); efAction= ([0, 0, 1, 0, 0, 0, 0, 0, 0, 0, 1, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 1, 0, 0, 0, 0, 1, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 1, 0, 0, 0, 1, 0, 0, 0, 0, 0]); // 00 01 02 03 04 05 06 07 08 09 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 feedbackMethod= ([0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0]); gateOverdub= ([0, 0, 1, 0, 1, 1, 1, 0, 1, 1, 1, 1, 1, 0, 0, 0, 1, 1, 1, 1, 0, 1, 0, 0, 1, 1, 0, 0, 1, 0, 1, 0, 0, 0, 1, 1, 0, 0, 0, 1, 1, 1, 0, 0, 1,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 1, 1, 1, 1, 1, 1, 1, 2, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1]) - 1; playerBuffer= ([1, 1, 1, 1, 3, 2, 2, 1, 1, 1, 2, 2, 1, 1, 1, 1, 1, 1, 1, 2, 2, 1, 1, 2, 1, 1, 2, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 2, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 2, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1]) - 1; delayBuffer= ([3, 3, 3, 2, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3]) - 1; feedbackBuffer= ([4, 4, 4, 4, 4, 4, 4, 4, 4, 4, 4, 4, 4, 4, 4, 4, 4, 4, 4, 4, 4, 4, 4, 4, 4, 4, 4, 4, 4, 4, 4, 4, 4, 4, 4, 4, 4, 4, 4, 4, 4, 4, 4, 4, 4, 4, 4, 4, 4, 4, 4, 4, 4, 4, 4, 4, 4]) - 1; // 00 01 02 03 04 05 06 07 08 09 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 feedbackDelayTime= ([1, 1, 1, 5, 1, 1, 1, 1, 1, 1, 1, 9, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 9, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1]/9.0)*maxDelayTime; gateDensity= ([8, 8, 1, 5, 8, 8, 8, 8, 8, 8, 8, 8, 5, 8, 8, 8, 3, 3, 8, 8, 8, 8, 8, 8, 8,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6, 4, 5]-1*log(2.0)).exp*0.0625 - 0.01; filterFreqMax= ([3, 4, 4, 3, 6, 6, 6, 3, 3, 3, 8, 9, 3, 6, 9, 9, 5, 4, 3, 9, 9, 8, 4, 8, 6, 4, 8, 8, 8, 9, 6, 9, 6, 3, 8, 6, 7, 3, 3, 4, 7, 3, 3, 3, 6, 7, 3, 8, 6, 6, 9, 9, 6, 6, 6, 7]-1*log(2.0)).exp*0.0625 + 0.01; totalAmp= ([3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 1, 9, 9, 7, 7, 7, 4, 4, 1, 1, 2, 3, 6, 9, 9, 9, 3, 3, 9, 3, 3, 3, 3, 3, 3, 3, 4, 3, 3, 9, 9, 3, 3, 5, 3, 3, 1, 3, 9, 3, 3, 3, 3])/3.0; // 00 01 02 03 04 05 06 07 08 09 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 deltaValue= ([1, 1, 1, 1, 2, 1, 1, 2, 1, 1, 1, 1, 1, 2, 1, 1, 1, 1, 1, 3, 1, 1, 1, 1, 1, 1, 1, 2, 1, 2, 1, 3, 1, 1, 1, 4, 1, 1, 1, 2, 1, 5, 1, 2, 1, 1, 2, 1, 1, 1, 1, 1, 1, 1, 1, 1]); bufferReset= ([1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 0, 1, 1, 1, 1, 1, 0, 0, 1, 0, 1, 1, 0, 1, 0, 0, 1, 1, 1, 0, 0, 1, 1, 1, 0, 1, 1, 1, 1, 1, 1, 0, 0, 1, 1, 0, 0, 0, 1, 1, 1, 1, 0, 1, 1]); //transitionTime= ([1, 1, 1, 1, 9, 9, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 2, 1, 1, 2, 1, 2, 1, 2, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1]); section.value=0; Synth.play({ var input, output, feedback, gater, player, filter, delay; var recordTrigger, nextSectionTrigger; var playbackRate; var pitch, amp; recordTrigger=MIDIController.kr(midiChannel.value, midiController1.value); nextSectionTrigger=MIDIController.kr(midiChannel.value, midiController2.value, 0, 1); input=AudioIn.ar(1); pitch=Plug.kr(1000.0); amp=Plug.kr(1.0); // TSpawn.ar({ // section.value=section.value+deltaValue.at(section.value.asInteger); // }, nil, nil, nextSectionTrigger); TrigXFade2.ar({arg tspawn, spawn, eventCount, transitionTime; var sectionValue, pitch, amp, temp; var tempInput, playbackRate, pfAt, efAt, panValues; // TrigXFade2.sc moet wel in de Common folder staan; anders TrigXFade2 vervangen door TrigXFade!!!! // transitionTime=9.0; section.value=section.value+deltaValue.at(section.value.asInteger); sectionValue=section.value.asInteger; // input=AudioIn.ar(audioInputChannel.value); // pitch=Plug.kr(1000.0); // amp=Plug.kr(1.0); pfAt=if (pfAction.at(sectionValue) > 0, {1},{0}); efAt=if (efAction.at(sectionValue) > 0, {1},{0}); //------------------------------------------------------------------------------------------ FOLLOWERS: followMethod: 0=off, 1=normal, 2=inverse // tempInput=if (pfBuffer.at(sectionValue)>0, {PlayBuf.ar(sampleBuffer.at(pfBuffer.at(sectionValue)), Synth.sampleRate, 1.0)}, {input}); tempInput=input; pitch=[{1.0}, { temp=PeakFollower.kr(LPF.ar(tempInput, 1400)); temp * (440.0.reciprocal)}, { temp=PeakFollower.kr(LPF.ar(tempInput, 1400)); (1500.0-temp) * (440.0.reciprocal)} ].at(pfAction.at(sectionValue)).value; // tempInput=if (efBuffer.at(sectionValue)>0, {PlayBuf.ar(sampleBuffer.at(efBuffer.at(sectionValue)), Synth.sampleRate, 1.0)}, {input}); amp=[ {1.0}, { temp=Amplitude.kr(tempInput, efTime, efTime)}, { temp=Amplitude.kr(tempInput, efTime, efTime); if (temp>0.1, 0, 1.0-temp);} ].at(efAction.at(sectionValue)).value; //------------------------------------------------------------------------------------------ FEEDBACK feedback= HPF.ar((LPF.ar( TapN.ar(sampleBuffer.at(feedbackBuffer.at(sectionValue)), feedbackDelayTime.at(sectionValue)) , 10000, feedbackLevel)), 100.0); input=[input, input+feedback].at(feedbackMethod.at(sectionValue)); //------------------------------------------------------------------------------------------ GATERS gateMethod: 0=off, 1=normal, 2=gate, 3=comperator gater=[ //OFF { FSinOsc.ar(100,0)}, //BYPASS { temp=Pause.ar({input}, recordTrigger); temp }, //GATER { var density, sustain, trigger; density=gateDensity.at(sectionValue); sustain=gateSustain.at(sectionValue); temp=Pause.ar({ trigger=Dust.kr(density); EnvGen.ar(window1, input, 0, 1, 0, 0.005+Latch.kr(WhiteNoise.kr(sustain,sustain), trigger), trigger) }, recordTrigger); temp }, //COMPERATOR { var amp1, amp2, gate; temp=Pause.ar({ amp1=Amplitude.kr(input, 0.1, 0.1); amp2=Amplitude.kr(feedback, 0.1, 0.1); gate=Plug.kr(amp1 > amp2, 0.01); (gate*input) + ((1.0-gate)*feedback*0.25) }, recordTrigger); temp }].at(gateMethod.at(sectionValue)).value; if(gateBuffer.at(sectionValue)<9, { RecordBuf.ar( sampleBuffer.at(gateBuffer.at(sectionValue)), gater, 1, gateOverdub.at(sectionValue), 1, recordTrigger, 1)}, {nil}); //------------------------------------------------------------------------------------------ PLAYERS playmethod: 0=off, 1=PlayBuf, 2=Stretch, 3=hit! //, playerPitchOffset, playerPitchRange, playerPitchBase, playerPitchMax, playerBuffer; player=[ //BYPASS { [gater];}, //PLAYBUFFER {// amp*Mix.arFill(playerVoices.at(sectionValue).asInteger, {arg i; // playbackRate=(playerPitchBase.at(sectionValue) + ((playerPitchMax.at(sectionValue)-playerPitchBase.at(sectionValue)).rand))*pitch; // PlayBuf.ar(sampleBuffer.at(playerBuffer.at(sectionValue)), Synth.sampleRate, playbackRate)} ); if ((bufferReset.at(sectionValue) > 0), { sampleBuffer.at(playerBuffer.at(sectionValue)).fill(0)}); amp*Array.fill(playerVoices.at(sectionValue).asInteger, {arg i; playbackRate=(playerPitchBase.at(sectionValue) + ((playerPitchMax.at(sectionValue)-playerPitchBase.at(sectionValue)).rand))*pitch; PlayBuf.ar(sampleBuffer.at(playerBuffer.at(sectionValue)), Synth.sampleRate, playbackRate)} ); }, //TIME STRETCHER { var stretchFactor, pitchOffset, pitchDeviation, deltaTimeOffset, deltaTimeDeviation, durationOffset, durationDeviation, density; var speed, loopLength, stretchInput, ramp, amplitude, tempoutput; if ((bufferReset.at(sectionValue) > 0), { sampleBuffer.at(playerBuffer.at(sectionValue)).fill(0)}); stretchFactor=playerStretchFactor.at(sectionValue); pitchOffset=playerPitchBase.at(sectionValue); //pitchDeviation=playerPitchMax.at(sectionValue); pitchDeviation=0.05; density=maxGrainDensity; durationOffset=0.09; durationDeviation=0.01; amplitude=0.5; stretchInput=sampleBuffer.at(playerBuffer.at(sectionValue)); loopLength=stretchInput.size / Synth.sampleRate; speed= (loopLength.reciprocal)*(stretchFactor.reciprocal); ramp= Osc.kr(rampWave.asWavetable, speed, 0, Synth.sampleRate*loopLength-2, 0); tempoutput=Spawn.ar({arg spawn; var playbackRate, offset, duration, dev; spawn.nextTime=density.reciprocal.rand + density.reciprocal; playbackRate=pitchDeviation.rand + pitchOffset; duration=durationDeviation.rand + durationOffset; offset=ramp.poll; Pan2.ar( //dit kan weg voor mono EnvGen.ar(window1, PlayBuf.ar(stretchInput, Synth.sampleRate, playbackRate, offset), 0, amplitude, 0, duration) , 1.0.rand2)//dit kan ook weg voor mono }, numberOfChannels);//of numberOfChannels //[tempoutput] }, //TRIGGERED PLAYBACK { var signal, duration; duration=playerStretchFactor.at(sectionValue)*3.0;//3.0 gewoon een gokje.... signal=Array.fill(playerVoices.at(sectionValue).asInteger, {arg i; playbackRate=(playerPitchBase.at(sectionValue) + ((playerPitchMax.at(sectionValue)-playerPitchBase.at(sectionValue)).rand)); PlayBuf.ar(sampleBuffer.at(playerBuffer.at(sectionValue)), Synth.sampleRate, playbackRate)} ); EnvGen.ar(decayEnv, signal, 0, 1, 0, duration) } //].at(playerMethod.at(sectionValue)).value + gater; ].at(playerMethod.at(sectionValue)).value; //player.add(gater); //------------------------------------------------------------------------------------------ DELAYS delaymethod: 0=bypass, 1=multitap, 2=allpass delay=[ {//BYPASS player}, {//MULTITAP var tempBuffer, tempdelayTime, temp; tempBuffer=sampleBuffer.at(delayBuffer.at(sectionValue)); tempdelayTime=(tempBuffer.size / Synth.sampleRate)*delayTime.at(sectionValue); //DelayWr.ar(tempBuffer, Mix.ar(player)); DelayWr.ar(tempBuffer, Mix.ar(player)+gater); Array.fill ((delayVoices.at(sectionValue)*maxDelays+0.5).asInteger, {TapN.ar(tempBuffer, tempdelayTime.rand, 1.0.rand)}) }, {//ALLPASS var z, dtMax; dtMax=delayTime.at(sectionValue)*0.10; //z=(Mix.ar(player))*(player.size.reciprocal); z=(Mix.ar(player)+gater)*(player.size.reciprocal); ((delayVoices.at(sectionValue)*maxAllpass+0.5)).do({z=AllpassN.ar(z, 0.15, dtMax.rand+0.05, delayDecay.at(sectionValue))}); [allpassAmp*z]//ampfactor * z, omdat het volume van de galm zachter is!!! } ].at(delayMethod.at(sectionValue)).value; //------------------------------------------------------------------------------------------ FILTERS filtermethod: 0=bypass, 1=bpf, 2=ps, 3=comb filter=[{delay}, {//BANDPASSFILTERS Array.fill((filterVoices.at(sectionValue)*maxBPFs+0.5).asInteger, {arg i; var cf, mod; cf=825.0*(filterFreqBase.at(sectionValue) + ((filterFreqMax.at(sectionValue) - filterFreqBase.at(sectionValue)).rand)); mod=SinOsc.kr(1.0.rand+0.1, 0, cf*0.05, cf); BPF.ar(delay.at(i%delay.size), mod, 0.1) }) }, {//PITCHSHIFTERS Array.fill((filterVoices.at(sectionValue)*maxPS+0.5).asInteger, {arg i; var ps; ps=(filterFreqBase.at(sectionValue) + ((filterFreqMax.at(sectionValue) - filterFreqBase.at(sectionValue)).rand)); PitchShift.ar(delay.at(i%delay.size), 0.07, ps, 0, 0.004.rand+0.002) }) }, {//COMBFILTERS var number, amp; number=(filterVoices.at(sectionValue)*maxCombs+0.5).asInteger; amp=(1.0/number)*0.15; Array.fill(number, {arg i; var cf, mod; cf=(1000.0*(filterFreqBase.at(sectionValue) + ((filterFreqMax.at(sectionValue) - filterFreqBase.at(sectionValue)).rand))).reciprocal; mod=SinOsc.kr(0.3.rand+0.05, 0, cf*0.05, cf); CombN.ar(delay.at(i%delay.size), 0.1, mod, combFeedback, combAmp) }); } ].at(filterMethod.at(sectionValue)).value; //------------------------------------------------------------------------------------------ OUTPUT if (filter.size==1, {panValues=[0]}); if (filter.size==2, {panValues=[-1,1]}); if (filter.size>2, {panValues=Array.fill (filter.size, {1.0.rand2})}); DelayWr.ar(sampleBuffer.at(feedbackBuffer.at(sectionValue)), Mix.ar(filter)); output=Mix.ar(Pan2.ar(filter, panValues)); // totalAmp.at(sectionValue).postln; output*totalAmp.at(sectionValue) //------------------------------------------------------------------------------------------ }, nextSectionTrigger, transitionTime, numberOfChannels); }); w.close; )