( var w, winClose, in1LevSlider, in1Lev, out1LevSlider, out2LevSlider,out3LevSlider, out1Lev, out2Lev; var in1LevSlider2, in1Lev2, out1LevSlider2, out2LevSlider2,out3LevSlider2, out1Lev2, out2Lev2; var inputLevel, granLevel, splayLevel, chopLevel; var inputLevel2, granLevel2, splayLevel2, chopLevel2; var timer, dur; var pitch, pitchDisp, timeDisp, overlap, grainDur, pit, pD, tD, ol, gD; var pitch2, pitchDisp2, timeDisp2, overlap2, grainDur2,pit2, pD2, tD2, ol2, gD2; var wR, cR, rArray; var granBut, playBut, chopBut; var granBut2, playBut2, chopBut2; var spawnGroup, chopGroup; var sampleSections, startSample=0, stopSample=0, recordRoutine, inLevel=0, recTrigValue=0; var loopAdd=0, chopRepeats=0; var playSpawn, chopSpawn, granSpawn; var playSpawn2, chopSpawn2, granSpawn2; var spawnGroup2, chopGroup2; var sampleSections2, startSample2=0, stopSample2=0, recordRoutine2, inLevel2=0, recTrigValue2=0; var loopAdd2=0, chopRepeats2=0; var lev1, levBus, granLev, granBus,lev2, levBus2, granLev2, granBus2; var bClear, cClear, sampList1Clear, sampList2Clear; var stretcher, stretchBut, stretchGroup; var loopAddS=0, chopRepeatsS=0, bufSize, rateNoise; var loopNum, repeatNum, travelNum; var loop, loopSlider, repeats, repeatSlider, travel, travelSlider; var levS, levSliderS, levNumS, levBusS; var overlapS, olSlider, olNum; var wS, panRangeSlider, panLow, panHigh, pLo, pHi, rateMenu, stretchRate; var echoBuf, echoBut, echoStretch; // Synthdefs SynthDef("inputs1", { arg inSliderLevel=1; var violin, lMicIn, mix, in; violin = AudioIn.ar(1); //in = Compander.ar(violin,violin, 0.1, 1, 0.5, 0.01, 0.01)*inSliderLevel; in = violin * inSliderLevel; Out.ar(100, in); }).load(s); SynthDef("inputs2", { arg inSliderLevel=1; var micIn, in; micIn = AudioIn.ar(2); //in = Compander.ar(micIn,micIn, 0.1, 1, 0.5, 0.01, 0.01)*inSliderLevel; in = micIn * inSliderLevel; Out.ar(101, in); }).load(s); SynthDef("SampleRecorder1",{ arg inBus, bufnum=0, recRun = 0, recTrig=0; var input; input = In.ar(inBus); RecordBuf.ar(input, bufnum, run: recRun, trigger: recTrig); }).load(s); SynthDef("PanSpawn", { arg panPos=0, gate = 1, rate = 1, bufnum = 0, chan=0,startPos=0.0, time=1.0, envLev=1.0, loopLength=1, outBus=0, revBus=1000; var out,eg, triggerer; triggerer = Impulse.kr(loopLength.reciprocal); eg = EnvGen.kr(Env.new([0,1,1,0],[0.1,0.8,0.1], 'sine'), gate, timeScale: time*1.5, levelScale: 1, doneAction: 2); out = Pan2.ar( PlayBuf.ar(1, bufnum, rate, triggerer, startPos, loop: 1), panPos); Out.ar(outBus, out*eg*envLev); Out.ar(revBus, out*eg*envLev); }).load(s); SynthDef("chop", { arg gate = 1, rate = 1, bufnum = 0,chan=0, startPos=0.0, time=1.0, envLev=1.0, panPos=0.0, loopLength=1, trig=1, outBus=0, revBus=1000; var out,eg, triggerer; triggerer = Impulse.kr(BufSampleRate.kr(bufnum)/loopLength); eg = EnvGen.kr(Env.new([0,1,1,0],[0.1,0.8,0.1]), gate, timeScale: time*1.1, levelScale: 1, doneAction: 2); out = Pan2.ar(PlayBuf.ar(1, bufnum, rate, triggerer, startPos, loop: 1), panPos); Out.ar(outBus, out*eg*envLev); Out.ar(revBus, out*eg*envLev); }).load(s); SynthDef("gran", { arg bufnum=0, rate=1, offset=0, level=1, panPos=0, envLength = 0.1, outBus=0, revBus=1000; var granulated, env; granulated= Pan2.ar(PlayBuf.ar(1, bufnum, rate*Rand(0.95,1.05)*BufRateScale.kr(bufnum), 1, (offset+Rand(-0.05,0.05))*BufSamples.kr(bufnum),1),panPos); env= EnvGen.kr(Env.new([0, 1, 0], [0.5,0.5], 'welch'), 1, timeScale: envLength, doneAction: 2); Out.ar(outBus,(granulated*env*level)*2); Out.ar(revBus,(granulated*env*level)*2); }).load(s); SynthDef("stretch", { arg gate = 1, rate = 1, bufnum = 0, startPos=0.0, time=1.0, envLev=0.0, panPos=0.0, loopLength=1, trig=1; var out,eg, triggerer; triggerer = Impulse.kr(BufSampleRate.kr(bufnum)/loopLength); eg = EnvGen.kr(Env.linen(0.1,0.2,0.1, 1,'welch'), gate, timeScale: time, levelScale: envLev, doneAction: 2); out = Pan2.ar(PlayBuf.ar(1, bufnum, rate, triggerer, BufFrames.ir(bufnum)*startPos, loop: 1), panPos); Out.ar(0, out*eg); Out.ar(1000, out*eg); }).load(s); SynthDef("echoStretch", {arg out = 0, bufnum=1001, inBus=1000, level=0, delay=0.5, decay=1, panTime=1.0, panDepth=0.1; var rev, input, output, delTime; input = In.ar(inBus); output = Pan2.ar(BufAllpassL.ar(bufnum, input, delay, decay, 0.8), LFNoise2.kr(panTime, panDepth)); Out.ar(out,output * level); }).load(s); SynthDef("noises", { arg trigRate=2; SendTrig.kr(Impulse.kr(trigRate),0, LFNoise1.kr(10, 4410, 4420)); SendTrig.kr(Impulse.kr(trigRate),1, LFNoise0.kr(100, 16,17)); }).load(s); SynthDef("level1", { arg inBus=100; SendTrig.kr(Impulse.kr(100),2,Amplitude.kr(In.ar(inBus),0.2,0.2)); }).load(s); SynthDef("level2", { arg inBus=101; SendTrig.kr(Impulse.kr(100),3,Amplitude.kr(In.ar(inBus),0.2,0.2)); }).load(s); SynthDef("noises2", { arg trigRate=2; SendTrig.kr(Impulse.kr(trigRate),4, LFNoise1.kr(10, 4410, 4420)); SendTrig.kr(Impulse.kr(trigRate),5, LFNoise0.kr(10, 160,170)); }).load(s); s=Server.local; b = Buffer.alloc(s,44100 * 10.0,1); c = Buffer.alloc(s,44100 * 10.0,1); sampleSections = List[]; sampleSections2 = List[]; spawnGroup = Group.new; chopGroup = Group.new; spawnGroup2 = Group.new; chopGroup2 = Group.new; bufSize = BufSamples.ir(b.bufnum); stretchGroup= Group.new; stretchRate =[1]; Tempo.bpm = 100; echoBuf = Buffer.alloc(s,44100*1.0,1); // stretcher controls loopNum = ControlSpec(2,50,\linear,1); repeatNum = ControlSpec(2,250,\linear,1); travelNum = ControlSpec(0.00001,0.01,\exponential,0.00001); olNum = ControlSpec(0.2,4,\linear,0.01); levNumS = ControlSpec(0,1,\linear,0.001); levBusS = Bus.new(\control,10,1,s); levBusS.value=0.0; // mangler controls //MIDIIn.connect; lev1=[ControlSpec(0,1,\linear,0.001), ControlSpec(0,1,\linear,0.001), ControlSpec(0,1,\linear,0.001), ControlSpec(0,1,\linear,0.001)]; levBus = [Bus.new(\control,1,1,s), Bus.new(\control,2,1,s), Bus.new(\control,3,1,s), Bus.new(\control,4,1,s)]; (levBus@0).value = 0.8; (levBus@1).value = 0.8; (levBus@2).value = 0.8; (levBus@3).value = 0.8; granLev=[ControlSpec(-2.0,2.0,\linear,0.001), //pitch ControlSpec(0,4,\linear,0.001), //pitch displacement ControlSpec(0,1,\linear,0.001), //time displacement ControlSpec(0,8,\linear,0.1), //overlap ControlSpec(0.1,2,\linear,0.01)]; //grain duration granBus = [Bus.new(\control,12,1,s), Bus.new(\control,13,1,s), Bus.new(\control,14,1,s), Bus.new(\control,15,1,s), Bus.new(\control,16,1,s) ]; (granBus@0).value = 1.0; (granBus@1).value = 0.0; (granBus@2).value = 0.0; (granBus@3).value = 1.5; (granBus@4).value = 0.25; lev2=[ControlSpec(0,1,\linear,0.001), ControlSpec(0,1,\linear,0.001), ControlSpec(0,1,\linear,0.001), ControlSpec(0,1,\linear,0.001)]; levBus2 = [Bus.new(\control,5,1,s), Bus.new(\control,6,1,s), Bus.new(\control,7,1,s), Bus.new(\control,8,1,s)]; (levBus2@0).value = 0.8; (levBus2@1).value = 0.8; (levBus2@2).value = 0.8; (levBus2@3).value = 0.8; granLev2=[ControlSpec(-2.0,2.0,\linear,0.001), //pitch ControlSpec(0,4,\linear,0.001), //pitch displacement ControlSpec(0,1,\linear,0.001), //time displacement ControlSpec(0,8,\linear,0.1), //overlap ControlSpec(0.1,2,\linear,0.01)]; //grain duration granBus2 = [Bus.new(\control,17,1,s), Bus.new(\control,18,1,s), Bus.new(\control,19,1,s), Bus.new(\control,20,1,s), Bus.new(\control,21,1,s) ]; (granBus2@0).value = 1.0; (granBus2@1).value = 0.0; (granBus2@2).value = 0.0; (granBus2@3).value = 1.5; (granBus2@4).value = 0.25; k=Synth("noises"); j=Synth("noises2"); z=Synth("inputs1",[\outBus, 100]).play; y=Synth("inputs2",[\outBus, 101]).play; x=Synth.after(z,"SampleRecorder1", [\inBus, 100, \bufnum, b.bufnum]).play; u=Synth.after(y,"SampleRecorder1", [\inBus, 101, \bufnum, c.bufnum]).play; Synth.after(x,"level1", [\inbus, 100]).play; Synth.after(u,"level2", [\inBus, 101]).play; OSCresponder(s.addr,'/tr',{ arg time, responder, msg; if(msg.at(2) == 5, {chopRepeats2 = msg.at(3)}); if(msg.at(2) == 4, {loopAdd2 = msg.at(3)}); if(msg.at(2) == 3, {inLevel2 = msg.at(3)}); if(msg.at(2) == 2, {inLevel = msg.at(3)}); if(msg.at(2) == 1, {chopRepeats = msg.at(3)}); if(msg.at(2) == 0, {loopAdd = msg.at(3)}); }).add; // routines timer = TempoClock(110/60); dur = timer.beatDur; recordRoutine= Routine({ var clock=0, threshold=0.02; x.set("recTrig", 1); loop({ z.map("inSliderLevel", 1); if ( recTrigValue == 1,{ clock = clock+0.1 }); if ( (inLevel > threshold) & recTrigValue==0, { recTrigValue=1; x.set("recRun", 1); // start recording startSample = (clock.poll*44.1e3)%(44.1e3*60.0); }, { if ( (inLevel < threshold) & recTrigValue==1, { recTrigValue=0; x.set("recRun", 0); // stop recording stopSample = (clock*44.1e3)%(44.1e3*60.0); sampleSections.add([startSample,stopSample]); }) }); 0.1.wait; }); }); recordRoutine.reset; recordRoutine.play; playSpawn=Routine({ var which, end, offset=0, loopDur,rate=1, nextTime; // OSCSched.global.tdeltaTillNext(4.0).wait; loop({ which = sampleSections.choose; // choose a buffer at random if (which.notNil,{ offset = which.at(0); end = (which.at(1)) },{ offset = 0; end = 0; } ); //which.postln; //rate = [-0.5, 0.875, -1.0, 1.2, -1.75, 2.0].choose; rArray.postln; rate = rArray.choose; loopDur=(end-offset/44.1e3)*(rate.abs.reciprocal); //loopDur.postln; nextTime =[1.4444, 2.8888, 5.7776 ].choose; Synth("PanSpawn",[ \gate, 1, \bufnum, b.bufnum, \time, nextTime, \startPos, offset, \rate, rate, \loopLength, loopDur, \panPos, 1.0.rand2, //(1.0.rand)-1 ],spawnGroup, \addToHead).map(\envLev,3); nextTime.wait; spawnGroup.set("gate", 0); [0,nextTime, nextTime*2].choose.wait; //won't immediately retrigger }); }); chopSpawn=Routine({ var which, end, choploopStart, choploopEnd, offset=0, chopDur, nextTime; // OSCSched.global.tdeltaTillNext(4.0).wait; loop({ which = sampleSections.choose; // choose a buffer at random if (which.notNil,{ offset = which.at(0); end = (which.at(1)) },{ offset = 0; end = 0; } ); choploopStart = offset; choploopEnd = offset+loopAdd; chopDur = (choploopEnd - offset)/44.1e3 * (chopRepeats); //loopAdd= loopAdd/44.1e3; //chopDur=loopAdd * chopRepeats; nextTime= chopDur.max(0.02); which.postln; //[loopAdd/44.1e3,chopRepeats, nextTime].postln; k.set("trigRate",nextTime.reciprocal); Synth("chop", [\gate, 1, \bufnum, b.bufnum, \time, nextTime, \startPos, offset, \rate, [0.5, 0.6, 0.5, 0.6,0.5, 0.45, 0.4, 0.75].choose, \loopLength, loopAdd, //choploopEnd-choploopStart, \panPos, 1.0.rand2 ],chopGroup, \addToHead).map(\envLev,4); nextTime.wait; chopGroup.set("gate",0); }); }); granSpawn=Routine({ var which, end,loopStart, loopEnd, offset=0, chopDur, nextTime=0.02, envTime, granLoop; // OSCSched.global.tdeltaTillNext(4.0).wait; loop({ envTime = [dur*4, dur*8].choose; //granLoop = (envTime/nextTime).roundUp; which = sampleSections.choose; // choose a buffer at random if (which.notNil,{ offset = which.at(0); end = (which.at(1)) },{ offset = 0; end = 0; } ); loop({ nextTime = (gD.poll*2)*dur; loopEnd=end*(tD.poll.rand); loopStart = offset+loopEnd; Synth("gran",[ \bufnum, b.bufnum, \rate, pit.poll+((pD.poll).rand2), \offset, loopStart.asInteger, \envLength, ((ol.poll)*nextTime), \outBus, 0, \panPos, 1.0.rand2]).map(\level, 2); nextTime.wait; }); envTime.wait; }); }); recordRoutine2= Routine({ var clock=0, threshold=0.02; u.set("recTrig", 1); loop({ y.map("inSliderLevel", 5); if ( recTrigValue2 == 1,{ clock = clock+0.1 }); if ( (inLevel2 > threshold) & recTrigValue2==0, { recTrigValue2=1; u.set("recRun", 1); // start recording startSample2 = (clock.poll*44.1e3)%(44.1e3*60.0); }, { if ( (inLevel2 < threshold) & recTrigValue2==1, { recTrigValue2=0; u.set("recRun", 0); // stop recording stopSample2 = (clock*44.1e3)%(44.1e3*60.0); sampleSections2.add([startSample2,stopSample2]); }) }); 0.1.wait; }); }); recordRoutine2.reset; recordRoutine2.play; Routine({ loop({ [sampleSections,sampleSections2].postln; [inLevel,inLevel2].postln; 10.0.wait; }); }).play; /* Routine({ loop({ [((sampleSections.at(1))-(sampleSections.at(0)))/44.1e3, ((sampleSections2.at(1))-(sampleSections2.at(0)))/44.1e3].postln; 10.0.wait; }); }).play; Routine({ loop({ if ((sampleSections@0 && sampleSections@1 && sampleSections2@0 && sampleSections2@1).notNil, { [sampleSections.at(1),sampleSections.at(0), sampleSections2.at(1),sampleSections2.at(0)].postln; }); 10.0.wait; }); }).play; */ playSpawn2=Routine({ var which, end, offset=0, loopDur, rate=1, nextTime; // OSCSched.global.tdeltaTillNext(4.0).wait; loop({ which = sampleSections2.choose; if (which.notNil,{ offset = which.at(0); end = (which.at(1)) },{ offset = 0; end = 0; } ); //which.postln; //rate = [-0.5, 0.875, -1.0, 1.2, -1.75, 2.0].choose; //rArray.postln; rate = rArray.choose; loopDur=(end-offset/44.1e3)*(rate.abs.reciprocal); //loopDur.postln; nextTime =[1.4444, 2.8888, 5.7776].choose; Synth("PanSpawn",[ \gate, 1, \bufnum, c.bufnum, \time, nextTime, \startPos, offset, \rate, rate, \loopLength, loopDur, \panPos, 1.0.rand2 ],spawnGroup2, \addToHead).map(\envLev,7); nextTime.wait; spawnGroup2.set("gate", 0); [0,nextTime, nextTime*2].choose.wait; }); }); chopSpawn2=Routine({ var which, end, choploopStart, choploopEnd, offset=0, chopDur=1, nextTime; // OSCSched.global.tdeltaTillNext(4.0).wait; loop({ which = sampleSections2.choose; // choose a buffer at random if (which.notNil,{ offset = which.at(0); end = (which.at(1)) },{ offset = 0; end = 0; } ); //offset = offset+100; //(offset + (chopDur*0.7))%(12.0*44.1e3); choploopStart = offset; choploopEnd = offset+loopAdd2; chopDur = (choploopEnd - offset)/44.1e3 * (chopRepeats2); //loopAdd= loopAdd/44.1e3; //chopDur=loopAdd * chopRepeats; nextTime= chopDur.max(0.02).round(dur*0.25); //which.postln; //[loopAdd/44.1e3,chopRepeats, nextTime].postln; j.set("trigRate",nextTime.reciprocal); Synth("chop", [\gate, 1, \bufnum, c.bufnum, \time, nextTime, \startPos, offset, \rate, [0.5, 0.6, 0.5, 0.6,0.5, 0.45, 0.4, 0.75].choose, \loopLength, loopAdd2, //choploopEnd-choploopStart, \panPos, 1.0.rand2 ],chopGroup2, \addToHead).map(\envLev,8); nextTime.wait; chopGroup2.set("gate",0); }); }); granSpawn2=Routine({ var which, end,loopStart, loopEnd, offset=0, chopDur, nextTime=0.02, envTime, granLoop; // OSCSched.global.tdeltaTillNext(4.0).wait; loop({ envTime = [dur*4, dur*8, dur*2].choose; //granLoop = (envTime/nextTime).roundUp; which = sampleSections2.choose; // choose a buffer at random if (which.notNil,{ offset = which.at(0); end = (which.at(1)) },{ offset = 0; end = 0; } ); loop({ nextTime = (gD2.poll*2)*dur; loopEnd=end*(tD2.poll.rand); loopStart = offset+loopEnd; Synth("gran",[ \bufnum, c.bufnum, \rate, pit2.poll+((pD2.poll).rand2), \offset, loopStart.asInteger, \envLength, ((ol2.poll)*nextTime), \panPos, 1.0.rand2 ]).map(\level, 6); nextTime.wait; }); envTime.wait; }); }); stretcher=Routine({ var which, offset=0, chopDur, nextTime; // OSCSched.global.tdeltaTillNext(4.0).wait; /* //for recorded buffer chopped into array bits which = soundArray.choose; // choose a buffer at random if (which.notNil,{ offset = which.at(0); end = (which.at(1)) },{ offset = 0; end = 0; } ); */ offset =0.0; //offset=b.size.rand; loop({ //choploopStart = offset; //choploopEnd = offset+loopAddS; //chopDur = (choploopEnd - offset)/44.1e3 * (chopRepeatsS); /* chopRepeatsS = rrand(50,150); loopAddS= rrand(10,25); */ chopRepeatsS=(repeats.poll.value + ((repeats.poll.value)*0.1.rand2)).asInteger; loopAddS = (loop.poll.value + ((loop.poll.value)*0.1.rand2)).asInteger; chopDur=(loopAddS.value * chopRepeatsS.value)/44.1e3; nextTime= chopDur.max(0.02); //[loopAddS,chopRepeatsS,chopDur, nextTime, offset].postln; //[pLo.value, pHi.value].postln; k.set("trigRate",loopAddS.reciprocal); Synth("stretch", [ \gate, 1, \bufnum, b.bufnum, \time, nextTime*overlapS.poll, \startPos, offset, \rate, stretchRate.choose, //rateNoise, \loopLength, loopAddS, \panPos, rrand(pLo.value, pHi.value), ],stretchGroup, \addToHead).map(\envLev,10); nextTime.wait; offset = (offset + travel.poll+ ((travel.poll)*0.1.rand2))%1.0; stretchGroup.set("gate",0); }); }); echoStretch = Synth.tail(stretchGroup, "echoStretch", [ \bufnum, echoBuf.bufnum, \delay, 0.2, \decay,0.8, \panTime, 1, \panDepth, pHi.value, \out, 0]).map(\level,10).run(false); // windows w = SCWindow("SampleSpawn", Rect(35, 380, 940, 387)).front; w.view.background = HiliteGradient(Color.new255(50, 60, 40), Color.new255(138, 43, 226), \v, 128, 0.33); granBut = SCButton(w, Rect(130, 23, 100, 20 )) .states_([ ["Start Gran", Color.black, Color.new255(34, 189, 34)], ["Stop Gran", Color.white, Color.new255(205, 38, 38)] ]) .action = { if (granBut.value == 1, { granSpawn.reset; SystemClock.play(granSpawn); }, { granSpawn.stop; }); }; granBut.setProperty(\font, Font("Trixie-Plain", 15)); playBut = SCButton(w, Rect(230, 23, 100, 20)) .states_([ ["Start Spawn", Color.black, Color.new255(34, 189, 34)], ["Stop Spawn", Color.white, Color.new255(205, 38, 38)] ]) .action = { if (playBut.value == 1, { playSpawn.reset; SystemClock.play(playSpawn); }, { playSpawn.stop; spawnGroup.set("gate", 0); }); }; playBut.setProperty(\font, Font("Trixie-Plain", 15)); chopBut = SCButton(w, Rect(330, 23, 100, 20)) .states_([ ["Start Chop", Color.black, Color.new255(34, 189, 34)], ["Stop Chop", Color.white, Color.new255(205, 38, 38)] ]).action = { if (chopBut.value == 1, { chopSpawn.reset; SystemClock.play(chopSpawn); }, { chopSpawn.stop; chopGroup.set("gate",0); }); }; chopBut.setProperty(\font, Font("Trixie-Plain", 15)); inputLevel = SCNumberBox(w, Rect(45, 212, 50, 18)); inputLevel.setProperty(\align,\center); inputLevel.setProperty(\background, HiliteGradient(Color.new255(60, 60, 0), Color.white, \v, 128, 0.3);); inputLevel.setProperty(\font, Font("Trixie-Plain", 14)); inputLevel.action = {in1LevSlider.value_((lev1@0).unmap(inputLevel.value)); (levBus@0).value = inputLevel.value}; in1LevSlider = SCSlider(w, Rect( 45, 50, 50,160)); in1LevSlider.value_((lev1@0).unmap(0.8)); in1LevSlider.setProperty(\background, HiliteGradient(Color.black,Color.new255(60, 60, 0), \h, 128, 0.3);); in1LevSlider.action = {(levBus@0).value = (lev1@0).map(in1LevSlider.value); inputLevel.value_(((lev1@0).map(in1LevSlider.value))); }; inputLevel.value_(((lev1@0).map(in1LevSlider.value))); SCStaticText( w, Rect(45, 232, 50, 18)).string_("Input").align_(\center).setProperty(\font, Font("Trixie-Plain", 15), \background, HiliteGradient(Color.new255(139, 117, 0),Color.new255(200, 200, 255), \v, 128, 0.3)); granLevel = SCNumberBox(w, Rect(160, 212, 40, 18)); granLevel.setProperty(\align,\center); granLevel.setProperty(\background, HiliteGradient(Color.new255(60, 60, 0), Color.white, \v, 128, 0.3);); granLevel.setProperty(\font, Font("Trixie-Plain", 14)); granLevel.action = {out1LevSlider.value_((lev1@1).unmap(granLevel.value)); (levBus@1).value = granLevel.value}; out1LevSlider = SCSlider(w, Rect(160, 50, 40, 160)); out1LevSlider.value_((lev1@1).unmap(0.8)); out1LevSlider.setProperty(\background, HiliteGradient(Color.black,Color.new255(60, 60, 0), \h, 128, 0.3);); out1LevSlider.action = {(levBus@1).value = (lev1@1).map(out1LevSlider.value); granLevel.value_((lev1@1).map(out1LevSlider.value)); }; granLevel.value_((lev1@1).map(out1LevSlider.value)); SCStaticText( w, Rect(160, 232, 40, 18)).string_("Gran").align_(\center).setProperty(\font, Font("Trixie-Plain", 15),\background, HiliteGradient(Color.new255(139, 117, 0),Color.new255(200, 200, 255), \v, 128, 0.3)); // splayLevel = SCNumberBox(w, Rect(260, 212, 40, 18)); splayLevel.setProperty(\align,\center); splayLevel.setProperty(\background, HiliteGradient(Color.new255(60, 60, 0), Color.white, \v, 128, 0.3);); splayLevel.setProperty(\font, Font("Trixie-Plain", 14)); splayLevel.action = {out2LevSlider.value_((lev1@2).unmap(splayLevel.value)); (levBus@2).value = splayLevel.value}; out2LevSlider = SCSlider(w, Rect(260, 50, 40, 160)); out2LevSlider.value_((lev1@2).unmap(0.8)); out2LevSlider.setProperty(\background, HiliteGradient(Color.black,Color.new255(60, 60, 0), \h, 128, 0.3);); out2LevSlider.action = {(levBus@2).value = (lev1@2).map(out2LevSlider.value); splayLevel.value_(((lev1@2).map(out2LevSlider.value))); }; splayLevel.value_(((lev1@2).map(out2LevSlider.value))); SCStaticText( w, Rect(255, 232, 50, 18)).string_("Spawn").align_(\center).setProperty(\font, Font("Trixie-Plain", 15), \background, HiliteGradient(Color.new255(139, 117, 0),Color.new255(200, 200, 255), \v, 128, 0.3)); chopLevel = SCNumberBox(w, Rect(360, 212, 40, 18)); chopLevel.setProperty(\align,\center); chopLevel.setProperty(\background, HiliteGradient(Color.new255(60, 60, 0), Color.white, \v, 128, 0.3);); chopLevel.setProperty(\font, Font("Trixie-Plain", 14)); chopLevel.action = {out3LevSlider.value_((lev1@3).unmap(chopLevel.value)); (levBus@3).value = chopLevel.value}; out3LevSlider = SCSlider(w, Rect(360, 50, 40, 160)); out3LevSlider.value_((lev1@3).unmap(0.8)); out3LevSlider.setProperty(\background, HiliteGradient(Color.black,Color.new255(60, 60, 0), \h, 128, 0.3);); out3LevSlider.action = {(levBus@3).value = (lev1@3).map(out3LevSlider.value); chopLevel.value_(((lev1@3).map(out3LevSlider.value))); }; chopLevel.value_(((lev1@3).map(out3LevSlider.value))); SCStaticText( w, Rect(360, 232, 40, 18)).string_("Chop").align_(\center).setProperty(\font, Font("Trixie-Plain", 15), \background, HiliteGradient(Color.new255(139, 117, 0),Color.new255(200, 200, 255), \v, 128, 0.3)); // pit = SCNumberBox(w, Rect(190, 269, 50, 20)); pit.setProperty(\align,\center); pit.setProperty(\background, HiliteGradient(Color.new255(60, 60, 0), Color.white, \v, 128, 0.3);); pit.setProperty(\font, Font("Trixie-Plain", 12)); pit.action = {pitch.value_((granLev@0).unmap(pit.value)); (granBus@0).value = pit.value}; pitch = SCSlider(w, Rect(37, 269, 150, 20)); pitch.value_((granLev@0).unmap(1.0)); pitch.setProperty(\background, HiliteGradient(Color.black,Color.new255(60, 60, 0), \v, 128, 0.3);); pitch.action = {(granBus@0).value = (granLev@0).map(pitch.value); pit.value_(((granLev@0).map(pitch.value))); }; pit.value_(((granLev@0).map(pitch.value))); pD = SCNumberBox(w, Rect(190, 293, 50, 20)); pD.setProperty(\align,\center); pD.setProperty(\background, HiliteGradient(Color.new255(60, 60, 0), Color.white, \v, 128, 0.3);); pD.setProperty(\font, Font("Trixie-Plain", 12)); pD.action = {pitchDisp.value_((granLev@1).unmap(pD.value)); (granBus@1).value = pD.value}; pitchDisp = SCSlider(w, Rect(37, 293, 150,20)); pitchDisp.value_((granLev@1).unmap(0.0)); pitchDisp.setProperty(\background, HiliteGradient(Color.black,Color.new255(60, 60, 0), \v, 128, 0.3);); pitchDisp.action = {(granBus@1).value = (granLev@1).map(pitchDisp.value); pD.value_(((granLev@1).map(pitchDisp.value))); }; pD.value_(((granLev@1).map(pitchDisp.value))); tD = SCNumberBox(w, Rect(190, 317, 50, 20)); tD.setProperty(\align,\center); tD.setProperty(\background, HiliteGradient(Color.new255(60, 60, 0), Color.white, \v, 128, 0.3);); tD.setProperty(\font, Font("Trixie-Plain", 12)); tD.action = {timeDisp.value_((granLev@2).unmap(tD.value)); (granBus@2).value = tD.value}; timeDisp = SCSlider(w, Rect(37, 317, 150, 20)); timeDisp.value_((granLev@0).unmap(0.0)); timeDisp.setProperty(\background, HiliteGradient(Color.black,Color.new255(60, 60, 0), \v, 128, 0.3);); timeDisp.action = {(granBus@2).value = (granLev@2).map(timeDisp.value); tD.value_(((granLev@2).map(timeDisp.value))); }; tD.value_(((granLev@2).map(timeDisp.value))); ol = SCNumberBox(w, Rect(190, 341, 50, 20)); ol.setProperty(\align,\center); ol.setProperty(\background, HiliteGradient(Color.new255(60, 60, 0), Color.white, \v, 128, 0.3);); ol.setProperty(\font, Font("Trixie-Plain", 12)); ol.action = {overlap.value_((granLev@3).unmap(ol.value)); (granBus@3).value = ol.value}; overlap = SCSlider(w, Rect(37, 341, 150, 20)); overlap.value_((granLev@3).unmap(1.5)); overlap.setProperty(\background, HiliteGradient(Color.black,Color.new255(60, 60, 0), \v, 128, 0.3);); overlap.action = {(granBus@3).value = (granLev@3).map(overlap.value); ol.value_(((granLev@3).map(overlap.value))); }; ol.value_(((granLev@3).map(overlap.value))); gD = SCNumberBox(w, Rect(398, 269, 50, 20)); gD.setProperty(\align,\center); gD.setProperty(\background, HiliteGradient(Color.new255(60, 60, 0), Color.white, \v, 128, 0.3);); gD.setProperty(\font, Font("Trixie-Plain", 12)); gD.action = {grainDur.value_((granLev@4).unmap(gD.value)); (granBus@4).value = gD.value}; grainDur = SCSlider(w, Rect(300, 269, 96, 20)); grainDur.value_((granLev@0).unmap(0.25)); grainDur.setProperty(\background, HiliteGradient(Color.black,Color.new255(60, 60, 0), \v, 128, 0.3);); grainDur.action = {(granBus@4).value = (granLev@4).map(grainDur.value); gD.value_(((granLev@4).map(grainDur.value))); }; gD.value_(((granLev@4).map(grainDur.value)).round(0.01)); SCStaticText( w, Rect(242, 269, 50, 20)).string_("pitch").align_(\left).setProperty(\font, Font("Trixie-Plain", 13)); SCStaticText( w, Rect(242, 293, 70, 20)).string_("pitch Disp").align_(\left).setProperty(\font, Font("Trixie-Plain", 13)); SCStaticText( w, Rect(242, 317, 70, 20)).string_("time Disp").align_(\left).setProperty(\font, Font("Trixie-Plain", 13)); SCStaticText( w, Rect(242, 341, 50, 20)).string_("overlap").align_(\left).setProperty(\font, Font("Trixie-Plain", 13)); SCStaticText( w, Rect(320, 293, 110, 20)).string_("grain duration").align_(\center).setProperty(\font, Font("Trixie-Plain", 13)); bClear = SCButton(w, Rect(310, 323, 70, 20)) .states_([ ["Clear Buf", Color.black, Color.rand], ["Clear Buf", Color.white, Color.rand] ]).action = {b.zero}; bClear.setProperty(\font, Font("Trixie-Plain", 11)); sampList1Clear = SCButton(w, Rect(382, 323, 70, 20)) .states_([ ["Clear List", Color.black, Color.rand], ["Clear List", Color.white, Color.rand] ]).action = {sampleSections.clear}; sampList1Clear.setProperty(\font, Font("Trixie-Plain", 11)); //window 2 granBut2 = SCButton(w, Rect(595, 23, 100, 20 )) .states_([ ["Start Gran2", Color.black, Color.new255(34, 189, 34)], ["Stop Gran 2", Color.white, Color.new255(205, 38, 38)] ]) .action = { if (granBut2.value == 1, { granSpawn2.reset; SystemClock.play(granSpawn2); }, { granSpawn2.stop; }); }; granBut2.setProperty(\font, Font("Trixie-Plain", 15)); playBut2 = SCButton(w, Rect(695, 23, 100, 20)) .states_([ ["Start Spawn2", Color.black, Color.new255(34, 189, 34)], ["Stop Spawn 2", Color.white, Color.new255(205, 38, 38)] ]) .action = { if (playBut2.value == 1, { playSpawn2.reset; SystemClock.play(playSpawn2); }, { playSpawn2.stop; spawnGroup2.set("gate", 0); }); }; playBut2.setProperty(\font, Font("Trixie-Plain", 15)); chopBut2 = SCButton(w, Rect(795, 23, 100, 20)) .states_([ ["Start Chop2", Color.black, Color.new255(34, 189, 34)], ["Stop Chop 2", Color.white, Color.new255(205, 38, 38)] ]).action = { if (chopBut2.value == 1, { chopSpawn2.reset; SystemClock.play(chopSpawn2); }, { chopSpawn2.stop; chopGroup2.set("gate",0); }); }; chopBut2.setProperty(\font, Font("Trixie-Plain", 15)); inputLevel2 = SCNumberBox(w, Rect(500, 212, 50, 18)); inputLevel2.setProperty(\align,\center); inputLevel2.setProperty(\background, HiliteGradient(Color.new255(60, 60, 0), Color.white, \v, 128, 0.3);); inputLevel2.setProperty(\font, Font("Trixie-Plain", 14)); inputLevel2.action = {in1LevSlider.value_((lev2@0).unmap(inputLevel2.value)); (levBus2@0).value = inputLevel2.value}; in1LevSlider2 = SCSlider(w, Rect( 500, 50, 50,160)); in1LevSlider2.value_((lev2@0).unmap(0.8)); in1LevSlider2.setProperty(\background, HiliteGradient(Color.black,Color.new255(60, 60, 0), \h, 128, 0.3);); in1LevSlider2.action = {(levBus2@0).value = (lev2@0).map(in1LevSlider2.value); inputLevel2.value_(((lev2@0).map(in1LevSlider2.value))); }; inputLevel2.value_(((lev2@0).map(in1LevSlider2.value))); SCStaticText( w, Rect(508, 232, 50, 18)).string_("Input 2").align_(\center).setProperty(\font, Font("Trixie-Plain", 15), \background, HiliteGradient(Color.new255(139, 117, 0),Color.new255(200, 200, 255), \v, 128, 0.3)); granLevel2 = SCNumberBox(w, Rect(625, 212, 40, 18)); granLevel2.setProperty(\align,\center); granLevel2.setProperty(\background, HiliteGradient(Color.new255(60, 60, 0), Color.white, \v, 128, 0.3);); granLevel2.setProperty(\font, Font("Trixie-Plain", 14)); granLevel2.action = {out1LevSlider2.value_((lev2@1).unmap(granLevel2.value)); (levBus2@1).value = granLevel2.value}; out1LevSlider2 = SCSlider(w, Rect(625, 50, 40, 160)); out1LevSlider2.value_((lev2@1).unmap(0.8)); out1LevSlider2.setProperty(\background, HiliteGradient(Color.black,Color.new255(60, 60, 0), \h, 128, 0.3);); out1LevSlider2.action = {(levBus2@1).value = (lev2@1).map(out1LevSlider2.value); granLevel2.value_((lev2@1).map(out1LevSlider2.value)); }; granLevel2.value_((lev2@1).map(out1LevSlider2.value)); SCStaticText( w, Rect(628, 232, 40, 18)).string_("Gran 2").align_(\center).setProperty(\font, Font("Trixie-Plain", 15),\background, HiliteGradient(Color.new255(139, 117, 0),Color.new255(200, 200, 255), \v, 128, 0.3)); // splayLevel2 = SCNumberBox(w, Rect(725, 212, 40, 18)); splayLevel2.setProperty(\align,\center); splayLevel2.setProperty(\background, HiliteGradient(Color.new255(60, 60, 0), Color.white, \v, 128, 0.3);); splayLevel2.setProperty(\font, Font("Trixie-Plain", 14)); splayLevel2.action = {out2LevSlider2.value_((lev2@2).unmap(splayLevel2.value)); (levBus2@2).value = splayLevel2.value}; out2LevSlider2 = SCSlider(w, Rect(725, 50, 40, 160)); out2LevSlider2.value_((lev2@2).unmap(0.8)); out2LevSlider2.setProperty(\background, HiliteGradient(Color.black,Color.new255(60, 60, 0), \h, 128, 0.3);); out2LevSlider2.action = {(levBus2@2).value = (lev2@2).map(out2LevSlider2.value); splayLevel2.value_(((lev2@2).map(out2LevSlider2.value))); }; splayLevel2.value_(((lev2@2).map(out2LevSlider2.value))); SCStaticText( w, Rect(725, 232, 50, 18)).string_("Spawn").align_(\center).setProperty(\font, Font("Trixie-Plain", 15), \background, HiliteGradient(Color.new255(139, 117, 0),Color.new255(200, 200, 255), \v, 128, 0.3)); chopLevel2 = SCNumberBox(w, Rect(825, 212, 40, 18)); chopLevel2.setProperty(\align,\center); chopLevel2.setProperty(\background, HiliteGradient(Color.new255(60, 60, 0), Color.white, \v, 128, 0.3);); chopLevel2.setProperty(\font, Font("Trixie-Plain", 14)); chopLevel2.action = {out3LevSlider2.value_((lev2@3).unmap(chopLevel2.value)); (levBus2@3).value = chopLevel2.value}; out3LevSlider2 = SCSlider(w, Rect(825, 50, 40, 160)); out3LevSlider2.value_((lev2@3).unmap(0.8)); out3LevSlider2.setProperty(\background, HiliteGradient(Color.black,Color.new255(60, 60, 0), \h, 128, 0.3);); out3LevSlider2.action = {(levBus2@3).value = (lev2@3).map(out3LevSlider2.value); chopLevel2.value_(((lev2@3).map(out3LevSlider2.value))); }; chopLevel2.value_(((lev2@3).map(out3LevSlider2.value))); SCStaticText( w, Rect(825, 232, 40, 18)).string_("Chop").align_(\center).setProperty(\font, Font("Trixie-Plain", 15), \background, HiliteGradient(Color.new255(139, 117, 0),Color.new255(200, 200, 255), \v, 128, 0.3)); pit2 = SCNumberBox(w, Rect(655, 269, 50, 20)); pit2.setProperty(\align,\center); pit2.setProperty(\background, HiliteGradient(Color.new255(60, 60, 0), Color.white, \v, 128, 0.3);); pit2.setProperty(\font, Font("Trixie-Plain", 12)); pit2.action = {pitch2.value_((granLev2@0).unmap(pit2.value)); (granBus2@0).value = pit.value}; pitch2 = SCSlider(w, Rect(502, 269, 150, 20)); pitch2.value_((granLev2@0).unmap(1.0)); pitch2.setProperty(\background, HiliteGradient(Color.black,Color.new255(60, 60, 0), \v, 128, 0.3);); pitch2.action = {(granBus2@0).value = (granLev2@0).map(pitch2.value); pit2.value_(((granLev2@0).map(pitch2.value))); }; pit2.value_(((granLev2@0).map(pitch2.value))); pD2 = SCNumberBox(w, Rect(655, 293, 50, 20)); pD2.setProperty(\align, \center); pD2.setProperty(\background, HiliteGradient(Color.new255(60, 60, 0), Color.white, \v, 128, 0.3);); pD2.setProperty(\font, Font("Trixie-Plain", 12)); pD2.action = {pitchDisp2.value_((granLev2@1).unmap(pD2.value)); (granBus2@1).value = pD2.value}; pitchDisp2 = SCSlider(w, Rect(502, 293, 150,20)); pitchDisp2.value_((granLev2@1).unmap(0.0)); pitchDisp2.setProperty(\background, HiliteGradient(Color.black,Color.new255(60, 60, 0), \v, 128, 0.3);); pitchDisp2.action = {(granBus2@1).value = (granLev2@1).map(pitchDisp2.value); pD2.value_(((granLev2@1).map(pitchDisp2.value))); }; pD2.value_(((granLev2@1).map(pitchDisp2.value))); tD2 = SCNumberBox(w, Rect(655, 317, 50, 20)); tD2.setProperty(\align,\center); tD2.setProperty(\background, HiliteGradient(Color.new255(60, 60, 0), Color.white, \v, 128, 0.3);); tD2.setProperty(\font, Font("Trixie-Plain", 12)); tD2.action = {timeDisp2.value_((granLev2@2).unmap(tD2.value)); (granBus2@2).value = tD2.value}; timeDisp2 = SCSlider(w, Rect(502, 317, 150, 20)); timeDisp2.value_((granLev@0).unmap(0.0)); timeDisp2.setProperty(\background, HiliteGradient(Color.black,Color.new255(60, 60, 0), \v, 128, 0.3);); timeDisp2.action = {(granBus2@2).value = (granLev2@2).map(timeDisp2.value); tD2.value_(((granLev2@2).map(timeDisp2.value))); }; tD2.value_(((granLev2@2).map(timeDisp2.value))); ol2 = SCNumberBox(w, Rect(655, 341, 50, 20)); ol2.setProperty(\align,\center); ol2.setProperty(\background, HiliteGradient(Color.new255(60, 60, 0), Color.white, \v, 128, 0.3);); ol2.setProperty(\font, Font("Trixie-Plain", 12)); ol2.action = {overlap2.value_((granLev2@3).unmap(ol2.value)); (granBus2@3).value = ol2.value}; overlap2 = SCSlider(w, Rect(502, 341, 150, 20)); overlap2.value_((granLev2@3).unmap(1.5)); overlap2.setProperty(\background, HiliteGradient(Color.black,Color.new255(60, 60, 0), \v, 128, 0.3);); overlap2.action = {(granBus2@3).value = (granLev2@3).map(overlap2.value); ol2.value_(((granLev2@3).map(overlap2.value))); }; ol2.value_(((granLev2@3).map(overlap2.value))); gD2 = SCNumberBox(w, Rect(863, 269, 50, 20)); gD2.setProperty(\align,\center); gD2.setProperty(\background, HiliteGradient(Color.new255(60, 60, 0), Color.white, \v, 128, 0.3);); gD2.setProperty(\font, Font("Trixie-Plain", 12)); gD2.action = {grainDur2.value_((granLev@4).unmap(gD2.value)); (granBus@4).value = gD2.value}; grainDur2 = SCSlider(w, Rect(765, 269, 96, 20)); grainDur2.value_((granLev@0).unmap(0.25)); grainDur2.setProperty(\background, HiliteGradient(Color.black,Color.new255(60, 60, 0), \v, 128, 0.3);); grainDur2.action = {(granBus@4).value = (granLev@4).map(grainDur2.value); gD2.value_(((granLev@4).map(grainDur2.value))); }; gD2.value_(((granLev@4).map(grainDur2.value)).round(0.01)); SCStaticText( w, Rect(707, 269, 50, 20)).string_("pitch").align_(\left).setProperty(\font, Font("Trixie-Plain", 13)); SCStaticText( w, Rect(707, 293, 70, 20)).string_("pitch Disp").align_(\left).setProperty(\font, Font("Trixie-Plain", 13)); SCStaticText( w, Rect(707, 317, 70, 20)).string_("time Disp").align_(\left).setProperty(\font, Font("Trixie-Plain", 13)); SCStaticText( w, Rect(707, 341, 50, 20)).string_("overlap").align_(\left).setProperty(\font, Font("Trixie-Plain", 13)); SCStaticText( w, Rect(785, 293, 110, 20)).string_("grain duration").align_(\center).setProperty(\font, Font("Trixie-Plain", 13)); cClear = SCButton(w, Rect(775, 323, 70, 20)) .states_([ ["Clear Buf", Color.black, Color.rand], ["Clear Buf", Color.white, Color.rand] ]).action = {c.zero}; cClear.setProperty(\font, Font("Trixie-Plain", 12)); sampList2Clear = SCButton(w, Rect(847, 323, 70, 20)) .states_([ ["ClearList", Color.black, Color.rand], ["ClearList", Color.white, Color.rand] ]).action = {sampleSections2.clear}; sampList2Clear.setProperty(\font, Font("Trixie-Plain", 12)); // Stretch Window wS = SCWindow("stretch", Rect(275, 10, 260, 320)).front; wS.view.background = Gradient(Color.new255(50, 60, 40), Color.new255(69, 139, 116), \v, 128, 0.6); stretchBut = SCButton(wS, Rect(15, 15, 80, 20)) .states_([ ["stretch", Color.black, Color.new255(69, 239, 116)], ["Stop", Color.white, Color.new255(150, 60, 40)] ]) .action = { if (stretchBut.value == 1, { stretcher.reset; SystemClock.play(stretcher); }, { stretcher.stop; stretchGroup.set(\gate,0); }); }; stretchBut.setProperty(\font, Font("Trixie-Plain", 15)); rateMenu=SCPopUpMenu(wS,Rect(100,15,140,20)); rateMenu.items = [ "normal", "norm + [-8va]", "norm+[-8va,+8va]", "norm + [+8va]","[-8va]", "[+8va]" ]; rateMenu.setProperty(\font, Font("Trixie-Plain", 15)); rateMenu.setProperty(\background, HiliteGradient(Color.new255(69, 239, 116), Color.white, \v, 128, 0.3);); rateMenu.action = { if (rateMenu.value == 0, {stretchRate = [1]}, {if (rateMenu.value == 1, {stretchRate = [1,0.5]}, {if (rateMenu.value == 2, {stretchRate = [1, 0.5,2]}, {if (rateMenu.value == 3, {stretchRate = [1,2]}, {if (rateMenu.value == 4, {stretchRate = [0.5]}, {if (rateMenu.value == 5, {stretchRate = [2]}) })})})})} )}; loop = SCNumberBox(wS, Rect(10, 212, 40, 18)); loop.setProperty(\align,\center); loop.setProperty(\background, HiliteGradient(Color.new255(60, 60, 0), Color.white, \v, 128, 0.3);); loop.setProperty(\font, Font("American Typewriter", 12)); loop.action = {loopSlider.value_((loopNum).unmap(loop.value))}; loopSlider = SCSlider(wS, Rect( 10, 50, 40,160)); loopSlider.value_((loopNum).unmap(15)); loopSlider.setProperty(\background, HiliteGradient(Color.black,Color.new255(60, 60, 0), \h, 128, 0.3);); loopSlider.action = {(loopNum).map(loopSlider.value); loop.value_(((loopNum).map(loopSlider.value))); }; loop.value_(((loopNum).map(loopSlider.value))); SCStaticText( wS, Rect(10, 232, 40, 20)).string_("loops").align_(\center).setProperty(\font, Font("American Typewriter", 11), \background, HiliteGradient(Color.new255(139, 117, 0),Color.new255(200, 200, 255), \v, 128, 0.3)); repeats = SCNumberBox(wS, Rect(60, 212, 40, 18)); repeats.setProperty(\align,\center); repeats.setProperty(\background, HiliteGradient(Color.new255(60, 60, 0), Color.white, \v, 128, 0.3);); repeats.setProperty(\font, Font("American Typewriter", 12)); repeats.action = {repeatSlider.value_((repeatNum).unmap(repeats.value))}; repeatSlider = SCSlider(wS, Rect( 60, 50, 40,160)); repeatSlider.value_((repeatNum).unmap(100)); repeatSlider.setProperty(\background, HiliteGradient(Color.black,Color.new255(60, 60, 0), \h, 128, 0.3);); repeatSlider.action = {(repeatNum).map(repeatSlider.value); repeats.value_(((repeatNum).map(repeatSlider.value))); }; repeats.value_(((repeatNum).map(repeatSlider.value))); SCStaticText( wS, Rect(60, 232, 40, 20)).string_("repeats").align_(\center).setProperty(\font, Font("American Typewriter", 11), \background, HiliteGradient(Color.new255(139, 117, 0),Color.new255(200, 200, 255), \v, 128, 0.3)); travel = SCNumberBox(wS, Rect(110, 212, 40, 18)); travel.setProperty(\align,\center); travel.setProperty(\background, HiliteGradient(Color.new255(60, 60, 0), Color.white, \v, 128, 0.3);); travel.setProperty(\font, Font("American Typewriter", 10)); travel.action = {travelSlider.value_((travelNum).unmap(travel.value))}; travelSlider = SCSlider(wS, Rect( 110, 50, 40,160)); travelSlider.value_((travelNum).unmap(0.0001)); travelSlider.setProperty(\background, HiliteGradient(Color.black,Color.new255(60, 60, 0), \h, 128, 0.3);); travelSlider.action = {(travelNum).map(travelSlider.value); travel.value_(((travelNum).map(travelSlider.value))); }; travel.value_(((travelNum).map(travelSlider.value))); SCStaticText( wS, Rect(110, 232, 40, 20)).string_("travel").align_(\center).setProperty(\font, Font("American Typewriter", 11), \background, HiliteGradient(Color.new255(139, 117, 0),Color.new255(200, 200, 255), \v, 128, 0.3)); overlapS = SCNumberBox(wS, Rect(160, 212, 40, 18)); overlapS.setProperty(\align,\center); overlapS.setProperty(\background, HiliteGradient(Color.new255(60, 60, 0), Color.white, \v, 128, 0.3);); overlapS.setProperty(\font, Font("American Typewriter", 12)); overlapS.action = {olSlider.value_((olNum).unmap(overlapS.value))}; olSlider = SCSlider(wS, Rect( 160, 50, 40,160)); olSlider.value_((olNum).unmap(1.5)); olSlider.setProperty(\background, HiliteGradient(Color.black,Color.new255(60, 60, 0), \h, 128, 0.3);); olSlider.action = {(olNum).map(travelSlider.value); overlapS.value_(((olNum).map(olSlider.value))); }; overlapS.value_(((olNum).map(olSlider.value))); SCStaticText( wS, Rect(160, 232, 40, 20)).string_("overlap").align_(\center).setProperty(\font, Font("American Typewriter", 11), \background, HiliteGradient(Color.new255(139, 117, 0),Color.new255(200, 200, 255), \v, 128, 0.3)); levS = SCNumberBox(wS, Rect(210, 212, 40, 18)); levS.setProperty(\align,\center); levS.setProperty(\background, HiliteGradient(Color.new255(60, 60, 0), Color.white, \v, 128, 0.3);); levS.setProperty(\font, Font("American Typewriter", 12)); levS.action = {levSliderS.value_((levNumS).unmap(levS.value)); (levBusS).value = levS.value}; levSliderS = SCSlider(wS, Rect( 210, 50, 40,160)); levSliderS.value_((loopNum).unmap(0.0)); levSliderS.setProperty(\background, HiliteGradient(Color.black,Color.new255(60, 60, 0), \h, 128, 0.3);); levSliderS.action = {(levBusS).value = (levNumS).map(levSliderS.value); levS.value_(((levNumS).map(levSliderS.value))); }; levS.value_(((levNumS).map(levSliderS.value))); SCStaticText( wS, Rect(210, 232, 40, 20)).string_("level").align_(\center).setProperty(\font, Font("American Typewriter", 11), \background, HiliteGradient(Color.new255(139, 117, 0), Color.new255(200, 200, 255), \v, 128, 0.3)); panRangeSlider=SCRangeSlider(wS, Rect(50, 260, 130, 25)); panRangeSlider.step_(0.05); panRangeSlider.setProperty(\background, HiliteGradient(Color.new255(60, 60, 0), Color.white, \v, 128, 0.3);); panRangeSlider.lo_(0.45); panRangeSlider.hi_(0.55); panRangeSlider.action = { pLo.value_((panRangeSlider.lo.value*2)-1); pHi.value_((panRangeSlider.hi.value*2)-1)}; pLo = SCNumberBox(wS, Rect(50, 287, 30, 18)); pLo.setProperty(\align,\center); pLo.setProperty(\background, HiliteGradient(Color.new255(60, 60, 0), Color.white, \v, 128, 0.3);); pLo.setProperty(\font, Font("American Typewriter", 12)); pLo.value_(-0.1); SCStaticText( wS, Rect(82, 287, 70, 20)).string_("pan range").align_(\center).setProperty(\font, Font("American Typewriter", 11), \background, HiliteGradient(Color.new255(139, 117, 0),Color.new255(200, 200, 255), \v, 128, 0.3)); pHi = SCNumberBox(wS, Rect(150, 287, 30, 18)); pHi.setProperty(\align,\center); pHi.setProperty(\background, HiliteGradient(Color.new255(60, 60, 0), Color.white, \v, 128, 0.3);); pHi.setProperty(\font, Font("American Typewriter", 12)); pHi.value_(0.1); echoBut = SCButton(wS, Rect(200, 262, 30, 18)).states_([ ["off", Color.black, Color.new255(0, 134, 139)], ["on", Color.white, Color.new255(255, 62, 100)]]); echoBut.setProperty(\font, Font("Trixie-Plain", 11)); SCStaticText( wS, Rect(200, 282, 30, 20)).string_("echo").align_(\center).setProperty(\font, Font("American Typewriter", 12), \background, HiliteGradient(Color.new255(139, 117, 0),Color.new255(200, 200, 255), \v, 128, 0.3)); echoBut.action= { if (echoBut.value == 1, { echoStretch.run(true); }, { echoStretch.run(false) }); }; //wR = SCWindow("rate changer", Rect(650, 10 ,175, 60)); //wR.view.background_(rgb(15,55,95)); rArray=Array.new(20); cR = SCButton(w,Rect(25,23,100,20)).focus; cR.setProperty(\font, Font("Trixie-Plain", 14)); cR.keyDownAction = { arg view,char,modifiers,unicode,keycode; //[char,modifiers,unicode,keycode].postln; if(unicode == 122, {rArray.add(0.05)};); //keys z-m if(unicode == 120, {rArray.add(0.125)};); if(unicode == 99, {rArray.add(0.25)};); if(unicode == 118, {rArray.add(0.3)};); if(unicode == 98, {rArray.add(0.5)};); if(unicode == 110, {rArray.add(0.8)};); if(unicode == 109, {rArray.add(1.0)};); if(unicode == 97, {rArray.remove(0.05)};); //keys a-j if(unicode == 115, {rArray.remove(0.125)};); if(unicode == 100, {rArray.remove(0.25)};); if(unicode == 102, {rArray.remove(0.3)};); if(unicode == 103, {rArray.remove(0.5)};); if(unicode == 104, {rArray.remove(0.8)};); if(unicode == 106, {rArray.remove(1.0)};); if(unicode == 936, {rArray.add(-0.025)};); //option key versions if(unicode == 8776, {rArray.add(-0.125)};); if(unicode == 231, {rArray.add(-0.25)};); if(unicode == 8730, {rArray.add(-0.3)};); if(unicode == 8747, {rArray.add(-0.6)};); if(unicode == 181, {rArray.add(-0.875)};); //no option-n, m instead if(unicode == 8804, {rArray.add(-1.0)};); // option-, if(unicode == 229, {rArray.remove(-0.025)};); if(unicode == 223, {rArray.remove(-0.125)};); if(unicode == 8706, {rArray.remove(-0.25)};); if(unicode == 402, {rArray.remove(-0.3)};); if(unicode == 169, {rArray.remove(-0.6)};); if(unicode == 729, {rArray.remove(-0.875)};); if(unicode == 8710, {rArray.remove(-1.0)};); }; cR.states = [["rate", Color.black, Color.rand], ["rate", Color.white, Color.rand]]; //wR.front; winClose= {w.close; wS.close; CmdPeriod.remove(winClose);}; CmdPeriod.add(winClose); //midi.. pain in the butt. MIDIClient.init(4,4); // i have two iac busses, one rme, and the m-audio MIDIIn.connect(2, MIDIClient.sources.at(2)); MIDIIn.control = {arg src, chan, num=7, value; if (chan == 0, { (levBus@0).value = (lev1@0).map(value/127); {in1LevSlider.value_(value/127).changed; inputLevel.value_((lev1@0).map(value/127).round(0.01)).changed}.defer; }, {if(chan == 1, { (levBus@1).value = (lev1@1).map(value/127); {out1LevSlider.value_(value/127).changed; granLevel.value_((lev1@1).map(value/127).round(0.01)).changed}.defer; }, {if(chan == 2, { (levBus@2).value = (lev1@2).map(value/127); {out2LevSlider.value_(value/127).changed; splayLevel.value_((lev1@2).map(value/127).round(0.01)).changed}.defer; }, {if(chan == 3, { (levBus@3).value = (lev1@3).map(value/127); {out3LevSlider.value_(value/127).changed; chopLevel.value_((lev1@3).map(value/127).round(0.01)).changed}.defer; }, {if (chan == 4, { (levBus2@0).value = (lev2@0).map(value/127); {in1LevSlider2.value_(value/127).changed; inputLevel2.value_((lev2@0).map(value/127).round(0.01)).changed}.defer; }, {if(chan == 5, { (levBus2@1).value = (lev2@1).map(value/127); {out1LevSlider2.value_(value/127).changed; granLevel2.value_((lev2@1).map(value/127).round(0.01)).changed}.defer; }, {if(chan == 6, { (levBus2@2).value = (lev2@2).map(value/127); {out2LevSlider2.value_(value/127).changed; splayLevel2.value_((lev2@2).map(value/127).round(0.01)).changed}.defer; }, {if(chan == 7, { (levBus2@3).value = (lev2@3).map(value/127); {out3LevSlider2.value_(value/127).changed; chopLevel2.value_((lev2@3).map(value/127).round(0.01)).changed}.defer; }, {if(chan == 8, { (granBus2@0).value = (granLev2@0).map(value/127); {pitch2.value_(value/127).changed; pit2.value_((granLev2@0).map(value/127).round(0.01)).changed}.defer;}, {if(chan == 9, { (granBus2@1).value = (granLev2@1).map(value/127); {pitchDisp2.value_(value/127).changed; pD2.value_((granLev2@1).map(value/127).round(0.01)).changed}.defer;}, {if(chan == 10, { (granBus@2).value = (granLev2@2).map(value/127); {timeDisp2.value_(value/127).changed; tD2.value_((granLev@2).map(value/127).round(0.01)).changed}.defer; }, {if (chan == 11, { (granBus@0).value = (granLev@0).map(value/127); {pitch.value_(value/127).changed; pit.value_((granLev@0).map(value/127).round(0.01)).changed}.defer; }, {if(chan == 12, { (granBus@1).value = (granLev@1).map(value/127); {pitchDisp.value_(value/127).changed; pD.value_((granLev@1).map(value/127).round(0.01)).changed}.defer; }, {if(chan == 13, { (granBus@2).value = (granLev@2).map(value/127); {timeDisp.value_(value/127).changed; tD.value_((granLev@2).map(value/127).round(0.01)).changed}.defer; }, {if(chan == 14, { (granBus2@3).value = (granLev2@3).map(value/127); {overlap2.value_(value/127).changed; ol2.value_((granLev2@3).map(value/127).round(0.01)).changed}.defer; (granBus@3).value = (granLev@3).map(value/127); {overlap.value_(value/127).changed; ol.value_((granLev@3).map(value/127).round(0.01)).changed}.defer; }, {if(chan == 15, { (granBus2@4).value = (granLev2@4).map(value/127); {grainDur2.value_(value/127).changed; gD2.value_((granLev2@4).map(value/127).round(0.01)).changed}.defer; (granBus@4).value = (granLev@4).map(value/127); {grainDur.value_(value/127).changed; gD.value_((granLev@4).map(value/127).round(0.01)).changed}.defer; }) }) }) }) }) }) }) }) }) }) }) }) }) }) }) }) }; )/* authors so far: Jonathan Segel */ |
|