Old 10-25-2020, 12:02 PM   #1
Distressor
Human being with feelings
 
Distressor's Avatar
 
Join Date: Mar 2017
Location: Berlin
Posts: 151
Default Send CCs from JSFX

This is probably a stupid question but this is my first JSFX project and i am not a coder.
I do have some experience with writing LUA scripts though.

How do i send fixed CCs with a slider from a JSFX plugin?
Let's say i want to send controller 18 and i have my slider set to the range 0 to 127?
All the guides and help files i could find on JSFX plugins always take some midi in to work.
How do i simply send it with the fader in the plugin?
Distressor is offline   Reply With Quote
Old 10-25-2020, 12:28 PM   #2
Aeolian
Human being with feelings
 
Aeolian's Avatar
 
Join Date: Jun 2010
Location: Somewhere PRO
Posts: 1,049
Default

In witti's plugin pack, check out "sfz_buddy"

Search the stash for "witti" or "js_plugins.zip"
__________________
"REAPER... You're simply the best" - Tina Turner
Aeolian is offline   Reply With Quote
Old 10-25-2020, 12:28 PM   #3
TonE
Human being with feelings
 
Join Date: Feb 2009
Location: Reaper HAS send control via midi !!!
Posts: 4,032
Default

You can use ReaControlMIDI (5 cc per instance) or https://github.com/gwatcha/midi-controller-vst
TonE is offline   Reply With Quote
Old 10-25-2020, 12:56 PM   #4
Distressor
Human being with feelings
 
Distressor's Avatar
 
Join Date: Mar 2017
Location: Berlin
Posts: 151
Default

Thanks guys. I'll check both of them out.
Distressor is offline   Reply With Quote
Old 10-25-2020, 03:28 PM   #5
Distressor
Human being with feelings
 
Distressor's Avatar
 
Join Date: Mar 2017
Location: Berlin
Posts: 151
Default

ReaControlMIDI is a VST and therefor can't be altered to my needs i'm afraid.

"sfz_buddy" basically does what i want.
Unfortunately the code seems unnecessary complex for what i have in mind. Is this the way to do it?
I don't really understand what is going on. So far i was unlucky in altering the code to the few sliders i need.
If someone could come up with some easy code with just one slider working on CC 18 i can copy that code and exchange the values (CC number, slider description etc.). I'm fine with CC values and channels being hard coded into the plug.

Thanks
Distressor is offline   Reply With Quote
Old 10-26-2020, 12:57 AM   #6
Tale
Human being with feelings
 
Tale's Avatar
 
Join Date: Jul 2008
Location: The Netherlands
Posts: 3,652
Default

Something like this you mean?

Code:
desc:Send CC#18

slider1:0<0,127,1>Value

@init

ch = 0; // 0..15
cc = 18;

old_value = -1;

@slider

value = min(max(0, slider1|0), 127);

@block

value != old_value ? (
  old_value = value;
  midisend(0, 0xB0 | ch, cc, value);
);
Tale is offline   Reply With Quote
Old 10-26-2020, 07:35 AM   #7
Distressor
Human being with feelings
 
Distressor's Avatar
 
Join Date: Mar 2017
Location: Berlin
Posts: 151
Default

Quote:
Originally Posted by Tale View Post
Something like this you mean?

Code:
desc:Send CC#18

slider1:0<0,127,1>Value

@init

ch = 0; // 0..15
cc = 18;

old_value = -1;

@slider

value = min(max(0, slider1|0), 127);

@block

value != old_value ? (
  old_value = value;
  midisend(0, 0xB0 | ch, cc, value);
);


Awesome. Now i understand it much better.
I build my JSFX with 25 of them. Works great.

Thanks a lot.

Last edited by Distressor; 10-26-2020 at 09:52 AM.
Distressor is offline   Reply With Quote
Old 10-26-2020, 10:06 AM   #8
Distressor
Human being with feelings
 
Distressor's Avatar
 
Join Date: Mar 2017
Location: Berlin
Posts: 151
Default

If i'd like to use sysex instead of CCs how would the code change?
Distressor is offline   Reply With Quote
Old 11-01-2020, 04:14 PM   #9
jrk
Human being with feelings
 
Join Date: Aug 2015
Posts: 2,969
Default

That would depend on what (hardware) you're wanting to send sysex to.

(I guess this'll be some kind of older kit that doesn't do CC, but does do sysex?)

but it's going to be something like:

Code:
//start building sysex message 
     outbuf[0] = 0xF0;
     outbuf[1] = manufacturer_identifier;
then you need to put the rest of your sysex message in the buffer*

terminate it, and send it

Code:
     outbuf[i] = 0xF7;  // finish sysex    
     midisend_buf(0,outbuf,i+1);

*the devil's in the specific detail... there's a pretty good article here:
http://www.muzines.co.uk/articles/ev...exclusive/5680
__________________
it's meant to sound like that...

Last edited by jrk; 11-01-2020 at 04:20 PM.
jrk is offline   Reply With Quote
Old 01-03-2023, 08:15 AM   #10
MST
Human being with feelings
 
Join Date: May 2021
Posts: 112
Default

Quote:
Originally Posted by Tale View Post
Something like this you mean?

Code:
desc:Send CC#18

slider1:0<0,127,1>Value

@init

ch = 0; // 0..15
cc = 18;

old_value = -1;

@slider

value = min(max(0, slider1|0), 127);

@block

value != old_value ? (
  old_value = value;
  midisend(0, 0xB0 | ch, cc, value);
);
Thank you !!
I tried this, and I now can send any cc with a slider, but after some experimenting to make more cc sliders (like Distressor managed to do, I know very little about programming) I got stuck.
Could you (or someone) give an example with an extra slider, controlling, for instance, cc19 ?
Then I expect I'll be able to make as many cc sliders as needed.
MST is offline   Reply With Quote
Old 01-03-2023, 11:07 AM   #11
Tale
Human being with feelings
 
Tale's Avatar
 
Join Date: Jul 2008
Location: The Netherlands
Posts: 3,652
Default

Quote:
Originally Posted by MST View Post
Could you (or someone) give an example with an extra slider, controlling, for instance, cc19 ?
Then I expect I'll be able to make as many cc sliders as needed.
Yeah, sure! Note that for two sliders I would do it this way, but for e.g. 10 sliders I would probably do it differently (i.e. I would try to combine the repetitive code in both @slider and @block in a loop). However, that would be more complicated... I think this is easier to understand. For now anyway.

Code:
desc:Send CC#18 / CC#19

slider1:0<0,127,1>CC#18
slider2:0<0,127,1>CC#19

@init

ch = 0; // 0..15

// CC#18
cc1 = 18;
old_value1 = -1;

// CC#19
cc2 = 19;
old_value2 = -1;

@slider

// CC#18
value1 = min(max(0, slider1|0), 127);

// CC#19
value2 = min(max(0, slider2|0), 127);

@block

// CC#18
value1 != old_value1 ? (
  old_value1 = value1;
  midisend(0, 0xB0 | ch, cc1, value1);
);

// CC#19
value2 != old_value2 ? (
  old_value2 = value2;
  midisend(0, 0xB0 | ch, cc2, value2);
);
Tale is offline   Reply With Quote
Old 01-04-2023, 04:26 PM   #12
MST
Human being with feelings
 
Join Date: May 2021
Posts: 112
Default

Awesome, it works, and I can do with it what I want, thank you !!

Yes, I've got a lot to learn, but I don't mind writing overcomplicated codes when I know I'll get a good result.
I might drop by again with a question about parameter feedback, but at the moment I'm happy, and I'll first indulge myself with some study before I dare to ask more.
MST 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 08:59 AM.


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