Old 02-03-2018, 02:11 AM   #1
pipelineaudio
Mortal
 
pipelineaudio's Avatar
 
Join Date: Jan 2006
Location: Wickenburg, Arizona
Posts: 14,047
Default Script for send MIDI CC action?

Is there an existing script that can make an action to send a CC# a certain value?

For that matter is there a repository of scripts some place?
pipelineaudio is offline   Reply With Quote
Old 02-03-2018, 05:08 PM   #2
pipelineaudio
Mortal
 
pipelineaudio's Avatar
 
Join Date: Jan 2006
Location: Wickenburg, Arizona
Posts: 14,047
Default

Whats wrong with this eel script?
"
/*
Send MIDI CC channel 1 cc10 value 0
*/
// EEL Script for Reaper
// Author: pipelineaudio

function main ()
(
StuffMIDIMessage(0, 1, 10, 0);
);

main ();
"

I'm not seeing anything in the MIDI monitor on run
pipelineaudio is offline   Reply With Quote
Old 02-04-2018, 12:12 AM   #3
mschnell
Human being with feelings
 
mschnell's Avatar
 
Join Date: Jun 2013
Location: Krefeld, Germany
Posts: 14,688
Default

You say "Script" and hence you don't seem to mean "JSFX" (even though this of of course is script, as it is compiled at load time), but a ReaScript. (At best you'd edit the Track title for clearness.)

Even if a ReaScript would send a Midi message, same is created in the "Reaper Control Path" Midi bus.

AFAIK, the only way to get Midi messages from the "Reaper Control Path" Midi bus into the "real World" is using a track and as the track's midi input define the "virtual keyboard". (But I never tried yet.)

BTW.: Vice-versa, to route Midi from the "real world tracks" to the Reaper Control Path, the MidiToReaContrlPath VST needed to be is used.

-Michael

Last edited by mschnell; 02-04-2018 at 12:19 AM.
mschnell is online now   Reply With Quote
Old 02-04-2018, 01:25 AM   #4
mpl
Human being with feelings
 
mpl's Avatar
 
Join Date: Oct 2013
Location: Moscow, Russia
Posts: 3,960
Default

Make sure you have track record arm enabled, monitoring turned on and track input was set to MIDI input from Virtual Keyboard
Code:
/*
Send MIDI CC channel 1 cc10 value 0
*/
// EEL Script for Reaper
// Author: pipelineaudio

/*
8 = Note Off 
9 = Note On 
10 = AfterTouch (ie, key pressure) 
11 = Control Change 
12 = Program (patch) change 
13 = Channel Pressure 
14 = Pitch Wheel
*/

msg_type = 11; // CC
channel = 0;
function main ()
(
StuffMIDIMessage(0, msg_type*16 + channel, 10, 0);
);

main ();

Last edited by mpl; 02-04-2018 at 01:30 AM.
mpl is offline   Reply With Quote
Old 02-04-2018, 02:27 AM   #5
pipelineaudio
Mortal
 
pipelineaudio's Avatar
 
Join Date: Jan 2006
Location: Wickenburg, Arizona
Posts: 14,047
Default

Holy crap that works!!!!!!!!!! Thank you sooo sooo much!!!!

I'm surprised more people didn't need this function, it can do so much!

I'm going to attempt to understand it better so I can change the values and do program changes too if possible, you are the uber dude!!!!!!!!!!!!!!
pipelineaudio is offline   Reply With Quote
Old 02-04-2018, 04:42 PM   #6
pipelineaudio
Mortal
 
pipelineaudio's Avatar
 
Join Date: Jan 2006
Location: Wickenburg, Arizona
Posts: 14,047
Default

MPL, you seriously rule!!!!!!!!!!!!!

While I might temporarily have your ridiculously oversized brain's attention, can you think of a way to make a wah auto engage in reaper?

Some gear like axe fx or apps like tonestack do it like: cc#11 x>11 wah turns on, cc# 11 controls the sweep of the wah. If it goes x<5 the wah turns off. Some of the gear has dwell times to turn on or off as well, but I'm looking for something basic, even if no overlap

I was thinking say the JS wah. Control the wet dry control to turn it on and off and the CC also controls the position. Somehow it would have to see cc#11 0-10 as 100% dry and CC#11 11-127 as 100% wet, I think, not sure how to do it
pipelineaudio is offline   Reply With Quote
Old 02-04-2018, 11:10 PM   #7
mschnell
Human being with feelings
 
mschnell's Avatar
 
Join Date: Jun 2013
Location: Krefeld, Germany
Posts: 14,688
Default

Supposedly no additional plugin necessary.

Should be doing by having Reaper assign the appropriate effects "dry/wet" parameter to the CC and impose a very steep linear function.

(AFAIK, the CC message needs to be in the track's Midi stream and not in the "Reaper Control Path" Midi stream to be assigned to an effect parameter in that way.)

-Michael
mschnell is online now   Reply With Quote
Old 02-05-2018, 12:19 AM   #8
mpl
Human being with feelings
 
mpl's Avatar
 
Join Date: Oct 2013
Location: Moscow, Russia
Posts: 3,960
Default

Quote:
Originally Posted by pipelineaudio View Post
cc#11 x>11 wah turns on
cc# 11 controls the sweep of the wah
goes x<5 the wah turns off
I`m not sure about condition since area [5...11] is undefined.
For the focused FX it will look like this.
Depending on vst/js you need to define ID of your sweep parameter manually - switch FX plugin view to sliders only with "UI" button from the right side on IO plugin pins setup, then edit respective number of slider you want to control.

Code:
wah_sweep_param_ID = 1

_,_,_,_,mode,_,val = reaper.get_action_context()
if mode == 0 then 
  if val < 11 then switch = 0 else switch = 1 end
  retval, trackID, _, fx  = reaper.GetFocusedFX()
  if retval == 1 then
    tr =  reaper.CSurf_TrackFromID( trackID, false )
    if tr then
      param_cnt = reaper.TrackFX_GetNumParams( tr, fx ) -1
      reaper.TrackFX_SetParam( tr, fx , param_cnt, switch)      
      if switch == 1 then reaper.TrackFX_SetParam( tr, fx , wah_sweep_param_ID-1, (val-11)/117) end
    end
  end
end
and assign this lua script to CC control.

Last edited by mpl; 02-05-2018 at 12:26 AM.
mpl is offline   Reply With Quote
Old 02-05-2018, 12:39 AM   #9
pipelineaudio
Mortal
 
pipelineaudio's Avatar
 
Join Date: Jan 2006
Location: Wickenburg, Arizona
Posts: 14,047
Default

Quote:
Originally Posted by mpl View Post
Code:
wah_sweep_param_ID = 1

_,_,_,_,mode,_,val = reaper.get_action_context()
if mode == 0 then 
  if val < 11 then switch = 0 else switch = 1 end
  retval, trackID, _, fx  = reaper.GetFocusedFX()
  if retval == 1 then
    tr =  reaper.CSurf_TrackFromID( trackID, false )
    if tr then
      param_cnt = reaper.TrackFX_GetNumParams( tr, fx ) -1
      reaper.TrackFX_SetParam( tr, fx , param_cnt, switch)      
      if switch == 1 then reaper.TrackFX_SetParam( tr, fx , wah_sweep_param_ID-1, (val-11)/117) end
    end
  end
end
and assign this lua script to CC control.
Thanks mpl! I'm trying to understand this. I think it would be best done in JS, I made a simplified psuedocode of it here: https://forum.cockos.com/showthread.php?t=202857
pipelineaudio is offline   Reply With Quote
Old 04-26-2019, 02:08 AM   #10
cjewellstudios
Human being with feelings
 
Join Date: Sep 2017
Posts: 998
Default

Quote:
Originally Posted by mpl View Post
Make sure you have track record arm enabled, monitoring turned on and track input was set to MIDI input from Virtual Keyboard
Code:
/*
Send MIDI CC channel 1 cc10 value 0
*/
// EEL Script for Reaper
// Author: pipelineaudio

/*
8 = Note Off 
9 = Note On 
10 = AfterTouch (ie, key pressure) 
11 = Control Change 
12 = Program (patch) change 
13 = Channel Pressure 
14 = Pitch Wheel
*/

msg_type = 11; // CC
channel = 0;
function main ()
(
StuffMIDIMessage(0, msg_type*16 + channel, 10, 0);
);

main ();
Just wanted to say thanks a million for writing this. I tried to modify it to be able to change the banks on my MF Twister. It failed because I didn't save it as an EEL file to start, but I only found that out thanks to another forum post where you were helping out someone else. Now it works like a charm, so awesome! Thank you very much MPL!
cjewellstudios is offline   Reply With Quote
Old 05-27-2022, 01:03 PM   #11
Miscreant
Human being with feelings
 
Miscreant's Avatar
 
Join Date: Mar 2012
Posts: 375
Default

I'm popping into this thread after kindly being directed here by Xpander.

I am wondering whether it is possible to create custom actions that send automated MIDI messages to my Axe FX, such as picking particular presets (to start).

For example, say a Fender amp is in Preset 001 on my Axe. Say I then create a midi track, open the MIDI editor, open the bank/program select lane, and create a marker at measure 2 to change the Axe from preset 002 to preset 001.

Would the script offered in this thread allow me to now take this just-created bank/program change and turn it into a custom action, where whenever this action runs this program change is effected in the Axe?
Miscreant is offline   Reply With Quote
Old 05-27-2022, 01:19 PM   #12
mschnell
Human being with feelings
 
mschnell's Avatar
 
Join Date: Jun 2013
Location: Krefeld, Germany
Posts: 14,688
Default

How do you intend to trigger that action ?

-Michael
mschnell is online now   Reply With Quote
Old 05-27-2022, 01:20 PM   #13
Miscreant
Human being with feelings
 
Miscreant's Avatar
 
Join Date: Mar 2012
Posts: 375
Default

Quote:
Originally Posted by mschnell View Post
How do you intend to trigger that action ?

-Michael
With a button/image in a floating toolbar, likely.
Miscreant is offline   Reply With Quote
Old 05-27-2022, 10:17 PM   #14
Puck
Human being with feelings
 
Puck's Avatar
 
Join Date: Feb 2022
Location: Almost Canada
Posts: 505
Default

Quote:
Originally Posted by Miscreant View Post
I'm popping into this thread after kindly being directed here by Xpander.

I am wondering whether it is possible to create custom actions that send automated MIDI messages to my Axe FX, such as picking particular presets (to start).

For example, say a Fender amp is in Preset 001 on my Axe. Say I then create a midi track, open the MIDI editor, open the bank/program select lane, and create a marker at measure 2 to change the Axe from preset 002 to preset 001.

Would the script offered in this thread allow me to now take this just-created bank/program change and turn it into a custom action, where whenever this action runs this program change is effected in the Axe?
Is the AxeFX hooked up as a midi output device in Reaper?

....

Also, to clarify, do you want to be able to trigger these actions from a midi track during playback? That's what it seems like in this first post here, but your second made it sound like you were good with it being just a button. Also maybe a marker action? Sorry, it was unclear what you wanted.

Either way, the script that sends a program change (example below) can be triggered however you want as long as the AxeFX is hooked up as a midi out in Reaper:

Code:
/*
Send Program Change to AxeFX
*/
// EEL Script for Reaper

/*
8 = Note Off 
9 = Note On 
10 = AfterTouch (ie, key pressure) 
11 = Control Change 
12 = Program (patch) change 
13 = Channel Pressure 
14 = Pitch Wheel
*/

msg_type = 12; // Program Change
channel = 0;
function main ()
(
StuffMIDIMessage(0, msg_type*16 + channel, 10, 0);
);

main ();
I highlighted the bits that are important to change.

The first two red colors are message type and channel. For msg_type, there's a key just above all that where I've underlined '12 = Program Change". So since you want one of those, we change msg_type to 12. For channel; 0 = midi channel 1 so 15 would be channel 16.

The last two red bits are the other two bytes in the midi message. I don't know program changes well enough to know what to put there. I assume 0 and 127 (0 meaning program change 1 and 127 would be "on") would be preset number 001 on the AxeFX but that's just a guess.

The blue bit is an important one, and it's a bit confusing. From the reascript API:
Code:
16 for external MIDI device 0, 17 for external MIDI device 1, etc
So if the AxeFX is your first midi output device (I think you can right click on it and change the order) than you would put 16 for the blue argument.

Edit: you have to save the script as a .eel file

Last edited by Puck; 05-27-2022 at 10:36 PM.
Puck is offline   Reply With Quote
Old 05-28-2022, 12:29 AM   #15
mpl
Human being with feelings
 
mpl's Avatar
 
Join Date: Oct 2013
Location: Moscow, Russia
Posts: 3,960
Default

there is GetMIDIOutputs so you can get midi device ID by name wherever order it placed in device list
mpl is offline   Reply With Quote
Old 05-28-2022, 07:45 AM   #16
Miscreant
Human being with feelings
 
Miscreant's Avatar
 
Join Date: Mar 2012
Posts: 375
Default

Quote:
Originally Posted by Puck View Post
Is the AxeFX hooked up as a midi output device in Reaper?

....

Also, to clarify, do you want to be able to trigger these actions from a midi track during playback? That's what it seems like in this first post here, but your second made it sound like you were good with it being just a button. Also maybe a marker action? Sorry, it was unclear what you wanted.

Either way, the script that sends a program change (example below) can be triggered however you want as long as the AxeFX is hooked up as a midi out in Reaper:

Code:
/*
Send Program Change to AxeFX
*/
// EEL Script for Reaper

/*
8 = Note Off 
9 = Note On 
10 = AfterTouch (ie, key pressure) 
11 = Control Change 
12 = Program (patch) change 
13 = Channel Pressure 
14 = Pitch Wheel
*/

msg_type = 12; // Program Change
channel = 0;
function main ()
(
StuffMIDIMessage(0, msg_type*16 + channel, 10, 0);
);

main ();
I highlighted the bits that are important to change.

The first two red colors are message type and channel. For msg_type, there's a key just above all that where I've underlined '12 = Program Change". So since you want one of those, we change msg_type to 12. For channel; 0 = midi channel 1 so 15 would be channel 16.

The last two red bits are the other two bytes in the midi message. I don't know program changes well enough to know what to put there. I assume 0 and 127 (0 meaning program change 1 and 127 would be "on") would be preset number 001 on the AxeFX but that's just a guess.

The blue bit is an important one, and it's a bit confusing. From the reascript API:
Code:
16 for external MIDI device 0, 17 for external MIDI device 1, etc
So if the AxeFX is your first midi output device (I think you can right click on it and change the order) than you would put 16 for the blue argument.

Edit: you have to save the script as a .eel file
Thanks for taking the time to write this really helpful post.

To answer your q's:

1. Yes, the Axe is connected as a midi output device in Reaper.

2. By inserting program changes, I can already effect program changes in the Axe from Reaper automatically during playback. So now I want to go further and be able to take this midi program change and make it an action, such that I can run the action (midi program change) from a toolbar, even without Reaper in playback. (E.g. to select different Axe presets from within Reaper.)

So, now, with respect to the .eel code you've provided:

I am new to this, so I don't expect anyone to spend their time explaining it to me in here. I know where I can find resources to understand scripting in Reaper. But with respect to mpl's suggestion that I can use <GetMIDIOutputs> instead, I take it that this command would replace the <StuffMIDIMessage> command in your code (as well as, then, the details in parentheses).

But okay, it looks like I have my homework cut out for me here. Need to do some reading.
Miscreant is offline   Reply With Quote
Old 05-28-2022, 08:36 AM   #17
Miscreant
Human being with feelings
 
Miscreant's Avatar
 
Join Date: Mar 2012
Posts: 375
Default

I see this is the function mpl has recommended be replaced in the offered code:

bool GetMIDIOutputName(int dev, #nameout)

I'm looking at the ReaScript API, as well as Reaper's EEL2 page, and I am not seeing any instructions about how to interpret this syntax.

Where can I go to learn about what the variables in parentheses mean, such that I can replace them?
Miscreant is offline   Reply With Quote
Old 05-28-2022, 08:39 AM   #18
Puck
Human being with feelings
 
Puck's Avatar
 
Join Date: Feb 2022
Location: Almost Canada
Posts: 505
Default

Quote:
Originally Posted by Miscreant View Post
Thanks for taking the time to write this really helpful post.

To answer your q's:

1. Yes, the Axe is connected as a midi output device in Reaper.

2. By inserting program changes, I can already effect program changes in the Axe from Reaper automatically during playback. So now I want to go further and be able to take this midi program change and make it an action, such that I can run the action (midi program change) from a toolbar, even without Reaper in playback. (E.g. to select different Axe presets from within Reaper.)

So, now, with respect to the .eel code you've provided:

I am new to this, so I don't expect anyone to spend their time explaining it to me in here. I know where I can find resources to understand scripting in Reaper. But with respect to mpl's suggestion that I can use <GetMIDIOutputs> instead, I take it that this command would replace the <StuffMIDIMessage> command in your code (as well as, then, the details in parentheses).

But okay, it looks like I have my homework cut out for me here. Need to do some reading.
Awesome!

As far as taking some time, I’d be glad to.

Unfortunately though I am new to this. I read about the what mpl said before he mentioned it but I’m still too green to write that out. It’s probably pretty easy. But to answer your question directly, no it’s not a replacement for stuffmidimessage, it would just be an alternative way to get the number in blue.

It’s also technically better coding because it would be based on the axe fx name rather than hard coding a specific midi out port which can change.

I’ll take some time over the weekend to work this out but I suspect someone might pop in and help out before I’m able to.
Puck is offline   Reply With Quote
Old 05-28-2022, 08:46 AM   #19
Miscreant
Human being with feelings
 
Miscreant's Avatar
 
Join Date: Mar 2012
Posts: 375
Default

Quote:
Originally Posted by Puck View Post
Awesome!

As far as taking some time, I’d be glad to.

Unfortunately though I am new to this. I read about the what mpl said before he mentioned it but I’m still too green to write that out. It’s probably pretty easy. But to answer your question directly, no it’s not a replacement for stuffmidimessage, it would just be an alternative way to get the number in blue.

It’s also technically better coding because it would be based on the axe fx name rather than hard coding a specific midi out port which can change.

I’ll take some time over the weekend to work this out but I suspect someone might pop in and help out before I’m able to.
Holy shit I got it working, using your code.

So to fill in a few blanks:

1. Since the Axe has been assigned the ID 13, the blue variable = 29 (13 + 16).

2. The first red variable = the preset number; the second one = 127 to turn that preset ON.

All then I need to do for each amp is copy the code and switch in a new preset number.

Amazing!

*EDIT*

Little wrinkle: I can effect program changes from 000 - 127. However, any program changes for patches >127 do no go through. This appears to be because of the banking system the Axe Fx uses. Attached is an example from the manual.

It appears to say that for banks B - D, there needs to be a different CC# inputted into the code. How would I do that?
Attached Images
File Type: png AXe Banks.png (35.8 KB, 82 views)

Last edited by Miscreant; 05-28-2022 at 08:58 AM.
Miscreant is offline   Reply With Quote
Old 05-28-2022, 08:58 AM   #20
Puck
Human being with feelings
 
Puck's Avatar
 
Join Date: Feb 2022
Location: Almost Canada
Posts: 505
Default

Quote:
Originally Posted by Miscreant View Post
Holy shit I got it working, using your code.

So to fill in a few blanks:

1. Since the Axe has been assigned the ID 13, the blue variable = 29 (13 + 16).

2. The first red variable = the preset number; the second one = 127 to turn that preset ON.

All then I need to do for each amp is copy the code and switch in a new preset number.

Amazing!
Awesome! Nice work!
Puck is offline   Reply With Quote
Old 05-28-2022, 09:58 AM   #21
Miscreant
Human being with feelings
 
Miscreant's Avatar
 
Join Date: Mar 2012
Posts: 375
Default

Aaaaand I figured it out:

/*
Send MIDI CC channel 1 cc0 value 2
*/
// EEL Script for Reaper
// Author: pipelineaudio

/*
8 = Note Off
9 = Note On
10 = AfterTouch (ie, key pressure)
11 = Control Change
12 = Program (patch) change
13 = Channel Pressure
14 = Pitch Wheel
*/

msg_type = 11; // CC
channel = 0;
function main ()
(
StuffMIDIMessage(29, msg_type*16 + channel, 0, 2);
);

main ();

/*
Send Program Change to AxeFX
*/
// EEL Script for Reaper

/*
8 = Note Off
9 = Note On
10 = AfterTouch (ie, key pressure)
11 = Control Change
12 = Program (patch) change
13 = Channel Pressure
14 = Pitch Wheel
*/


msg_type = 12; // Program Change
channel = 0;
function main ()
(
StuffMIDIMessage(29, msg_type*16 + channel, 100, 127);
);

main ();
Miscreant is offline   Reply With Quote
Old 08-19-2022, 02:20 PM   #22
Miscreant
Human being with feelings
 
Miscreant's Avatar
 
Join Date: Mar 2012
Posts: 375
Default

Quote:
Originally Posted by Puck View Post
Awesome! Nice work!
Hey there--I am wondering if you can help me out again. I've been posting this in another thread. I am trying to control my TotalMix FX snapshots via midi in Reaper. The TotalMix manual says that these are controlled via note on/off messages.

So would this script look something like this:

msg type = 9; // Note On (do I also need to include 8, note off?)
channel = 0;

function main ()
(
StuffMIDIMessage(19, msg_type*16 + channel, x, x);
);

main ();

My Fireface 800 has ID 3 in my midi devices preferences. So since according to the reascript API 16 = midi device 0, 17 = midi device 1, etc., the first 'x' should be 19 (16 + 3).

But I am unsure how to fill in the other two x's?

---------------------------------------------

Edit:

I've made some progress on this score, though the script isn't yet working. Here's what I've come up with so far;

/*
Send Program Change to FF800 Midi Port 1
*/
// EEL Script for Reaper

/*
8 = Note Off
9 = Note On
10 = AfterTouch (ie, key pressure)
11 = Control Change
12 = Program (patch) change
13 = Channel Pressure
14 = Pitch Wheel
*/

msg_type = 9; // Note On
channel = 0;
function main ()
(
StuffMIDIMessage(19, msg_type*16 + channel, 55, 1);
);

main ();

msg_type = 8; // Note Off
channel = 0;
function main ()
(
StuffMIDIMessage(19, msg_type*16 + channel, 55, 0);
);

main ();

Last edited by Miscreant; 08-19-2022 at 08:21 PM.
Miscreant is offline   Reply With Quote
Old 11-02-2022, 06:47 PM   #23
Miscreant
Human being with feelings
 
Miscreant's Avatar
 
Join Date: Mar 2012
Posts: 375
Default

Quote:
Originally Posted by Miscreant View Post
Aaaaand I figured it out:

/*
Send MIDI CC channel 1 cc0 value 2
*/
// EEL Script for Reaper
// Author: pipelineaudio

/*
8 = Note Off
9 = Note On
10 = AfterTouch (ie, key pressure)
11 = Control Change
12 = Program (patch) change
13 = Channel Pressure
14 = Pitch Wheel
*/

msg_type = 11; // CC
channel = 0;
function main ()
(
StuffMIDIMessage(29, msg_type*16 + channel, 0, 2);
);

main ();

/*
Send Program Change to AxeFX
*/
// EEL Script for Reaper

/*
8 = Note Off
9 = Note On
10 = AfterTouch (ie, key pressure)
11 = Control Change
12 = Program (patch) change
13 = Channel Pressure
14 = Pitch Wheel
*/


msg_type = 12; // Program Change
channel = 0;
function main ()
(
StuffMIDIMessage(29, msg_type*16 + channel, 100, 127);
);

main ();
Unfortunately this doesn't work. Something is defective about the first command.

I'm trying to send a control change message to indicate a specific midi bank 0/1/2, so that I can then send a program change to select presets higher than the first bank (0-127).

Otherwise I'm limited to whatever bank the current Axe preset is in.

Any tips?
Miscreant is offline   Reply With Quote
Old 05-31-2023, 04:22 PM   #24
jakeman19
Human being with feelings
 
Join Date: Jan 2022
Posts: 133
Default More Help Required Please

Miscreant or anyone else that would like to chime in.
I'm trying to use this script to change an Ensoniq DP/2 Effects processor to Program Change 68.
My DP/2 is set to MIDI channel 16.
Here is the code:
Code:
/*
Send Program Change to Ensoniq DP/2
*/
// EEL Script for Reaper

/*
8 = Note Off 
9 = Note On 
10 = AfterTouch (ie, key pressure) 
11 = Control Change 
12 = Program (patch) change 
13 = Channel Pressure 
14 = Pitch Wheel
*/


msg_type = 12; // Program Change
channel = 15;
function main ()
(
StuffMIDIMessage(32, msg_type*16 + channel, 68, 127);
);

main ();
It doesn't seem to work, so where did I go wrong.
Thanks for any help that is provided.

Jd
jakeman19 is offline   Reply With Quote
Old 05-31-2023, 09:42 PM   #25
jakeman19
Human being with feelings
 
Join Date: Jan 2022
Posts: 133
Default FIXED my issue

Quote:
Originally Posted by jakeman19 View Post
Miscreant or anyone else that would like to chime in.
I'm trying to use this script to change an Ensoniq DP/2 Effects processor to Program Change 68.
My DP/2 is set to MIDI channel 16.
Here is the code:
Code:
/*
Send Program Change to Ensoniq DP/2
*/
// EEL Script for Reaper

/*
8 = Note Off 
9 = Note On 
10 = AfterTouch (ie, key pressure) 
11 = Control Change 
12 = Program (patch) change 
13 = Channel Pressure 
14 = Pitch Wheel
*/


msg_type = 12; // Program Change
channel = 15;
function main ()
(
StuffMIDIMessage(32, msg_type*16 + channel, 68, 127);
);

main ();
It doesn't seem to work, so where did I go wrong.
Thanks for any help that is provided.

Jd
So the changes I had to make so future users are clear:

Code:
/*
Send Program Change to Ensoniq DP/2
*/
// EEL Script for Reaper

/*
8 = Note Off 
9 = Note On 
10 = AfterTouch (ie, key pressure) 
11 = Control Change 
12 = Program (patch) change 
13 = Channel Pressure 
14 = Pitch Wheel
*/


msg_type = 12; // Program Change
channel = 15;
function main ()
(
StuffMIDIMessage(17, msg_type*16 + channel, 68, 127);
);

main ();
channel = 15 is the midi channel of the unit you want to do the program change too. You have to go from 0-15, NOT 1-16.
In the "StuffMIDIMessage(17........." the 17 is 16 + the ID # in Preferences/Audio/Midi Devices, in the far right column you'll see the ID # next to the MIDI output device you have enabled. What ever your ID # is, you have to add 16 to it to get the proper #.

Hope this helps others in the future.

Jd

Last edited by jakeman19; 05-31-2023 at 09:51 PM.
jakeman19 is offline   Reply With Quote
Old 05-31-2023, 11:28 PM   #26
mschnell
Human being with feelings
 
mschnell's Avatar
 
Join Date: Jun 2013
Location: Krefeld, Germany
Posts: 14,688
Default

Anyway, IMHO the better way to create Midi messages is doing a JSFX rather than a ReaScript. Here you can take advantage of all standard Reaper Midi Routing features.
-Michael
mschnell is online now   Reply With Quote
Old 06-01-2023, 01:29 AM   #27
Miscreant
Human being with feelings
 
Miscreant's Avatar
 
Join Date: Mar 2012
Posts: 375
Default

Quote:
Originally Posted by mschnell View Post
Anyway, IMHO the better way to create Midi messages is doing a JSFX rather than a ReaScript. Here you can take advantage of all standard Reaper Midi Routing features.
-Michael
How would this work? Can you give an example?
Miscreant is offline   Reply With Quote
Old 06-01-2023, 10:55 AM   #28
mschnell
Human being with feelings
 
mschnell's Avatar
 
Join Date: Jun 2013
Location: Krefeld, Germany
Posts: 14,688
Default

ReaPack -> xy Pad (Effect rather than Script)
mschnell is online now   Reply With Quote
Old 06-01-2023, 03:07 PM   #29
Sid
Human being with feelings
 
Join Date: Apr 2018
Posts: 515
Default

Quote:
Originally Posted by pipelineaudio View Post
For that matter is there a repository of scripts some place?
ReaPack is a package manager for REAPER, the Digital Audio Workstation.

Discover, install and keep up to date your REAPER resources including ReaScripts, JS effects, extensions, themes, language packs, templates, web interfaces and more.

https://reapack.com/
Sid is offline   Reply With Quote
Reply

Thread Tools
Display Modes

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is On
HTML code is Off

Forum Jump


All times are GMT -7. The time now is 04:04 PM.


Powered by vBulletin® Version 3.8.11
Copyright ©2000 - 2024, vBulletin Solutions Inc.