|
|
|
05-12-2020, 03:30 PM
|
#1
|
Human being with feelings
Join Date: Jul 2015
Posts: 14
|
Triggering a ReaScript with OSC with parameters
Hello all!
I've written a functional ReaScript (Python, but irrelevant).
I'd like to:
1. Trigger the script to run as a result of a MIDI or OSC trigger.
2. Have the script incorporate a variable (incoming parameter). That parameter could be part of the OSC string, or perhaps the velocity on a MIDI note.
How can I get parameters into a ReaScript when it's called?
Thanks!
-Jason
|
|
|
05-20-2020, 11:14 PM
|
#2
|
Human being with feelings
Join Date: Aug 2007
Location: London, UK
Posts: 767
|
__________________
Quote:
Originally Posted by Tony Williams
...Playing fast around the drums is one thing. But to play with people for others, to listen to, that's something else. That's a whole other world.
|
|
|
|
05-21-2020, 03:40 AM
|
#3
|
Human being with feelings
Join Date: Jul 2015
Posts: 14
|
Creative! Thanks!
I ended up including a MySQL connector in my Python script, which finds out "what to do" based on database values. Slightly hacky, but works consistently.
|
|
|
05-21-2020, 05:33 AM
|
#4
|
Human being with feelings
Join Date: Jun 2013
Location: Krefeld, Germany
Posts: 14,690
|
Regarding Midi, a script can be triggered by a CC#/Channel combination and read the CC value. I suppose for OSC something similar holds.
-Michael
|
|
|
05-21-2020, 07:04 AM
|
#5
|
Human being with feelings
Join Date: Jul 2015
Posts: 14
|
Thanks mschnel. The script-triggering is no problem. My challenge is passing variables TO the script at the time of execution.
e.g. "Trigger this script, but this time, let n = 10", or whatever.
|
|
|
12-14-2022, 10:46 AM
|
#6
|
Human being with feelings
Join Date: Apr 2010
Posts: 59
|
What I'm after, and I think the thread above is about, is that if I send e.g.
/do/something/with 45 5.6 "hello"
as an OSC message to reaper, with /do/something/with bound to a .lua reascript,
how does my script access the 45 5.6 "hello" parameters in the OSC message?
__________________
John
|
|
|
12-15-2022, 11:37 AM
|
#7
|
Human being with feelings
Join Date: Jun 2013
Location: Krefeld, Germany
Posts: 14,690
|
AFAIU, a very recent version of Reaper's in fact did implement fetching OSC parameters (similar to Midi CC parameters, which always worked) by a script using the get_action_context() API.
I did not yet check this, so please let us know what you find.
-Michael
Last edited by mschnell; 12-15-2022 at 11:45 AM.
|
|
|
01-06-2024, 07:54 AM
|
#8
|
Human being with feelings
Join Date: Apr 2010
Posts: 59
|
Thanks. Yes, contextstr returns the parameter. But you can only send one parameter this way. If you want to send more, you have to send something as a string, and parse it inside Lua. For example you can send
/hello/world "1,2,3"
But you can't send an OSC message with three parameters. Also you must send numbers as floats (reaper discards integers).
Anyway, it's a little better knowing this. Having arbitrary parameters as a Lua table would of course be nicer.
__________________
John
|
|
|
01-08-2024, 11:02 AM
|
#9
|
Human being with feelings
Join Date: Jun 2013
Location: Krefeld, Germany
Posts: 14,690
|
Thanks for testing this !
|
|
|
Thread Tools |
|
Display Modes |
Linear Mode
|
Posting Rules
|
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts
HTML code is Off
|
|
|
All times are GMT -7. The time now is 06:14 AM.
|