It is sometimes useful to send special MIDI messages to Sonar, like Program Changes, CC, etc. It is nice when your keyboard can be configured to send them directly, but even than it is not always practical. And what to do when your controller can not generate required messages at all? Here I am going to demonstrate how that can be done using AZ Controller.
Unfortunately, Control Surface (CS) API has no function to "inject" any MIDI from CS directly into Sonar. But plug-in can send arbitrary MIDI back to the device. So, if we send something to loopback MIDI software/hardware device, we can route its other end into Sonar! I am using
loopMIDI, works great for me. But you can use any other solution.
In this example, I am going to send Program Changes to select one from 4 different instruments for TTS-1. Create simple project with TTS-1 track to test the result.
Insert AZ Controller into the Control Surfaces list, set its input to your controller and its output to the loopback device.
I start the explanation from the result of
"Quick start" tutorial. Check that it works (it should move the first track volume by turning the knob).
In the Options tab, Create Software Set: in the Software Set section enter "Instrument" and press "Save". After that, replace "Default" with "1" and press "Save". In the Combo Box with "1" select "<Append state>", enter "2" and press "Save". The same way add "3" and "4". That is going to be the instrument to select, the number of States here will be the number of instruments we can select.
Change to the Logic Tab.
Select second ("Value") Action. Change "Strip" to "MIDI", "CC" to "PC" and leave "Number" 0 (Our first instrument will be Piano).
In the "Action conditions" select "Instrument" and replace "<Any>" by "1".
"Copy" the action, and press "Paste" 3 times.
Select "Strip" Action and move it to the top of the list (by "Move Up"). Change "Undefined" to "Set state", "Instrument" and change "<Next Step>" to "<Map MIDI Value">.
Select second MIDI Action, Change "1" in the "Action conditions" to "2" and "0" in the "Action Configuration" to 4 (that will be "E Piano").
Do the same with other 2 Actions for Instruments 3 and 4, select some other PC, for example 20 ("Reed organ") and 50 ("Syn strings").
You can now turn the knob and see the Instrument is changing.
This result is not good for recording, it sends MIDI every time you turn the knob, even when that does not change the Instrument. That can be solved, but that will complicate the example. And you probably is not going to use that for recording in any case, it will be better to assign separate button (or button combination!) for that.
It is possible just use MIDI value (0-127) from knob to send corresponding PC message, AZ Controller can construct arbitrary MIDI/SysEx messages dynamically. It is even possible to send messages to up to 4 different MIDI devices using Master/Slave feature of AZ Controller.
Thanks for reading!
If you have any questions, I am happy to answer them in the Discussion section.