midi cc filtering

classic Classic list List threaded Threaded
3 messages Options
Reply | Threaded
Open this post in threaded view
|

midi cc filtering

Adampultz
Hello,

I want to map a single slider from my midi-controller to control amplitude in a synth, but I cannot filter out the other cc messages coming from the other sliders on my controller.
I have succeded in having postln respond to only the one slider I wish to use, but the a.set message still responds to every control change message from my controller.
What am i missing?

s.boot;
Server.default=s=Server.internal;
MIDIClient.init;
MIDIIn.connectAll;

(
SynthDef.new(\tone, {
        arg freq=440, amp=0.3, gate=0;
        var sig;
                sig = LFTri.ar(freq)!2;
                sig = sig*amp;
        Out.ar(0, sig);
}).add;
)

a=Synth (\tone);
a.free;

(
MIDIdef.cc (\control,
        {
        arg val, num, chan;
                [val, num, chan].postln;
        a.set(\amp, val.linexp(1, 127, 0.01, 1));
}, 6,0);
)
Reply | Threaded
Open this post in threaded view
|

Re: midi cc filtering

kflak
On my phone right now, so can’t flesh it out, but the trick is to wrap the a.set in an if statement. 

K
___
Roosna & Flak 
Contemporary Dance & Music
+372 5565 1666

On 4 Oct 2017, at 15:21, Adampultz [via New SuperCollider Mailing Lists Forums (Use These!!!)] <[hidden email]> wrote:

Hello,

I want to map a single slider from my midi-controller to control amplitude in a synth, but I cannot filter out the other cc messages coming from the other sliders on my controller.
I have succeded in having postln respond to only the one slider I wish to use, but the a.set message still responds to every control change message from my controller.
What am i missing?

s.boot;
Server.default=s=Server.internal;
MIDIClient.init;
MIDIIn.connectAll;

(
SynthDef.new(\tone, {
        arg freq=440, amp=0.3, gate=0;
        var sig;
                sig = LFTri.ar(freq)!2;
                sig = sig*amp;
        Out.ar(0, sig);
}).add;
)

a=Synth (\tone);
a.free;

(
MIDIdef.cc (\control,
        {
        arg val, num, chan;
                [val, num, chan].postln;
        a.set(\amp, val.linexp(1, 127, 0.01, 1));
}, 6,0);
)


If you reply to this email, your message will be added to the discussion below:
http://new-supercollider-mailing-lists-forums-use-these.2681727.n2.nabble.com/midi-cc-filtering-tp7635438.html
To unsubscribe from New SuperCollider Mailing Lists Forums (Use These!!!), click here.
NAML
Reply | Threaded
Open this post in threaded view
|

Re: midi cc filtering

Adampultz
I tried with this but it still receives all incoming cc messages:

(
MIDIdef.cc (\control,
        {
        arg val, num, chan;
                [val, num, chan];
                if (num== 6, {a.set(\amp, val.linexp(1, 127, 0.01, 1))});
});
)