How view MIDI CC value (and why doesn't SC like channel 1?)

Hello,

Somebody taught me a while back how to display the incoming MIDI CC message value in addition to the channel number in SC Comments. I’ve since forgotten. Does anyone know it?

I’ve gotten my MIDI controllers to talk to SC using this code.

MIDIdef.cc(\testCC,{ arg val, num, chan;////For Keyboard 61?
[num,val].postln;
switch(num,
1,{ ~synth.set(\freqContmod,\freqContmod.asSpec.map(val/127)) },
2,{ ~synth.set(\delay,\delay.asSpec.map(val/127)) },

etc.

)}).fix;

With any of the 3 controllers I use, though, I’m unable to get channel 1 working. Whenever I turn the corresponding knob, I get this:

Meta_MIDIIn:doControlAction
	arg this = <instance of Meta_MIDIIn>
	arg src = -1746069741
	arg chan = 0
	arg num = 1
	arg val = 47

^^ ERROR: Message ‘map’ not understood.
RECEIVER: nil

Unfortunately, my most reliable MIDI controller can’t change from sending on channels 1-24, and I’d like to be efficient in using all 24. My Arturia controllers (sigh) don’t work reliably with SC. Thanks for your help!

This is actually the answer to your question: when SC receives from “channel 1,” the chan function argument is 0. You’ll find also that “channel 2” comes in as 1, and so on up to “channel 16” → 15.

This page shows how channel 1 is encoded as 0000 in the lowest 4 bits of a MIDI status byte, and channel 2 as 0001 = 1 etc. That is, what your hardware calls channel 1 is, in reality, 0! And always has been.

Unfortunately, my most reliable MIDI controller can’t change from sending on channels 1-24, and I’d like to be efficient in using all 24.

MIDI 1.0 supports 16 channels btw, not 24.

hjh

I’m sorry, I was using “channels” incorrectly. I meant CC number. My controller has 24 knobs, set to transmit on CC numbers 1-24, all on Channel 1 or Global (unless I want another channel).

If I turn knob #1, which transmits on CC #1, I get the error:

"Message ‘map’ not understood. RECEIVER: nil

So my message subject should be, Why doesn’t SC like CC #1?

CC #1 isn’t the issue – if you’re getting the error, then it’s calling your function just fine.

The error message tells you what the problem is: you’re trying to map but there is no receiver.

What should the receiver be for map? In this context, a ControlSpec.

So you’re expecting \freqContmod.asSpec to be a ControlSpec, but instead this is nil… correct this situation and it should start working.

hjh