From d45fc401775b306e95811e33e87ab350596263ac Mon Sep 17 00:00:00 2001 From: Eugene Petkevich Date: Sun, 7 Jan 2024 00:51:35 +0100 Subject: [PATCH] test control buss connection to pbind --- library/midi.scd | 38 +++++++++++++++---------------- temp.scd | 58 ++++++++++++++++++++++++++++++++++++++++++------ 2 files changed, 70 insertions(+), 26 deletions(-) diff --git a/library/midi.scd b/library/midi.scd index 64366d4..7a4c00d 100644 --- a/library/midi.scd +++ b/library/midi.scd @@ -1,3 +1,7 @@ +~midibusnames = ["paja", "nuny", "nero", "fyxa", "jana", "sona", "bixu", "nyva"]; + +m = (); + ~midiup = { MIDIClient.init; MIDIIn.connectAll; @@ -5,14 +9,14 @@ Platform.case( \osx, { try { - ~moutArdour1 = MIDIOut.newByName("IAC Driver", "Bus 1").latency_(s.latency); - ~moutArdour2 = MIDIOut.newByName("IAC Driver", "Bus 2").latency_(s.latency); - ~moutArdour3 = MIDIOut.newByName("IAC Driver", "Bus 3").latency_(s.latency); - ~moutArdour4 = MIDIOut.newByName("IAC Driver", "Bus 4").latency_(s.latency); - ~moutFl = MIDIOut.newByName("IAC Driver", "Bus 5").latency_(s.latency); - ~moutAbleton = MIDIOut.newByName("IAC Driver", "Bus 6").latency_(s.latency); - ~moutHydrogen = MIDIOut.newByName("IAC Driver", "Bus 7").latency_(s.latency); - ~mout8 = MIDIOut.newByName("IAC Driver", "Bus 8").latency_(s.latency); + ~midibusnames.do{|name| + currentEnvironment.put((\mout ++ name).asSymbol, + MIDIOut.newByName( + "IAC Driver", + name) + .latency_(s.latency) + ); + }; } {|error| "Cannot connect to macbook midi out".postln; error.throw; @@ -22,16 +26,10 @@ \windows, { } ); - m = ( - arout1: ~moutArdour1, - arout2: ~moutArdour2, - arout3: ~moutArdour3, - arout4: ~moutArdour4, - about: ~moutAbleton, - flout: ~moutFl, - hyout: ~moutHydrogen, - out8: ~mout8 - ); + ~midibusnames.do{|name| + m[name.asSymbol] = currentEnvironment.at((\mout ++ name).asSymbol); + }; + m.flout = m.sona; }; // hydrogen drum machine constants @@ -54,4 +52,6 @@ b = ( splash: 51, hatsemiopen: 52, bell: 53, -); \ No newline at end of file +); + +~midiup.value; \ No newline at end of file diff --git a/temp.scd b/temp.scd index b5a57bc..c47f1ca 100644 --- a/temp.scd +++ b/temp.scd @@ -18,19 +18,63 @@ r.nextN(12); // the next 12 values from r ( Pdef(\temp, Pbind(*[ - instrument: \defaultalt, - db: -9, - octave: Prand([4, 5, 6], inf)+[0, 2], + instrument: \dyti, + db: -15, + octave: Prand([2], inf)+[0, 2], degree: Pseq([6, 5, 4, 6, 1, 3], inf), - dur: Pseq([3, 3, 2].split(1), inf), - release: Pwhite(0.5, 1.2)*TempoClock.tempo.reciprocal*1.6, - legato: Pwhite(0.6, 0.7), - cut: Pexprand(400, 3200), + dur: Pseq([3, 3, 2].split(4)/2, inf), + release: Pwhite(0.5, 1.2)*TempoClock.tempo.reciprocal*0.2, + legato: Pwhite(0.2, 0.4), + cut: Pexprand(400, 800), rez: Pwhite(0.6, 0.9), modFreqMin: 4, + modFreqMax: 6, + modAmp: Pwhite(0.005, 0.01), + pan: Pwhite(-0.2, 0.2) * [-1, 1], + out: a.h, +])).quant_(4).stop; + +Pdef(\temp2, Pbind(*[ + instrument: \dyti, + db: -15, + octave: Prand([3], inf)+[0, 2], + degree: Pseq([6, 5, 4, 6, 1, 3], inf), + dur: Pseq([3, 3, 2].split(4)/2, inf), + release: Pwhite(0.5, 1.2)*TempoClock.tempo.reciprocal*0.2, + legato: Pwhite(0.2, 0.4), + cut: Pexprand(800, 3200), + rez: Pwhite(0.6, 0.9), + modFreqMin: 7, modFreqMax: 11, modAmp: Pwhite(0.005, 0.01), pan: Pwhite(-0.2, 0.2) * [-1, 1], out: a.h, +])).quant_(4).stop; + +Pdef(\temp3, Pbind(*[ + instrument: \dyti, + db: -15, + octave: Prand([2, 3], inf)+[0, 2], + degree: Pseq([6, 5, 6, 1, 3, 4], inf), + dur: Pseq([3, 3, 2].split(4)/2, inf), + release: Pwhite(0.5, 1.2)*TempoClock.tempo.reciprocal*0.2, + legato: Pwhite(0.2, 0.4), + cut: ~testControl.asMap,//Pexprand(400, 3200), + rez: Pwhite(0.6, 0.9), + modFreqMin: 4, + modFreqMax: 11, + modAmp: Pwhite(0.05, 0.1), + pan: Pwhite(-0.2, 0.2) * [-1, 1], + out: a.h, ])).quant_(4).play; +) + +~testControl = Bus.control; +~testControl.get{|v|v.postln}; +~mousecontrol = Synth(\testmouse, [\kout, ~testControl]); + +( +SynthDef(\testmouse, {|kout| + Out.kr(kout, MouseX.kr(400, 12800, 1)); +}).add; ) \ No newline at end of file -- 2.17.1