User Forum :: Powered by YaBB
« MIDI-OX User Forum - Example of jScript: NoteOn toggle »
Welcome, Guest. Please Login or Register.
Jul 15th, 2024, 11:16am


Home Home Help Help Search Search Members Members Login Login Register Register


   MIDI-OX User Forum
   MIDI-OX
   Scripting Questions
(Moderator: Jamie OConnell)
   Example of jScript: NoteOn toggle
« Previous topic | Next topic »
Pages: 1  Reply Reply Notify of replies Notify of replies Send Topic Send Topic Print Print
   Author  Topic: Example of jScript: NoteOn toggle  (Read 304 times)
Breath
Administrator
*****





   
WWW

Gender: male
Posts: 1006
Example of jScript: NoteOn toggle
« on: Jul 10th, 2022, 11:45pm »
Quote Quote Modify Modify

I have often been asked about how to use Midi to turn something on or off with the same message.
That would mean that MidiOx would have to remember if that message had come in before.
MidiOx data map can't do that, but a script can.
 
Here is an script in jScript (Microsoft built in interpreter) example where pressing Middle C (C4) mutes the same channel as the note came in by (CC7 =0)
Pressing C4 again sets CC7 to the velocity of the C4 note. ie turns the volume back on.
You could add to this to set up a real time controller of several keys in one area of the keyboard to mute different channels of, say, a sequencer.
https://bwalk.com.au/pub/RPC_ToggleNote2CC.js
 
1) Download the code and press Ctrl A to select all the text and press Ctrl C to copy
2) Paste in an editor (Notepad++ is a good free editor that will colour the code to make it more understandable).
3) Save the text file as "RPC_noteOn2Mute.js"
4) Go to where you have saved it and double click on the name to start the script
5) a new MidiOx will popup (if MidiOx is already running this script will use this)
 - make sure your keyboard's Midi input and output can be seen on the MIDI Port Routing window.
 - connect the MidiOX Event Port to your synth Midi port on the right side (Midi Out).
6) play some notes (NOT Middle C - note 60) to see the data being sent
 - play Middle C and MidiOx will put out CC7 value 0 and mute you synth
 - play other notes to check it is muted  
 - play middle C again and CC7 will be put out again with a value of the velocity of Middle C just played
5) Click OK on the small dialog that just popped up to stop it all.
 
Let me know if this is useful.
 
All the best
Royce
 
« Last Edit: Jul 12th, 2022, 8:42pm by Breath » IP Logged
Pages: 1  Reply Reply Notify of replies Notify of replies Send Topic Send Topic Print Print

« Previous topic | Next topic »


MIDI-OX User Forum » Powered by YaBB 1 Gold - SP 1.3.1!
YaBB 2000-2003. All Rights Reserved.