Go Back   Cockos Incorporated Forums > REAPER Forums > MIDI Hardware, Control Surfaces, and OSC

Reply
 
Thread Tools Display Modes
Old 02-18-2012, 03:08 PM   #1
Banned
Human being with feelings
 
Banned's Avatar
 
Join Date: Mar 2008
Location: Unwired (probably in the proximity of Amsterdam)
Posts: 4,868
Default Remote MIDI controllers and parameter feedback (via OSC/Pd)

With the OSC support for remote controller surfaces included in recent pre-release builds, we can now also hook up remote controllers using MIDI bi-directionally, via OSC and a round of OSC to MIDI / MIDI to OSC conversion. Doing so is useful, since it enables parameter feedback, meaning that regardless of whether one changes a parameter value in REAPER or on the remote controller, the value gets updated in both places. For controllers like the Behringer BCR-2000, this also means that LEDs on the controller reflecting current values are correctly updated.

Attached is a proof-of-concept patch (inspired by a similar patch for Max by Spyrow, kudos!) using Pure data (extended) (free, click for download links).

This simple example links the first 8 parameters of the effect in the 1st slot of track 1 to a MIDI controller, using CC# 1 thru 8, all on MIDI channel 1. I used a Behringer BCR-2000, but any other MIDI controller should do just fine as well.

In REAPER, set up a control surface using OSC, with a config file containing the following line:
Code:
FX_PARAM_VALUE /track/@/fx/@/fxparam/@/value
Both send and receive should be enabled (enable both checkboxes), "Device IP" should be 127.0.0.1 or localhost (assuming we run Pure data on the same computer). The default port numbers (8000 and 9000) are usually just fine.



In Pure data, go to Preferences > MIDI settings to select the MIDI port that your controller connects to, both (!) for input and output.



Set up your MIDI controller so that it has faders or rotary controllers for MIDI CC 1 thru 8, all on MIDI channel 1 (or change the Pd patch accordingly, which should be easy enough to do).

In Pure data, load the patch "OSC-MIDI-conversion.pd" (attached), and click the most top-left button to connect the UDP port (you can verify it worked in Pure data's console window, which should say "udpsend: connecting to port 8000" assuming you are using port 8000).



In REAPER, insert an effect on effect slot 1 of track 1. Any plugin (effect/instrument; VST/AU/JS) should do. To identify which are the first 8 parameters, it can be handy to click the UI button (top right) to show the generic UI; so we can instantly see which 8 parameters come first.

Now test it: change the values of parameters 1 thru 8 in REAPER and on the MIDI controller, while Pure data can be used to verify connections and display current values.
Attached Images
File Type: jpg REAPERv4.16pre18_OSC_config-FX_param_val.jpg (64.0 KB, 10579 views)
File Type: jpg OSC-MIDI-conversion.jpg (67.9 KB, 10608 views)
File Type: png Pd-MIDI-preferences.png (19.7 KB, 9856 views)
Attached Files
File Type: zip OSC-MIDI-conversion.pd.zip (2.0 KB, 1619 views)
__________________
˙lɐd 'ʎɐʍ ƃuoɹʍ ǝɥʇ ǝɔıʌǝp ʇɐɥʇ ƃuıploɥ ǝɹ,noʎ
Banned is offline   Reply With Quote
Old 02-18-2012, 03:21 PM   #2
strinxx
Human being with feelings
 
strinxx's Avatar
 
Join Date: Jun 2009
Posts: 300
Default

Now this sounds interesting!
Does this mean this is going to work for ANY Midi-Controller, like Steinberg Houston, CM-Labs Motormix... and such?
That'd be totally cool and would make a few boys and girls out there pretty happy, I guess...

Where would I find some more Information about OSC, and how this stuff works in general?

Thanks so much for this!
strinxx is offline   Reply With Quote
Old 02-18-2012, 03:42 PM   #3
Banned
Human being with feelings
 
Banned's Avatar
 
Join Date: Mar 2008
Location: Unwired (probably in the proximity of Amsterdam)
Posts: 4,868
Default

Quote:
Originally Posted by strinxx View Post
Now this sounds interesting!
Does this mean this is going to work for ANY Midi-Controller, like Steinberg Houston, CM-Labs Motormix... and such?
Yes. (In fact, those all sound like 'fancy', expansive ones that also support protocols other than plain old MIDI, while this should already work just fine for the oldest, simplest, cheapest MIDI gear you can find. )
Quote:
That'd be totally cool and would make a few boys and girls out there pretty happy, I guess...

Where would I find some more Information about OSC, and how this stuff works in general
There have been some links and tidbits posted in the OSC FR/bug thread and in the pre-release threads since v4.16pre16, but other than the OSC website, I'd just use Google, Wikipedia etc., there's plenty of great info out there.

For the OSC implementation specific to REAPER, you can study the default OSC config file ("default.ReaperOsc"). It shows plenty of interesting things REAPER can do; my example *only* uses one particular example. By changing the type of messages in the config file and the Pd patch, one can for example make the controllers target the currently focused effect instead.
Quote:
Thanks so much for this!
You're welcome. The real important work here was done by schwa though, adding OSC support for control surfaces in REAPER.

And hopefully we will also get similar support for plain old MIDI one day, so that we do not need silly workarounds such as this one anymore.
__________________
˙lɐd 'ʎɐʍ ƃuoɹʍ ǝɥʇ ǝɔıʌǝp ʇɐɥʇ ƃuıploɥ ǝɹ,noʎ

Last edited by Banned; 02-18-2012 at 04:04 PM. Reason: added info re: default.ReaperOsc
Banned is offline   Reply With Quote
Old 02-18-2012, 05:24 PM   #4
recccp
Human being with feelings
 
recccp's Avatar
 
Join Date: Sep 2009
Posts: 43
Default

Thank you for this!

Works fine with bcr.

However, I modified it to control focused fx.

FOCUSED_FX_PARAM_VALUE /focfx/fxparam/@/value

Now, the feedback part works fine (fx parameter -> pd -> bcr), also by switching between fx's bcr catch up the values fine.
But can't control fx params with bcr.
I don't know if its a bug, or I made something wrong...
by pressing "Listen" reaper shows the incoming messages (/focfx/fxparam/1/value [f] 0.149606)
Could you please check this?!

Thanks again for this patch!
recccp is offline   Reply With Quote
Old 02-18-2012, 05:50 PM   #5
Banned
Human being with feelings
 
Banned's Avatar
 
Join Date: Mar 2008
Location: Unwired (probably in the proximity of Amsterdam)
Posts: 4,868
Default

Quote:
Originally Posted by recccp View Post
Thank you for this!

Works fine with bcr.

However, I modified it to control focused fx.

FOCUSED_FX_PARAM_VALUE /focfx/fxparam/@/value

Now, the feedback part works fine (fx parameter -> pd -> bcr), also by switching between fx's bcr catch up the values fine.
But can't control fx params with bcr.
I don't know if its a bug, or I made something wrong...
by pressing "Listen" reaper shows the incoming messages (/focfx/fxparam/1/value [f] 0.149606)
Could you please check this?!

Thanks again for this patch!
It is very much intended as an example to modify yourself indeed. So thank you for doing so!

Unfortunately, I get the same disappointing result you did: the listen view shows the messages, and they seem to be formatted correctly, but they do not update (I did like seeing the LEDs update as soon as you switch focus to another plugin, neat eh? ). It may very well be a little bug in the OSC support, which is being developed as we speak (my example is only working since the latest release as well). Exactly the reason why this post is in the pre-release forum, for now at least.

Btw, I'll post a cleaner example patch later. Less instructive perhaps, but hopefully better for modding and expanding (things can quickly get messy in Pd, especially if you don't tidy up).
__________________
˙lɐd 'ʎɐʍ ƃuoɹʍ ǝɥʇ ǝɔıʌǝp ʇɐɥʇ ƃuıploɥ ǝɹ,noʎ
Banned is offline   Reply With Quote
Old 02-18-2012, 06:13 PM   #6
recccp
Human being with feelings
 
recccp's Avatar
 
Join Date: Sep 2009
Posts: 43
Default

Thank you for your feedback!

Cant wait to see this fixed

FR for the upcoming patch
Is it possible in pd to add textbox's that shows the current fx name and param names?
recccp is offline   Reply With Quote
Old 02-18-2012, 06:16 PM   #7
XITE-1/4LIVE
Human being with feelings
 
XITE-1/4LIVE's Avatar
 
Join Date: Nov 2008
Location: Somewhere Between 120 and 150 BPM
Posts: 7,968
Default

This is great news. I am deciding what controller I should get.
Lemur, Ohm, etc.
Do you have any suggestions on which surface would be bes suited for the OSC-MIDI stuff....?

Thanks Again for your discoveries...
__________________
.
XITE-1/4LIVE is offline   Reply With Quote
Old 02-18-2012, 06:25 PM   #8
musicbynumbers
Human being with feelings
 
musicbynumbers's Avatar
 
Join Date: Jun 2009
Location: South, UK
Posts: 14,214
Default

Quote:
Originally Posted by XITE-1/4LIVE View Post
This is great news. I am deciding what controller I should get.
Lemur, Ohm, etc.
Do you have any suggestions on which surface would be bes suited for the OSC-MIDI stuff....?

Thanks Again for your discoveries...
If you are thinking lemur, you might be better of buying the ipad version of lemur and having an ipad as well (although I'm not sure if it's totally the same thing)
musicbynumbers is offline   Reply With Quote
Old 02-18-2012, 06:32 PM   #9
Banned
Human being with feelings
 
Banned's Avatar
 
Join Date: Mar 2008
Location: Unwired (probably in the proximity of Amsterdam)
Posts: 4,868
Default

Another example. This Pd patch does exactly the same thing as the first example, but differently (one difference: I did connect the boxes displaying current values, so you can also tweak parameter values from Pd more easily by click-dragging them). Once you understand the basics, this example shows how to use [routeOSC] in Pd to make a much nicer structure with much less typing / copying; how to use subpatchers ([pd]) to encapsulate stuff, and how to use wildcards for concatenating messages. The changes mainly serve to to accomplish the same result while taking up much less screen space. This is important to keep things tidy and manageable, because to make a custom patch for e.g. a Behringer BCR-2000 controller that utilizes all its buttons and rotaries, one needs about a hundred controllers instead of only 8.

Attached Images
File Type: jpg REAPER-OSC-MIDI-conversion-example2.jpg (59.8 KB, 10203 views)
Attached Files
File Type: zip REAPER-OSC-MIDI-conversion-example2.pd.zip (1.5 KB, 823 views)
__________________
˙lɐd 'ʎɐʍ ƃuoɹʍ ǝɥʇ ǝɔıʌǝp ʇɐɥʇ ƃuıploɥ ǝɹ,noʎ
Banned is offline   Reply With Quote
Old 02-18-2012, 06:59 PM   #10
Banned
Human being with feelings
 
Banned's Avatar
 
Join Date: Mar 2008
Location: Unwired (probably in the proximity of Amsterdam)
Posts: 4,868
Default

Quote:
Originally Posted by recccp View Post
Thank you for your feedback!

Cant wait to see this fixed

FR for the upcoming patch
Is it possible in pd to add textbox's that shows the current fx name and param names?
Yeah,
Code:
FOCUSED_FX_NAME /focfx/name
FOCUSED_FX_PARAM_NAME /focfx/fxparam/@/name
FOCUSED_FX_PARAM_VALUE /focfx/fxparam/@/value
should work for that. [EDIT:] Here's example 3, which shows the currently focused effect's name and its first 8 parameter names on the Pd patch (unfortunately we'll still have to wait to have the bug discussed above fixed to control the focused effect from the remote controller).



[EDIT: Oops... fixed (almost at the bottom, left):
[send /track/$1/fx/$2/fxparam/$3/value $4(
-->
[send /focfx/fxparam/$1/value $2( ]
Attached Images
File Type: jpg REAPER-OSC-MIDI-conversion-example3.jpg (59.9 KB, 9914 views)
Attached Files
File Type: zip REAPER-OSC-MIDI-conversion-example3.pd.zip (1.7 KB, 782 views)
__________________
˙lɐd 'ʎɐʍ ƃuoɹʍ ǝɥʇ ǝɔıʌǝp ʇɐɥʇ ƃuıploɥ ǝɹ,noʎ

Last edited by Banned; 02-20-2012 at 06:55 PM. Reason: [1] added patch; [2] fixed grammar; [3] fixed bug
Banned is offline   Reply With Quote
Old 02-18-2012, 07:22 PM   #11
Banned
Human being with feelings
 
Banned's Avatar
 
Join Date: Mar 2008
Location: Unwired (probably in the proximity of Amsterdam)
Posts: 4,868
Default

Quote:
Originally Posted by XITE-1/4LIVE View Post
This is great news. I am deciding what controller I should get.
Lemur, Ohm, etc.
Do you have any suggestions on which surface would be bes suited for the OSC-MIDI stuff....?

Thanks Again for your discoveries...
Well, the nice thing about this hack is that it can be just any plain MIDI controller, no OSC required on the controller's end at all. What you do want to look for specifically, is how it handles feedback: does it have any way to update and show current values? E.g. on a LCD display, LEDs like the BCR-2000, motorized faders (awesome; I used to have a Yamaha ProMix which I only used as MIDI controller) - without a value display on the controller, feedback isn't of much use.

I guess I can still recommend the Behringer BCR-2000 for being relatively cheap, quite sturdy, and having lots of knobs with LEDs and a bunch of switch buttons.

(Controllers like the Lemur are in an entirely different league; and while the Lemur app on iPad is awesome, imho it is not comparable to the Lemur hardware, which are really pro quality, built for gigging).
__________________
˙lɐd 'ʎɐʍ ƃuoɹʍ ǝɥʇ ǝɔıʌǝp ʇɐɥʇ ƃuıploɥ ǝɹ,noʎ
Banned is offline   Reply With Quote
Old 02-18-2012, 09:14 PM   #12
BenK-msx
Human being with feelings
 
BenK-msx's Avatar
 
Join Date: Jun 2008
Location: Whales, UK
Posts: 6,009
Default

nice work, just need to get my noggin around it, and maybe one day my crappy, pita, shouldn't have bought it, 'icon istage' will become more useful - it has numerous pretty LED 'pads' you see.
__________________
JS Super8 Looper Template & intro | BCF2000 uber info Thread | Who killed the Lounge?
BenK-msx is offline   Reply With Quote
Old 02-18-2012, 10:13 PM   #13
recccp
Human being with feelings
 
recccp's Avatar
 
Join Date: Sep 2009
Posts: 43
Default

yeee...

Thank you so much!
I'm sure that bug will be fixed soon

Q: Can the midi in/out ports be saved somehow in pd as default, so you dont need to set them up every time you launch it?

FR: Is it possible to add some kind of modifier thing to the patch?
e.g CC1 controls the volume, and by sending e.g CC60 (modifier button on) it turns the CC1 to control e.g pan?
recccp is offline   Reply With Quote
Old 02-19-2012, 06:47 AM   #14
Banned
Human being with feelings
 
Banned's Avatar
 
Join Date: Mar 2008
Location: Unwired (probably in the proximity of Amsterdam)
Posts: 4,868
Default

Quote:
Originally Posted by recccp View Post
[...] Q: Can the midi in/out ports be saved somehow in pd as default, so you dont need to set them up every time you launch it?
Yes, by adding the appropriate startup flags in Preferences > Startup. E.g., for using 1st MIDI input, and 1st MIDI output:
Code:
-midiindev 1 -midioutdev 1
(and I should probably also [loadbang] the UDP connection so you don't need to activate it every time on startup either)
Quote:
Originally Posted by recccp View Post
FR: Is it possible to add some kind of modifier thing to the patch?
e.g CC1 controls the volume, and by sending e.g CC60 (modifier button on) it turns the CC1 to control e.g pan?
Definitely. Pretty much anything is possible... I was thinking myself about using the 2 rows of 8 buttons on the BCR-2000 for a selection matrix: select (any combination of) track(s) 1-8 and (any combination of) effect slot(s) 1-8 to select which (combination of) effect parameters are targeted by all the other knobs and switches.

I'll try to make some simple illustrative example of switching functions with a modifier. But do note that to get your controller(s) to behave exactly like you want, in practice you are likely to end up with some huge, complex custom patch. My main goal here is to provide simple examples to help other users get started making their own ones. Illustrative patches, not the most powerful ones. That will be up to yourself.
__________________
˙lɐd 'ʎɐʍ ƃuoɹʍ ǝɥʇ ǝɔıʌǝp ʇɐɥʇ ƃuıploɥ ǝɹ,noʎ

Last edited by Banned; 02-19-2012 at 07:05 PM.
Banned is offline   Reply With Quote
Old 02-19-2012, 09:21 AM   #15
recccp
Human being with feelings
 
recccp's Avatar
 
Join Date: Sep 2009
Posts: 43
Default

Quote:
Originally Posted by Banned View Post
Yes, by adding the appropriate startup flags in Preferences > Startup. E.g., for using 1st MIDI input, and 1st MIDI output:
Code:
-midiindev 1 -midioutdev 1
Thank you!
Quote:
Originally Posted by Banned View Post
(and I should probably also [loadbang] the UDP connection so you don't need to activate it every time on startup either)
Great news, would be really useful.

Quote:
Originally Posted by Banned View Post
Definitely. Pretty much anything is possible... I was thinking myself about using the 2 rows of 8 buttons on the BCR-2000 for a selection matrix: select (any combination of) track(s) 1-8 and (any combination of) effect slot(s) 1-8 to select which (combination of) effect parameters are targeted by all the other knobs and switches.

I'll try to make some simple illustrative example of switching functions with a modifier. But do note that to get your controller(s) to behave exactly like you want, in practice you are likely to end up with some huge, complex custom patch. My main goal here is to provide simple examples to help other users get started making their own ones. Illustrative patches, not the most powerful ones. That will be up to yourself.
Yep, I'm already started to make my own patch and with modifiers there are a lot of possibilities.

One more Q:
How to save multiple blocks as "macro" (ocs2ctrl)?
Simply by saving selected blocks as patch or is there other built-in way to do this?
recccp is offline   Reply With Quote
Old 02-19-2012, 12:54 PM   #16
Banned
Human being with feelings
 
Banned's Avatar
 
Join Date: Mar 2008
Location: Unwired (probably in the proximity of Amsterdam)
Posts: 4,868
Default

Quote:
Originally Posted by recccp View Post
[...] One more Q:
How to save multiple blocks as "macro" (ocs2ctrl)?
Simply by saving selected blocks as patch or is there other built-in way to do this?
There are two methods: subpatches and abstractions; cf. this explanation of encapsulation in Pd.

The [pd osc2ctrl] I used in the patches above are the former type. Using an abstraction would probably make more sense (edit once, change all instances), but I used subpatches anyway because I wanted the example patch to consist of a single file only, just to keep things simple.
__________________
˙lɐd 'ʎɐʍ ƃuoɹʍ ǝɥʇ ǝɔıʌǝp ʇɐɥʇ ƃuıploɥ ǝɹ,noʎ

Last edited by Banned; 02-19-2012 at 01:07 PM.
Banned is offline   Reply With Quote
Old 02-19-2012, 07:47 PM   #17
Banned
Human being with feelings
 
Banned's Avatar
 
Join Date: Mar 2008
Location: Unwired (probably in the proximity of Amsterdam)
Posts: 4,868
Default Example 4 - switching with modifiers

Example 4 (click to download), including an example of switching with modifiers (using the default OSC config, only a small part of it is actually needed). MIDI CC# 97 and 98 (which happen to be the numbers of the knobs at the bottom left of my BCR-2000 setup, change to whatever suits you) can be used to select the track and effect slot of which the first 8 parameters are controllers by MIDI CC# 1 thru 8 (all on MIDI channel 1).
MIDI CC# 97 selects the track, from 0 (master) to 8;
MIDI CC# 98 selects the effect slot, from 1 to 8.

I did not use switch buttons for this example, because (1) that uses up more controllers (in this example, I would have needed 9 + 8 = 17 controllers instead of only 2), and (2) that would require some more complicated patching (to make sure all other buttons are switched off when one is switched on).

For convenience, I have added a [loadbang] to start up OSC output via UDP on loading the patch; and also to set the default track to 0 (master) and effect slot to 1 (change the [0] and [1] boxes for different default values).

[EDIT: I also added a [print] module, which enables monitoring of all OSC messages from REAPER in the Pd console, which makes it a handy debugging tool. Just disconnect or remove it if you don't need it.]

(Notice that it may be hard to make a large number of connections to individual inlets / outlets of a [switch] or [gate] - but you can also create them manually in the .pd file in a text editor, or even programmatically)

NB: that there seem to be a couple of bugs in the current OSC implementation that prevent this pact from working completely as planned; these bugs have been reported, so hopefully they will get fixed for one of the next builds, and this patch will also start working as designed.

Displaying track, effect and parameter names isn't completely working as it should yet (some stuff only seems to work on master channel, some only on other tracks), and I'm also having trouble getting REAPER to trigger an action to refresh the control surface remotely. Since this is not yet working (for me, at least - others seem to have had more success with actions), and the Pd patch is not caching any data about tracks/effects not currently being controlled by the 8 main controllers, the bi-directional feedback does not (yet) automatically update immediately after switching to a different track / effect, but once you get it going, it should start working. [EDIT:] Finally, the remote control surface does not (yet) update when effect parameters are tweaked on the master track in REAPER, since there seems to be a bug that prevents /track/0 OSC output. With all other tracks it should work fine; and controlling effects in the master track from the remote controller does work.

__________________
˙lɐd 'ʎɐʍ ƃuoɹʍ ǝɥʇ ǝɔıʌǝp ʇɐɥʇ ƃuıploɥ ǝɹ,noʎ

Last edited by Banned; 02-19-2012 at 09:52 PM. Reason: cleaned up a bit
Banned is offline   Reply With Quote
Old 02-20-2012, 11:08 AM   #18
recccp
Human being with feelings
 
recccp's Avatar
 
Join Date: Sep 2009
Posts: 43
Default

Thank you for these tutorials!
Now - I hope - I can make most of the things I want...

I had the same results with action(s), hopefully this will be fixed soon as well.

I just noticed that the parameters can't reach their min and max value (e.g pan - 98%L, 98%R).
Can this be solved?
Attached Images
File Type: jpg pd.jpg (54.0 KB, 827 views)
recccp is offline   Reply With Quote
Old 02-20-2012, 11:36 AM   #19
recccp
Human being with feelings
 
recccp's Avatar
 
Join Date: Sep 2009
Posts: 43
Default

Also, can pd detect that reaper quits and sending null messages to the controller?
recccp is offline   Reply With Quote
Old 02-20-2012, 03:14 PM   #20
Banned
Human being with feelings
 
Banned's Avatar
 
Join Date: Mar 2008
Location: Unwired (probably in the proximity of Amsterdam)
Posts: 4,868
Default

Quote:
Originally Posted by recccp View Post
Thank you for these tutorials!
Now - I hope - I can make most of the things I want...
Indeed... for another example of a long held wish now coming true: we can use OSC to overcome the limited resolution of MIDI CC# (7 bits = 128 steps) when remotely controlling plugin parameters. I will try to use the relative and/or 14 bit modes of the BCR-2000's top row of rotaries for that. Parameter feedback will be more complicated for such an approach, I guess.

I'm also thinking about how I can make a single momentary switch button into a modifier for 'fine' control, while keeping the regular 'coarse' control at a resolution of 128 steps, including MIDI CC# parameter feedback (for at least the coarse control). Not quite sure how (best) to do so yet...

Quote:
Originally Posted by recccp View Post
I had the same results with action(s), hopefully this will be fixed soon as well.
Thanks for confirming.

In the meantime, I'm cleaning up the last example, and making a little display (so that the rest of the patch can be hidden from view):



Maybe next up, I'll try to add a couple of switches to toggle between track/slot, focused, and last touched effect modes.

Quote:
Originally Posted by recccp View Post
I just noticed that the parameters can't reach their min and max value (e.g pan - 98%L, 98%R).
Can this be solved?
That is not true for all parameters of any arbitrary plugin, is it?

<rant> I think the problem you describe lies entirely with REAPER c.s. - Cockos often uses *absurd* scaling of remote control to parameters - I really hate that, and don't understand why the devs don't think of this stuff themselves. I haven't played with remotely controlling track settings such as pan yet, but it fits the pattern completely: just try regular pretty much any of the ReaPlugs, and you'll see exactly the same thing (also with regular 'MIDI Learn'). Often you can't reach the extreme values; where scaling should be logarithmic, it is linear (and if it is logarithmic, e.g. ReaEQ frequencies, it does not follow MIDI note numbers), etc. etc. Often annoyingly unusable, sometimes even embarrassingly unmusical. There's a lot of cleaning up to do for the REAPER devs in this area (and in this case it would be ridiculous to argue "it isn't broken, and changing it would negatively affect backward compatibility" - people who rely on such a mess are simply hindering progress). </rant>

Pd can be used to minimize some but not all of such issues, e.g. converting linear<-->logarithmic scaling should work, but reaching values that REAPER does not expose to remote control will not. That requires sanitization of parameter scaling on REAPER's end.
Attached Images
File Type: png REAPER-OSC-MIDI-conversion-example5-display.png (37.8 KB, 9482 views)
__________________
˙lɐd 'ʎɐʍ ƃuoɹʍ ǝɥʇ ǝɔıʌǝp ʇɐɥʇ ƃuıploɥ ǝɹ,noʎ
Banned is offline   Reply With Quote
Old 02-20-2012, 03:21 PM   #21
Banned
Human being with feelings
 
Banned's Avatar
 
Join Date: Mar 2008
Location: Unwired (probably in the proximity of Amsterdam)
Posts: 4,868
Default

Quote:
Originally Posted by recccp View Post
Also, can pd detect that reaper quits and sending null messages to the controller?
No idea, there must be a way, but I guess not directly. You could of course just request such a feature, i.e. have REAPER do something like
Code:
EXIT_MESSAGE /goodbyecruelworld!
on exit.

What exactly do you mean by "sending null messages", do you want all controllers to be reset to 0 (that, in itself, should be easy enough to do yourself now hopefully)?
__________________
˙lɐd 'ʎɐʍ ƃuoɹʍ ǝɥʇ ǝɔıʌǝp ʇɐɥʇ ƃuıploɥ ǝɹ,noʎ
Banned is offline   Reply With Quote
Old 02-20-2012, 04:58 PM   #22
recccp
Human being with feelings
 
recccp's Avatar
 
Join Date: Sep 2009
Posts: 43
Default

Just tried with vst parameters... (first patch you shared)

recccp is offline   Reply With Quote
Old 02-20-2012, 04:59 PM   #23
recccp
Human being with feelings
 
recccp's Avatar
 
Join Date: Sep 2009
Posts: 43
Default

Quote:
Originally Posted by Banned View Post
No idea, there must be a way, but I guess not directly. You could of course just request such a feature, i.e. have REAPER do something like
Code:
EXIT_MESSAGE /goodbyecruelworld!
on exit.

What exactly do you mean by "sending null messages", do you want all controllers to be reset to 0 (that, in itself, should be easy enough to do yourself now hopefully)?
Yes, I mean auto reset the controller when reaper quits.
recccp is offline   Reply With Quote
Old 02-20-2012, 06:09 PM   #24
Banned
Human being with feelings
 
Banned's Avatar
 
Join Date: Mar 2008
Location: Unwired (probably in the proximity of Amsterdam)
Posts: 4,868
Default

Quote:
Originally Posted by recccp View Post
Just tried with vst parameters... (first patch you shared)
Ah yeah, you're right. My hunch is that we discovered yet another little bug in the OSC code (it could also be some error in the Pd patches that I missed, of course). Plugin parameters do not seem to respond when you send them the exact values 0 and 1. They do respond - funny enough - to negative values and values above 1 (try using shift as a modifier when click dragging values in Pd for 0.01 increments. Perhaps REAPER needs to see 0.0 and 1.0 instead of 0 and 1 or something. Perhaps a possible workaround would be sending -0.00001 instead of 0, and 1.00001 instead of 1, every time a 0 or 1 needs to be sent to REAPER for a parameter value. Seems ugly, I'd rather wait a bit until such little bugs are worked out.

PS: Not all plugins properly protect themselves by clipping their parameter value inputs. Try how far you can push them with 'illegal' values (i.e. outside of range normally exposed) - before they crash.
__________________
˙lɐd 'ʎɐʍ ƃuoɹʍ ǝɥʇ ǝɔıʌǝp ʇɐɥʇ ƃuıploɥ ǝɹ,noʎ

Last edited by Banned; 02-20-2012 at 06:59 PM.
Banned is offline   Reply With Quote
Old 02-20-2012, 06:23 PM   #25
Banned
Human being with feelings
 
Banned's Avatar
 
Join Date: Mar 2008
Location: Unwired (probably in the proximity of Amsterdam)
Posts: 4,868
Default

Quote:
Originally Posted by recccp View Post
Yes, I mean auto reset the controller when reaper quits.
Well, give it a try then, try starting simple, by making a (sub)patch that resets the BCR-2000 when clicking some button; later, see if you can get Pd to notice when REAPER quits, and hook it up.

Note that a 'reset' may, depending on your setup, also be implemented differently than zeroing out all values, by taking into account specific types of parameters, e.g. a controller for pan would typically reset to the center, a low-pass filter cut-off to the maximum, a volume maybe about 3/4 depending on what corresponds to 0dB, etc. The different LED modes of the BCR-2000's top row
of rotaries is awesome to make presets taking such things into account.

For a quick reset - whether zeroing out all controllers or otherwise - you can of course also change the preset on the BCR-2000 up and down again (both manually and programmatically), which takes only 2 actions instead of whatever number of controllers you'd otherwise need to send separate messages. Just an idea...
__________________
˙lɐd 'ʎɐʍ ƃuoɹʍ ǝɥʇ ǝɔıʌǝp ʇɐɥʇ ƃuıploɥ ǝɹ,noʎ
Banned is offline   Reply With Quote
Old 02-20-2012, 08:00 PM   #26
recccp
Human being with feelings
 
recccp's Avatar
 
Join Date: Sep 2009
Posts: 43
Default

Help!
Cant find how to hide things
recccp is offline   Reply With Quote
Old 02-20-2012, 11:52 PM   #27
dpclarkson
Human being with feelings
 
Join Date: Sep 2011
Posts: 8
Default

Awesome, I'm going to give it a shot with my trusty old Motormix!
Hopefully I can finally use it properly within Reaper for mixing.
dpclarkson is offline   Reply With Quote
Old 02-21-2012, 12:06 AM   #28
Banned
Human being with feelings
 
Banned's Avatar
 
Join Date: Mar 2008
Location: Unwired (probably in the proximity of Amsterdam)
Posts: 4,868
Default

Quote:
Originally Posted by recccp View Post
Help!
Cant find how to hide things
Put in sub patches, put outside view, make window smaller, minimize window, put blank plane in front, modulate all colors' alpha values to 0...
__________________
˙lɐd 'ʎɐʍ ƃuoɹʍ ǝɥʇ ǝɔıʌǝp ʇɐɥʇ ƃuıploɥ ǝɹ,noʎ
Banned is offline   Reply With Quote
Old 02-21-2012, 12:10 AM   #29
Banned
Human being with feelings
 
Banned's Avatar
 
Join Date: Mar 2008
Location: Unwired (probably in the proximity of Amsterdam)
Posts: 4,868
Default

Quote:
Originally Posted by Banned View Post
[...] Perhaps a possible workaround would be sending -0.00001 instead of 0, and 1.00001 instead of 1, every time a 0 or 1 needs to be sent to REAPER for a parameter value. Seems ugly [...]
Yeah, this seems to work:



Right part is as it was. Left part is adjusted with workaround.

Tested on the UAD 1176 SE, same as recccp's screen cap, now seems to work as expected (but beware, you're really sending values slightly out of range - plugins could crash).
Attached Images
File Type: png REAPER-OSC-absminmax-workaround.png (9.7 KB, 9215 views)
__________________
˙lɐd 'ʎɐʍ ƃuoɹʍ ǝɥʇ ǝɔıʌǝp ʇɐɥʇ ƃuıploɥ ǝɹ,noʎ
Banned is offline   Reply With Quote
Old 02-21-2012, 03:15 AM   #30
Banned
Human being with feelings
 
Banned's Avatar
 
Join Date: Mar 2008
Location: Unwired (probably in the proximity of Amsterdam)
Posts: 4,868
Default Example 5

Example 5: cleaning up, adding separate display:



- Cleaned up quite a bit using [send]s and [receive]s for 'wireless' connections.
- For ease of editing, I converted the [pd osc2ctl] subpatchers into an [osc2ctl] abstraction (so there are now 2 files in the .zip, keep them in the same folder).
- Increased the number of controllers from 8 to 16.
- Added a switch to select between track/slot and focused fx modes. I will probably attach another MIDI CC# to it later; I will also need to create something to switch between displaying the track name and slot number and focused effect name when switching between modes (displaying the plugin name already works in either mode).
- Added another switch for monitoring OSC input from REAPER in the Pd console.
- Added a little hack in [osc2ctl] to write a bunch of underscores whenever no parameter names / value strings are sent, and -1 whenever no values are sent (e.g. when a plugin has less than 16 parameters). In earlier versions, the 'old' values/names/strings remained visible, while they were no longer applicable. It seems to work fine (tested by switching focus between various plugins in focused fx mode), but like much of the patch, hasn't yet been rigorously tested or optimized.
- For parameter 1, I have created the workaround described above for the issue that absolute minimum and maximum values could not be reached by sending 0 and 1, respectively.

All earlier caveats with regards to bugs in the current OSC implementation still apply, of course. For now this patch is nice for testing, and to get a feel of what will be possible in the near future. Again, I have tried to make sure that the patch will work once currently known bugs have been tackled (with the exception for the workaround example, which at that point could be removed again), but many things still do not work as planned.
Attached Images
File Type: jpg REAPER-OSC-MIDI-conversion-example5+osc2ctl.jpg (63.7 KB, 9391 views)
Attached Files
File Type: zip REAPER-OSC-MIDI-conversion-example5+osc2ctl.zip (4.9 KB, 682 views)
__________________
˙lɐd 'ʎɐʍ ƃuoɹʍ ǝɥʇ ǝɔıʌǝp ʇɐɥʇ ƃuıploɥ ǝɹ,noʎ
Banned is offline   Reply With Quote
Old 02-21-2012, 03:48 AM   #31
gridlove
Human being with feelings
 
gridlove's Avatar
 
Join Date: Sep 2010
Location: Chesterfield, UK
Posts: 248
Default

This is looking really good, I have it all working (bar the midi parameter control bug) but I was wondering how hard it would be to incorporate the selected track volume and pan or some kind of banking for 8 tracks?
gridlove is offline   Reply With Quote
Old 02-21-2012, 04:52 AM   #32
Banned
Human being with feelings
 
Banned's Avatar
 
Join Date: Mar 2008
Location: Unwired (probably in the proximity of Amsterdam)
Posts: 4,868
Default

Quote:
Originally Posted by gridlove View Post
This is looking really good, I have it all working (bar the midi parameter control bug) [...]
Awesome.
Quote:
Originally Posted by gridlove View Post
[...] but I was wondering how hard it would be to incorporate the selected track volume and pan or some kind of banking for 8 tracks?
Probably not very hard at all - I'll have a go at something like that for sure - but it can be quite a tough job to keep things from becoming messy when patches grow in size / complexity, and debugging for all sorts of corner cases. Finding the best way to do things is much harder than getting something to 'sort of' work, it needs a bit of experimentation / puzzling / playing. Most experienced Pd / Max patch designers re-make their patches a bunch of times to get things right.

What controller are you using, btw? I'm trying to keep the examples generic and only use a limited number of MIDI controllers, to ensure that it is usable for a broad range of controllers, but it would be good to have an idea of what kind of controllers people are using, to accommodate different specs / layouts (e.g. multiples of 8 controllers seem to be used quite a lot, it seems).
__________________
˙lɐd 'ʎɐʍ ƃuoɹʍ ǝɥʇ ǝɔıʌǝp ʇɐɥʇ ƃuıploɥ ǝɹ,noʎ
Banned is offline   Reply With Quote
Old 02-21-2012, 05:14 AM   #33
gridlove
Human being with feelings
 
gridlove's Avatar
 
Join Date: Sep 2010
Location: Chesterfield, UK
Posts: 248
Default

I`m using a bcr2000 and a novation launchpad.
I use the launchpad for transport, and custom actions, the bcr is used with all encoders sending 14bit relative midi with acceleration so I dont get feedback but I also dont get jumps in values.

I tried to set up the launchpad to toggle the metronome on/off through PD and it did work from launchpad to PD to Reaper but not the other way round.
I also tried with actions but only got as far as reaper receiving the message in the listen box.

I dont know much about pd and I`m not sure if I want to delve in that deep tbh, I had a play last night and this morning but it would take me ages to set up all my stuff to get parameter feedback and to get the launchpad to reflect states in reaper (and vice versa).

I do like the parameter display though, that has great potential, especially if you could somehow build something with arduino to have an actual hardware display if that`s possible?
gridlove is offline   Reply With Quote
Old 02-21-2012, 06:09 AM   #34
schwa
Administrator
 
schwa's Avatar
 
Join Date: Mar 2007
Location: NY
Posts: 15,749
Default

Quote:
Originally Posted by Banned View Post
Plugin parameters do not seem to respond when you send them the exact values 0 and 1.
I'm not seeing this when sending OSC directly to REAPER, so it might be something caused by the middleware processing you are doing. You can test with reascript:

RPR_OscLocalMessageToHost("/track/1/fx/1/fxparam/1/value", 1.0);

That does set the FX parameter to its maximum value, as expected.

If you are doing some external MIDI-to-OSC processing, code like
Code:
oscvalue=midivalue/128
would result in exactly 1 never being sent (since midivalue is in the range [0,127] inclusive).
schwa is offline   Reply With Quote
Old 02-21-2012, 06:22 AM   #35
Banned
Human being with feelings
 
Banned's Avatar
 
Join Date: Mar 2008
Location: Unwired (probably in the proximity of Amsterdam)
Posts: 4,868
Default

Quote:
Originally Posted by gridlove View Post
I`m using a bcr2000 and a novation launchpad.
I use the launchpad for transport, and custom actions, the bcr is used with all encoders sending 14bit relative midi with acceleration so I dont get feedback but I also dont get jumps in values.
Did that 'just work' or did you have to modify the Pd patches?
Quote:
Originally Posted by gridlove View Post
I tried to set up the launchpad to toggle the metronome on/off through PD and it did work from launchpad to PD to Reaper but not the other way round.
I also tried with actions but only got as far as reaper receiving the message in the listen box.
Haven't tried the metronome yet myself, but just report any bugs you come across here (the /action bug has already been reported).
Quote:
Originally Posted by gridlove View Post
I dont know much about pd and I`m not sure if I want to delve in that deep tbh, I had a play last night and this morning but it would take me ages to set up all my stuff to get parameter feedback and to get the launchpad to reflect states in reaper (and vice versa).
Yeah, don't get in there any deeper than you have to get the job done. And before diving in really deep, one may also want to consider investing in Max, which is a bit more polished, so to speak. I'll probably use Max myself; I'm using Pd here mainly for reasons of accessibility to the entire community (it even runs on my iPhone ).
Quote:
Originally Posted by gridlove View Post
I do like the parameter display though, that has great potential, especially if you could somehow build something with arduino to have an actual hardware display if that`s possible?
Yeah, afaik Pd has interaction with Arduino covered pretty well. But since I already have a few iPhones, I'll probably use their displays in some way. Plenty of options.
__________________
˙lɐd 'ʎɐʍ ƃuoɹʍ ǝɥʇ ǝɔıʌǝp ʇɐɥʇ ƃuıploɥ ǝɹ,noʎ
Banned is offline   Reply With Quote
Old 02-21-2012, 06:27 AM   #36
Banned
Human being with feelings
 
Banned's Avatar
 
Join Date: Mar 2008
Location: Unwired (probably in the proximity of Amsterdam)
Posts: 4,868
Default

Quote:
Originally Posted by schwa View Post
I'm not seeing this when sending OSC directly to REAPER, so it might be something caused by the middleware processing you are doing. You can test with reascript:

RPR_OscLocalMessageToHost("/track/1/fx/1/fxparam/1/value", 1.0);

That does set the FX parameter to its maximum value, as expected.

If you are doing some external MIDI-to-OSC processing, code like
Code:
oscvalue=midivalue/128
would result in exactly 1 never being sent (since midivalue is in the range [0,127] inclusive).
Thanks for the feedback, I'll look into it a bit further. My description ("exactly") was probably not worded very well; what I was seeing, is that it did not respond to 0 and 1 (while anything containing a digit did work); probably Pd is formatting 1.0 and 0.0 as 1 and 0, while REAPER expects to see 1.0 and 0.0. I'll see whether I can get Pd to send 1 and 0 formatted as 1.0 and 0.0 somehow, I guess.
__________________
˙lɐd 'ʎɐʍ ƃuoɹʍ ǝɥʇ ǝɔıʌǝp ʇɐɥʇ ƃuıploɥ ǝɹ,noʎ
Banned is offline   Reply With Quote
Old 02-21-2012, 06:32 AM   #37
schwa
Administrator
 
schwa's Avatar
 
Join Date: Mar 2007
Location: NY
Posts: 15,749
Default

OSC doesn't have a sense of "formatting", but it does have typed values (integers vs floating point numbers). REAPER would ignore an fxparameter message that had an integer argument, so perhaps the program you are using is automatically sending an integer if the floating point value is exactly zero or 1.
schwa is offline   Reply With Quote
Old 02-21-2012, 06:40 AM   #38
Banned
Human being with feelings
 
Banned's Avatar
 
Join Date: Mar 2008
Location: Unwired (probably in the proximity of Amsterdam)
Posts: 4,868
Default

Quote:
Originally Posted by schwa View Post
OSC doesn't have a sense of "formatting", but it does have typed values (integers vs floating point numbers). REAPER would ignore an fxparameter message that had an integer argument, so perhaps the program you are using is automatically sending an integer if the floating point value is exactly zero or 1.
Yes, that'll be it probably. I'll look into it at Pd's end, there's probably some way to typecast the values.

But wouldn't it also be a good idea to have REAPER recognize 0 and 1 as valid values for fxparameter messages, even though they're sent typed as integers?
__________________
˙lɐd 'ʎɐʍ ƃuoɹʍ ǝɥʇ ǝɔıʌǝp ʇɐɥʇ ƃuıploɥ ǝɹ,noʎ
Banned is offline   Reply With Quote
Old 02-21-2012, 07:10 AM   #39
schwa
Administrator
 
schwa's Avatar
 
Join Date: Mar 2007
Location: NY
Posts: 15,749
Default

Quote:
Originally Posted by Banned View Post
But wouldn't it also be a good idea to have REAPER recognize 0 and 1 as valid values for fxparameter messages, even though they're sent typed as integers?
I understand your point, but the purpose of typing values is to ensure consistency of meaning between data senders and receivers. 0 and 1 would be the only integer values that have any meaning in this context, and sending an integer to do a floating point job indicates an error on the sender's part that should be handled unambiguously by the receiver.
schwa is offline   Reply With Quote
Old 02-21-2012, 07:25 AM   #40
Banned
Human being with feelings
 
Banned's Avatar
 
Join Date: Mar 2008
Location: Unwired (probably in the proximity of Amsterdam)
Posts: 4,868
Default

Quote:
Originally Posted by schwa View Post
I understand your point, but the purpose of typing values is to ensure consistency of meaning between data senders and receivers. 0 and 1 would be the only integer values that have any meaning in this context, and sending an integer to do a floating point job indicates an error on the sender's part that should be handled unambiguously by the receiver.
Gotcha. I'll try to see whether (probably) it's something silly I did (should probably remove an [int] module somewhere; I also haven't looked much at the raw bytes transmitted yet), otherwise, if this is the way the Pd / the Pd OSC externals work, I should probably report it as a bug on their end.
__________________
˙lɐd 'ʎɐʍ ƃuoɹʍ ǝɥʇ ǝɔıʌǝp ʇɐɥʇ ƃuıploɥ ǝɹ,noʎ
Banned 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 11:23 AM.


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