Convert a midi notOne into a cc message

Is there a conviennent way to convert a midi noteOn message into a cc message? I have midi controller that sends only midinotes but my code needs ccmessage 0/127 to trigger my synths. Is there a easy way convert noteOn messages into cc messages?

// read incoming messages:

MIDIdef.trace // .trace(false) will turn of

// define a function for incoming velocity & note values:

MIDIdef(\key, { |v n| /***/ }, msgNum: (..127), msgType: 

    // \noteOff
    // \control

.fix // a shortcut to keep defs from being cleared on CMD + '.'

// emulate a converse action:

MIDIIn.doNoteOnAction(num: /**/, veloc: /**/)

MIDIIn.doControlAction(num: /**/, veloc: /**/)

The issue here, I think, is “my code needs ccmessage 0/127 to trigger my synths.”

There’s nothing wrong with using CC messages to trigger synths – but, if CC messages are the only way to trigger the synths, then it makes things difficult to do another way.

It may be too late for this project, but I would suggest writing a function (or functions) to trigger the synths. It is usually better to have a programmatic way to take real action – every action you need in the system should have some way to do it purely in code.

If you have this, then it’s equally easy to write a CC responder or a note-on responder to call the function.

Writing the “new synth” logic directly into a CC responder is called “tight coupling” – the new synth is bound to one way of doing things. Tight coupling is an easy place to begin but not the best place to stay… It’s a habit worth getting away from.

If there’s really no way to revise the code, you can “fake” the CC messages by calling into MIDIIn directly. Rainer hinted at this but didn’t really explain.

MIDIdef.noteOn(\on, { |vel, num, chan, src|
	MIDIIn.doControlAction(src, chan, num, vel)

But this is a hack… it would really be better to separate the synth logic from the external-control interface.