Switch Panel Tabs with incoming midi message

Scripting Question:
I have created a panel with multiple tabs, I would like to be able to switch(change) to a specific tab on the panel when it receives a specific midi input message sent from an outside DAW. Is this possible?

I'm still learning basic scripting in OSC, so any help will be greatly appreciated. Thank you!

hi, yes you have to use a custom module, basic examples can be found in the documentation.
The question about switching the toolbar has allready been asked here(if i remember correctly), i have not done that myself...
hope this helps

Hi

Maybe no need for custom module.
Edit : sorry but indeed as you want to trigger when receiving a midi signal as @abstrus said you have to use custom module. @abstrus do you confirm ?

Maybe this post can help you.

I haven't tried.
Good luck

Hi, yes it should be

receive('/TABS','tabsId');

have not tried that one (according to: Remote control - Open Stage Control)

Thank you both for your replies and assistance. After several weeks of studying I've found some information regarding creating a Custom Module for my purposes. My goal is to achieve Tab switching in OSC, by specific track selection in Cubase. I've learned this is a complicated process.

  1. Setup a generic remote in Cubase to send out midi cc127 to OSC when I select a track.
  2. When OSC receives the cc127 message, the custom module sends back midi cc126 to Cubase.
  3. Create Midi Transformers on the Midi tracks in Cubase that transform the incoming midi cc126 from OSC to selected values midi cc117-125 with values set to 0-127, and send this back to OSC.

Using some preexisting examples I've found, I have managed to achieve steps 1-3 above. Now when I debug I can see I am receiving the correct midi messages in OSC:

(DEBUG,MIDI) in: CONTROL_CHANGE: channel=1, cc=117, value=0 From: midi:CUBASEtoOSC
(DEBUG,OSC) in: {address: '/control',args:[1,117,0] ) From: midi:CUBASEtoOSC

Question Now is - how do I take this incoming midi information and apply it to the panel tabs. So that each tab will switch when it receives a specific midi message?

Here is the edited Custom Module I'm using: ( 'OSCtoCUBASE' is my midi connection)

module.exports = {

    oscInFilter:function(data)
	{
        var {address, args, host, port} = data

        if (address !== '/control') return
		if (args[1].value < 117) return
		if (args[1].value == 127) 
			{
			send('midi', 'OSCtoCUBASE', '/control', 1,126,1)
			return
			}	
	return {address, args, host, port}
	},
}

Maybe a script widget could work ?

  1. create a script widget
  2. set address to "/control" and "target" to your OSC midi input
  3. set "pre args" to the incoming midi channel and cc value
  4. In the script field write: set(widgetID, yourValue)

Regards, mj

Hi mj,

Thank you for your reply.
I couldn't get this to work. My best guess is that it needs to be a conditional statement.
For example:
if receive args:[1,117,1] then select Tab_01
if receive args:[1,117,2] then select Tab_02
if receive args:[1,117,3] then select Tab_03

Doesn't that make sense?

Hi, yes, that makes sense

if (condition 1) {
---do something---
} else if (condition 2) {
---do something else---
} else {
---do something else---
}

Although I don't know how you would need to write the condition... ;-/. Regards, mj

Well, I have no programming skills except for trial and error and google, copy, paste :wink: And I never used a Custom module. But here's a little template that may help. There's a panel with 2 tabs and a script that toggles the tabs depending on incoming cc messages (Channel, CC, Value).
A value of 127 selects tab 1, a value of 15 selects tab 2.
Test Script On MIDI In.json (4.7 KB).

HaHa! We're in the same boat :laughing:
I did make a lot of progress today (with jean-emmanuel's help!). I now have everything working as hoped. Here's the link to our discussion:

Here's the current Custom Module I'm using:

module.exports = {

    oscInFilter:function(data)
	{
        var {address, args, host, port} = data
		if (address === '/control' && args[1].value == 127) {
			send('midi', 'OSCtoCUBASE', '/control', 1,126,1)
			receive('/panel_articulations', 0)
			receive('/panel_controls', 0)
			return
		}
		if (address === '/control' && args[1].value == 117) {
		if (args[2].value === 0) {
			receive('/panel_articulations', 0) // 0 = first tab			
		} else if (args[2].value === 1) {
			receive('/panel_articulations', 1)
			receive('/panel_controls', 1)
		} else if (args[2].value === 2) {
			receive('/panel_articulations', 2)
			receive('/panel_controls', 2)	
		} else if (args[2].value === 3) {
			receive('/panel_articulations', 3)
			receive('/panel_controls', 3)	
		} else if (args[2].value === 4) {
			receive('/panel_articulations', 4)	
		} else if (args[2].value === 5) {
			receive('/panel_articulations', 5)	
		} else if (args[2].value === 6) {
			receive('/panel_articulations', 6)			
    }
		return // bypass  cc 117
}
	return {address, args, host, port}
	},
}
1 Like

Hi,

This thread is super helpful as I'm trying to setup the same thing coming from Lemur.
Curious though, is it possible to achieve this without a custom module?

I'm trying to set this up a way I had in Lemur which is where a fader receives the midi message from my DAW. Then there are basic if/else statements similar to the above response that are attached to the fader.

Basically the script on the fader looks like this:
if(value===1){set ('panel_libraries', 0)}
if(value===2){set ('anel_libraries"', 1)}
....and so on.

I only ask because in a blank OSC template I'm able to get this to function but currently having trouble in the session template that I've been working on. So maybe I've misunderstood something.

@rmjmusic This solution should work too.