Noob question. I’m starting to incorporate a MIDI controller as part of a live coding environment (ProxySpace with Pbinds) and I want faders to control some parameters. Below is my simplified attempt to do so, but the warning “scheduler queue is full.” appears when I move the fader a bit fast. What am I doing wrong?
Thanks a lot for your help!
Because ~amp is a NodeProxy, every ~amp = someNumber plays a short synth to fade from the old value to the new one.
Also IIRC JITLib works on the assumption that server latency should always be applied, so the fade synth will be playing s.latency seconds later.
If you’re generating dozens of MIDI messages per second, then multiple fade synths will line up in the server’s scheduler – if these are too many, then the queue overflows and you get this message.
Unfortunately we don’t have an object that does exactly what Max’s [speedlim] does, but you can get pretty close with SkipJack (save the MIDI value in a variable, not the proxy, and SkipJack updates the proxy at fixed intervals if the value changed). I’m not at the computer now, though, so I can’t code at just at this moment.
OK, on the computer. I decided to do it with a dictionary (Event) so that you can add more MIDI-controlled parameters just by putting new values (under any name) into q, and the SkipJack will automatically add them into the ProxySpace – at most 20 times per second, so, not too fast.
If you really have only amp then you could simplify, but I’m assuming you will use more MIDI knobs. This is a more extensible solution.
(
s.boot;
p = ProxySpace.new.push;
// storage for named values
q = (
amp: 0.1
);
r = (); // old values, to detect changes
t = SkipJack({
q.keysValuesDo { |key, value|
if(value != r[key]) {
r[key] = value;
key.envirPut(value); // update ProxySpace
}
}
}, dt: 0.05 /* 20x per sec */);
MIDIClient.init;
MIDIIn.connectAll;
MIDIdef.cc(\amp, { |val| q[\amp] = (val / 127) * 0.8 }, 1);
)
Thanks a lot for this James. Yes, I was thinking of something like Max’s speedlim when asking the question. But this works very good, and you’re right: I intend to use more fader/knobs for different parameters. Actually, I want to have the option of deciding on the fly to which of such parameters I could assign the fader/knob to (detune, amp, cutoff freq, etc). The MIDIdef line should do the work.
Again, thanks!
MHF