Today’s build (3574) introduces a group of changes all related to the the on-screen keyboard, the controller bar and variable string expansions.
This post is a little technical but provides some neat ways to reflect state in Cantabile’s main window.
The Onscreen Keyboard
The most obvious aspect of Cantabile’s onscreen keyboard is the panel that looks like a piano keyboard:
In reality however, the onscreen keyboard is actually more than just this user-interface:
- Under the covers, it’s a MIDI device that can be interacted with just like any other MIDI device and be connected to any MIDI Input or MIDI Output port (in Options -> MIDI Ports).
- You can send MIDI data from the onscreen keyboard by playing it.
- It can receive MIDI data which will be shown as highlighted notes.
- Custom buttons on the controller bar can be configured to send MIDI — which will also be sent via the on-screen keyboard device.
- The quick controller can send MIDI events — again, these will be sent via the on-screen keyboard device.
The Controller Bar now Receives MIDI
Until today’s build the controller bar could send MIDI but didn’t respond to received MIDI events.
Now it does:
- For controller bar buttons configured as momentary buttons or toggle buttons, they will light up if the onscreen keyboard receives a MIDI event that matches the configured pressed controller value. (typically 127)
- For sliders, the slider will move to the newly received value and for a short period will show the received value in the corner of the button.
MIDI Controller Variables
Today’s build also introduces a set of new “variables” that can be used anywhere text expansion strings are supported.
Eg: suppose you created a show note with the following text:
$(cc(64)) part would be expanded to onscreen keyboard’s current value for CC#64 (ie: the damper pedal) and show 127 when pressed and 0 when released.
You’re not just limited to CC’s however — you can use any of the following:
By default, each of these will return the current value for MIDI channel 1. For other channels, you can specify it as an optional parameter.
eg: to get CC 64 on channel 3:
or to get the pitch bend on channel 5:
Use in the Controller Bar
Besides Show Notes, the other place you might like to use these variables is in the Tip or Caption fields of custom Controller Bar buttons:
Now that button will reflect the current value of CC 16 and will update when you either move the slider, or if the onscreen keyboard receives a CC16 MIDI message:
In all the examples above, I’ve just used a single variable inside the $() delimeters. You can however create complex expressions.
eg: this expression would display CC #7 as a value between 0 and 10.
$(cc(7) * 10.0 / 127)
Since this number will probably have many decimal places, you can use the formatNumber function to control its formatting. The “N2” parameter means to format with 2 decimal places.
$(formatNumber(cc(7) * 10.0 / 127, "N2"))
Another common use for expressions is to display one of two possible values.
eg: displaying if the damper pedal is pressed:
$(cc(64) > 63 ? "Down" : "Up")
This expression basically says if the current value of CC #64 is greater than 63 then display the word “Down”, otherwise the word “Up”.
If you’re trying to display program numbers, you can use the formatProgramNumber function to format the program number value using Cantabile’s current settings for program number formatting. (With out this, program numbers are always zero based integer values).
Selected Program Number: $(formatProgramNumber($(program()))
might display as:
Selected Program Number: 023
The final little tweak in today’s build is an easy way to duplicate an existing button: just right click on it and you’ll see a new menu item “Duplicate Button…”:
For a complete reference on all of the above, please see: