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

Reply
 
Thread Tools Display Modes
Old 05-16-2018, 04:02 AM   #1
TonE
Human being with feelings
 
Join Date: Feb 2009
Location: Reaper HAS send control via midi !!!
Posts: 4,031
Default X360 as osc controller via joyosc and oscii-bot [SOLVED]

Thought let me test the OSC features of Reaper a little, connected X360 game controller in ubuntu via joyosc*, which generates nicely osc output, Reaper detects them nicely, BUT ...

OSC signals are arriving in Reaper, but when I am trying to map to some fx parameter they have no effect. Is this normal? What am I doing wrong? Or did I simply forget to switch into one of the right automation recording modes? I thought I did all correctly. Any hints?

PHP Code:
GameControlleropened 0 X360 Controller /gc0
  num buttons
11
  num axes

* https://github.com/danomatika/joyosc

SOLVED with oscii-bot:

PHP Code:
@oscmsg
oscparm
(0's'#string);
value oscparm(1);
oscmatch("/joyosc/devices/gc0/axis") ? (
                                           
value value/(max-min)+0.51;
                                       );
printf("string: %s\nparam 1: %s\nparam 2: %f\n\n"oscstr#string, value);
control sprintf(#,"%s%s", "f/",#string);
oscsend(osc_outcontrolvalue); 
You can replace tools like this, only better, as you have complete control over its implementation.

https://www.youtube.com/watch?v=36DKVLwmp0I

Last edited by TonE; 12-07-2018 at 02:23 PM.
TonE is offline   Reply With Quote
Old 05-17-2018, 02:19 AM   #2
TonE
Human being with feelings
 
Join Date: Feb 2009
Location: Reaper HAS send control via midi !!!
Posts: 4,031
Default

This check is already enabled here.

I have also following two settings.
PHP Code:
                                  Pattern: Default
ModeLocal port (receive only
TonE is offline   Reply With Quote
Old 05-18-2018, 10:48 AM   #3
azslow3
Human being with feelings
 
Join Date: Nov 2017
Location: Heidelberg, Germany
Posts: 797
Default

I can be wrong and I can not test at the moment, but from the description it seems like joyosc sends quite specifically formated OSC messages. Probably Reaper can not work with it:
Quote:
joyosc streams device event information in the following OSC address format:

/joyosc/devices/DEVICE_NAME/INPUT_TYPE ID VALUE
...
axis values are -32767 to 32767 (signed 16 bit)
So, the first parameter is "ID" and the second is (non standard in audio world range) signed integer.

Usual format is "</name> <value>", where <value> is float from 0. to 1.
azslow3 is offline   Reply With Quote
Old 12-05-2018, 02:41 AM   #4
TonE
Human being with feelings
 
Join Date: Feb 2009
Location: Reaper HAS send control via midi !!!
Posts: 4,031
Default

I guess best would be then translating this via oscii-bot.

joyosc streams device event information in the following OSC address format:

PHP Code:
/joyosc/devices/DEVICE_NAME/INPUT_TYPE ID VALUE
...
axis values are -32767 to 32767 (signed 16 bit
Any ideas what would be the right syntax for oscii-bot? Something in @oscmsg block. Here an example from Stevie using oscmatch, oscparm, oscsend. I would need to convert the value to float also.

PHP Code:
@oscmsg

oscmatch
("/fx/name") + match(eqoscparm(0,s)) ? (
oscsend(osc_out"b/fx/bypass"0)
); 
Hitting the A button, Reaper receives:
/joyosc/devices/gc0/button

but joyosc sends:
/gc0 X360 Controller button: a 1
TonE is offline   Reply With Quote
Old 12-05-2018, 01:51 PM   #5
wwwmaze
Human being with feelings
 
Join Date: Oct 2009
Posts: 99
Default

You already set up your device input in the script right?

Then what's the output of this line for a full parameter twist/shift
PHP Code:
@oscmsg

printf
("string: %s\nparam 1: %f\n(param 2: %f)\n\n"oscstroscparm(0), oscparm(1)); 
wwwmaze is offline   Reply With Quote
Old 12-06-2018, 11:13 AM   #6
TonE
Human being with feelings
 
Join Date: Feb 2009
Location: Reaper HAS send control via midi !!!
Posts: 4,031
Default

Here how the output looks like:
PHP Code:
string: /joyosc/devices/gc0/button
param 1
97.000000
(param 20.000000)

string: /joyosc/devices/gc0/button
param 1
120.000000
(param 21.000000)

string: /joyosc/devices/gc0/button
param 1
120.000000
(param 20.000000)

string: /joyosc/devices/gc0/axis
param 1
108.000000
(param 2: -3504.000000)

string: /joyosc/devices/gc0/axis
param 1
108.000000
(param 2: -3394.000000



And below code
PHP Code:
@oscmsg
oscparm
(0's'#string);
printf("string: %s\nparam 1: %s\nparam 2: %f\n\n"oscstr#string, oscparm(1)); 
gives
PHP Code:
string: /joyosc/devices/gc0/button
param 1
b
param 2
0.000000

string
: /joyosc/devices/gc0/axis
param 1
lefty
param 2
: -3394.000000

string
: /joyosc/devices/gc0/button
param 1
y
param 2
1.000000

string
: /joyosc/devices/gc0/button
param 1
y
param 2
0.000000

string
: /joyosc/devices/gc0/button
param 1
x
param 2
1.000000

string
: /joyosc/devices/gc0/button
param 1
x
param 2
0.000000 
Now how can I construct an osc message for reaper which can use param 1 and param 2 for its fx parameter mappings? Param 1 I can have in string form (my example above) or as float value (example of wwwmaze), is it better just keeping those values as float always? String would help for better understanding the code, e.g. which button on X360 controller is doing what.

Last edited by TonE; 12-06-2018 at 11:20 AM.
TonE is offline   Reply With Quote
Old 12-06-2018, 11:48 AM   #7
TonE
Human being with feelings
 
Join Date: Feb 2009
Location: Reaper HAS send control via midi !!!
Posts: 4,031
Default

Almost there, this works nicely:
PHP Code:
@oscmsg
oscparm
(0's'#string);
printf("string: %s\nparam 1: %s\nparam 2: %f\n\n"oscstr#string, oscparm(1));  
control sprintf(#,"%s%s", "f/",#string);
oscsend(osc_outcontroloscparm(1)); 
But how can I control a slider parameter fully with the joystick, now it seems the mapping is fixed like a 'two state control', on and off, but nothing inbetween, even my control, the joystick is sending lots of values. Where can I define this? The joystick is sending the two parameters to Reaper.
TonE is offline   Reply With Quote
Old 12-07-2018, 06:43 AM   #8
wwwmaze
Human being with feelings
 
Join Date: Oct 2009
Posts: 99
Default

ah I see so param 1 is a string.

If you want to control a slider by the parameter "lefty" I'd try to send normalized values to Reaper.
For this you'd need to normalize to the upper and lower bounds of "lefty".

This should control volume of track 1 (completely untested)
PHP Code:
min=-4000;
max=0;

oscmatch("/joyosc/devices/gc0/axis") ? (
    
oscparm(0,'s',#strParam);
    
!strcmp(#strParam,"lefty") ? (
        
normalizedOut=oscparm(1)/(min-max);
        
oscsend(osc_out,"n/track/1/volume"normalizedOut);
    );
); 

Last edited by wwwmaze; 12-07-2018 at 06:49 AM.
wwwmaze is offline   Reply With Quote
Old 12-07-2018, 10:27 AM   #9
TonE
Human being with feelings
 
Join Date: Feb 2009
Location: Reaper HAS send control via midi !!!
Posts: 4,031
Default

Thanks, this seems to work nicely now.

PHP Code:
@oscmsg
oscparm
(0's'#string);
value oscparm(1);
oscmatch("/joyosc/devices/gc0/axis") ? (
                                           
value value/(max-min)+0.51;
                                       );
printf("string: %s\nparam 1: %s\nparam 2: %f\n\n"oscstr#string, value);
control sprintf(#,"%s%s", "f/",#string);
oscsend(osc_outcontrolvalue); 
TonE 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 12:41 AM.


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