Hello everyone,
I was told that I midi controllers were a popular topic here as of late. Allow me to dive right in :-)
I am used to using the korg nano PAD and in the past, I have used this:
(
SynthDef( \tirescreaching,
{| freq = 440, gate =1, sustain =1, amp = 0.25, width = 0.15, preamp = 5|
var sig,
env = Env.adsr(0.01, 0.1, 0.1, 0.01);
sig = Saw.ar(Latch.ar(GrayNoise.ar, SyncSaw.ar(9)) * 400 + 800 + freq, 4, 0.2) * EnvGen.kr(env, gate, doneAction:2) * amp;
Out.ar(0, sig ! 2)
}).add
)
//Set up below
(
var notes, on, off;
MIDIClient.init;
MIDIIn.connectAll;
notes = Array.newClear(128); // array has one slot per possible MIDI note
on = MIDIFunc.noteOn({ |veloc, num, chan, src|
notes[num] = Synth(\tirescreaching, [\freq, num.midicps,
\amp, veloc * 0.00315]);
});
off = MIDIFunc.noteOff({ |veloc, num, chan, src|
notes[num].release;
});
q = { on.free; off.free; };
)
I have recently acquired a korg nanoKontrol to control, among other things, amplitude and stutter/glitch effects with knobs and faders. My attempts so far have been getting me closer to the goal. I have been able to get the kontrol to print commands to the post window when I move the faders and knobs.
I have discovered that I can control pitch, using the faders, in this manner:
(
MIDIIn.connectAll;
n = Ndef(\test1,{|freq = 440|0.1*SinOsc.ar(freq)}).play;
MIDIdef.cc('test1', { |val|
n.set(\freq, \freq.asSpec.map(val / 127));
}, ccNum: 14); // knob 1
Spec.add(\freq, [200, 1000, \exp]);
)
(
// and then:
MIDIdef.cc('test1', { |val| n.set(\freq, \freq.asSpec.map(val /
127))}, ccNum: 2); // slider 1
)
I have discovered that I can control amplitude, using the faders, in this manner:
(
SynthDef(\sound,{arg freq=440, amp=1;
var saw, sig, filter, env;
saw= Saw.ar(freq);
sig = Saw.ar(Latch.ar(GrayNoise.ar, SyncSaw.ar(9)) * 400 + 800 + freq, 4, 0.2) * amp;
filter= Resonz.ar(saw,1000,0.1)*amp;
Out.ar(0,sig,filter.dup(2))
}).add
)
a= Synth(\sound,[\freq,200,\amp,1]); //create running synth
//use the set message to update the control inputs of the running synth
MIDIIn.control = { arg src, chan, num, val; a.set(\amp, val/127) };
//when you're finished twiddling MIDI controllers
a.free;
I am curious if anyone has made good use of the other buttons, besides the faders and knobs as well.
I have read that some people use Responders with success but I am not experienced enough to really apply them. I am hoping someone would be able to assist me with understanding how to make use of nano kontrol. It seems like a very versatile tool but I need a little push. If anyone would like to share some working examples of using this thing, I would be beyond grateful. As you may have guessed, I am still pretty new to SC and appreciate all input that you can afford. Happy New Year!
Regards,
Joel