Script Examples

[ (press) {cc:1,23,64}{pc:2,15}{image:%trevligaspel%\MyIcons\Icon1.png}{text:Hello\nWorld} ]
[ (release) {cc:1,23,0}{image:#none#}{text:#none#} ]

  • When the button is pressed, the value 64 is sent for CC23 on channel 1, Program Change 15 is sent on channel 2, image Icon1.png is displayed, and the text "Hello World" (on two lines) is displayed.

  • When the button is released, value 0 is sent for CC23 on channel 1, and the image and text are removed from the button.

[ (press) {noteon:1,12,127}{text:Hello} ]
[ (press) {noteoff:1,12,127}{text:World} ]
[ (cc:2,57,0-64) {image:%trevligaspel%\MyIcons\Icon1.png} ]
[ (cc:2,57,65-127) {image:%trevligaspel%\MyIcons\Icon2.png} ]

  • At the first button, press a Note On for channel 1, note 12 with velocity 127 is sent, and the text "Hello" is displayed.

  • At the second button, press a Note Off for channel 1, note 12 with velocity 127 is sent, and the text "World" is displayed.

  • Subsequent button presses will toggle between the above actions.

  • Whenever a CC57 is received on channel 2, Icon1.png will be displayed if the value is between 0-64, and Icon2.png is displayed if the value is between 65-127.

[ (cc:1,16,127) {pc:1,12} ]
[ (cc:1,17,64) {cc:4,1,64} ]

  • Whenever a CC16 with value 127 is received on channel 1, a Program Change 12 is sent on channel 1.

  • Whenever a CC17 with value 64 is received on channel 1, a CC1 with value 64 is sent on channel 4.

  • No actions are performed on button press or release.

[ (cc:1,1,0-127) {text:#value#} ]
[ (press) {cc:2,23,0}{image:%trevligaspel%\MyIcons\Icon1.png} ]
[ (press) {cc:2,23,127}{image:%trevligaspel%\MyIcons\Icon2.png} ]

  • At the first button press, a CC23 with value 0 is sent on channel 2, and Icon1.png is displayed.

  • At the second button press, a CC23 with value 127 is sent on channel 2, and Icon2.png is displayed.

  • Subsequent button presses will toggle between the above actions.

  • Whenever a CC1 is received on channel 1, the received value is displayed.

[ (init) {image:%plugin%\Extras\Icons\Generic.png} ]
[ (cc:1,10,0) {cc:2,23,0}{image:%plugin%\Extras\Icons\Mute_Active_Fade.png}{cc:1,11,127}{text:#none#} ]
[ (cc:1,10,>1>) {cc:2,23,127}{image:%plugin%\Extras\Icons\Generic.png}{cc:1,11,0} ]
[ (cc:1,10,127) {image:%plugin%\Extras\Icons\Solo_Active_Fade.png}{cc:1,12,127}{text:#none#} ]
[ (cc:1,10,<126<) {cc:2,23,127}{image:%plugin%\Extras\Icons\Generic.png}{cc:1,12,0} ]
[ (cc:1,10,1-126) {text:#value#} ]

  • This script assumes CC10 to be a volume fader, CC11 to be Mute and CC12 to be Solo,

    • When the button is loaded, the image Generic.png will be displayed. (Happens when Stream Deck starts and when the profile/page/folder with the button is activated. The button is unaware of any potential state it might have had if the profile/page/folder had been active before.)

    • When CC10 value 0 is received (volume=0), CC11 value 127 is sent (Mute on), image Mute_Active_Fade.png is displayed, and the text is cleared.

    • When CC10 transitions from a value lower than 1 (i.e., 0) to 1 or higher, CC11 value 0 is sent (Mute off), and the image Generic.png is displayed.

    • When CC10 value 127 is received (volume=max), CC12 value 127 is sent (Solo on), image Solo_Active_Fade.png is displayed, and the text is cleared.

    • When CC10 transitions from a value higher than 126 (i.e., 127) to 126 or lower, CC12 value 0 is sent (Solo off), and the image Generic.png is displayed.

    • When a CC10 value between 1-126 is received, the value is displayed.

    • When the button is pressed, nothing happens.

[ (press) {noteon:2,23,127} ]
[ (press) {cc:2,23,0}{noteoff:2,23,127} ]

  • Use the (default) channel numbering in the example above if the daw/device you are connected to displays midi channels in the range 1-16. Midi channel 2 (as in the example) will be displayed as channel 2 in both the script and the connected daw, but channel 1 will be used on the protocol level.

  • Use the channel numbering in the example below if the daw/device you are connected to displays midi channels in the range 0-15. Midi channel 2 (as in the example) will be displayed as channel 2 in both the script and the connected daw, and channel 2 will be used on the protocol level.

[ (press) {noteon:2,23,127} ]
[ (press) {cc:2,23,0}{noteoff:2,23,127} ]
[ (config) {firstmidichannel:0} ]

[ (press) {cc:1,4,127} ]
[ (release) {state:1} ]
[ (press) {cc:1,4,0} ]
[ (release) {state:0} ]
[ (cc:1,4,0) {state:0}{nextpress:1} ]
[ (cc:1,4,127) {state:0}{nextpress:2} ]

  • This script assumes CC4 to be something with toggle functionality, e.g., cycle mode. Icons are set in the Stream Deck editor, and the button state controls whether the active or inactive icon is displayed. If the state is changed in the daw, the {nextpress} actions ensure that the next button press will toggle the state as received from the host, not as set by the latest button press.

    • When the button is pressed, the function in the daw will be toggled, and the button state will be set accordingly to display the correct state on the button.

    • The button state is set in the {release} events to avoid having it automatically toggled by the Stream Deck software. (if it were set in the {press} event, I had to set it to the "wrong" state since it would be automatically toggled when the button is released)

    • If the state is changed in the daw, the button state is set accordingly, and the {nextpress} action is used to control which {press} event will be triggered the next time the button is used.