Jump to content

Set the Modulation Wheel Value via Scripter


Go to solution Solved by gacki,

Recommended Posts

Hi all,

I want to use the Scripter plugin to change the value of the Modulation Wheel when a specific button or note on the Keyboard is pressed. In the screenshot below you can see what I tried but it does not work as expected. When I press the key C5 (pitch equals 84), the Scripter shows me that the mod wheel value was set to 20 but I can see that the value of the mod wheel controller did not change.
Can you tell me what I'm doing wrong or how I can achieve that?

Thanks in advance for your support!


Edited by Guilian
Link to comment
Share on other sites

Thx for your reply gacki. I'am using the modwheel to control the dynamic of several sounds. This is why I have this fader which is splitted in song sections. For example some sounds should be louder in a Chorus than in a Verse. Therefore there is a Gain Plugin on the Channel Strips which are controlled by the Mod Wheel. The problem with using the Mod Wheel in my case it that sometimes it is difficult to bring it to the desired section because it is very sensitive. That's why I was thinking about using a Key or a button on the Keyboard to switch between the song sections and having the same effect on sounds dynamic as I'm using the Mod Wheel. So by clicking this button/key, I would lie to see that the Mod Wheel value also changes in Mainstage. I hope my goal is a little clearer.

Picture (1).png

Link to comment
Share on other sites

  • Solution

So here's how I would approach this. Depending on the whole setup it might be a bit cumbersome, though.

First step: Create a "MIDI Activity" control in Layout mode, assign the controller keyboard you want to use to it and give it an unique name. In my case the controller keyboard is a Keystation 49e; and I called the control "MIDI IN".


Next, create a new IAC bus in the Audio-MIDI-Setup application. You could also use the existing one. I've called mine "Mainstage" just to keep everything neat and tidy.


Now assign you current keyboard/modwheel/... controls to that IAC bus.


Make sure to set the MIDI channels so that it matches your use case.

So what we've done so far is to basically split the MIDI connection: The data coming in from the controller is now going to the "MIDI IN" control and the screen controls wait for MIDI data coming from the IAC bus.

What we need to do now is to somehow connect those two parts again - and in this connection we then can insert the Scripter to manipulate the data. How exactly we're going to do this depends on your specific needs.

Let's imagine you basically want to have this ability for your whole concert.

Go the the concert level. Add an "External Instrument" channel strip (you'll get asked if you really want to do this). Set it up like this:


So the MIDI Input to this channel strip is coming from the "MIDI Activity" control (basically: from your controller); and the MIDI Output goes the IAC bus (in my case named Mainstage) and so basically to the screencontrols previously directly assigned to your controller.

The whole connection now goes like this: controller->"MIDI activity" control -> channel strip -> IAC bus -> screen controls (and from there to the Patches).

Now we can insert the Scripter and run your script. However I made one modification here:

function HandleMIDI(event)
	if (event instanceof NoteOn && event.pitch == 84)
		var modwheel = new ControlChange();
		modwheel.channel = 5;
		modwheel.number = 1;
		modwheel.value = 20;


Without the additional event.send() nothing will pass except that one single modwheel value. Right now everything passes except that one note used to create the modwheel value.

All this works fine for me: I can move the modwheel and pressing C5 will always set it to 20.

The beauty of this approach is that it works immediately for all Patches. No need to do anything else.

The problem of this approach is that it works immediately for all Patches - and that might not be desired. If this is the case we need to move the connection away from the Concert level and into all individual patches instead. Then you can decide from Patch to Patch individually whether you want to use the Scripter or not. But you'll need to add that particular "External Instrument" channel strip in any case to establish the connection between "MIDI IN" and the IAC bus - either globally on the Concert level or individually on the Patch level.


  • Like 2
Link to comment
Share on other sites

Thanks for this very detailed solution. That's really amazing!
I have gone through all the steps and am facing the following issues:

- When I move the mod wheel from my Keyboard, sometimes I can see that the value of mod wheel  in Mainstage is also changing, sometimes it behaves like it is frozen/buggy and sometimes and sometimes nothing happens.

- When I press C5, sometimes the value of the modwheel in Mainstage is set to 20 and sometimes nothing happens even though the scripter shows me that there is ControlChange

Because I know that it could be difficult to understand the problems I'm trying to describe, I recorded a short movie of my screen where you can see everything I described above. You can download it here: https://we.tl/t-2Mja7fJyXO

Am I doing something wrong in the MIDI Channel Settings?


Picture 1.png

Picture 2.png

Picture 3.png

Link to comment
Share on other sites

As far as I can see you only followed part of my solution.

You need to "intercept" the data from your hardware controller keyboard with the "MIDI Activity" control first. I don't see any "MIDI Activity" control in your setup...

You also need to assign your screen controls (for example the one named "Keystation49 MK3) to the IAC bus instead of your hardware controller.

Once you've done this you shouldn't get any reaction from your hardware controller anymore (without the "External Instrument" strip). Now add that "External Instrument" strip, set its MIDI Input to the "MIDI Activity" control one and its output to the IAC bus. This will basically restore the previous functionality but now with the ability to manipulate the data before it gets to the screen controls.

But the key functionality is to break the connection between hardware controller and the previous screen controls and re-route it through an "External Instrument" channel strip.

(Falls das nicht klappt, können wir ggf. auch eine Teamviewer-Session machen.)

  • Like 1
Link to comment
Share on other sites

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.

Reply to this topic...

×   Pasted as rich text.   Restore formatting

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.


  • Create New...