Old 05-14-2017, 12:00 AM   #1
ljekio
Human being with feelings
 
Join Date: Nov 2009
Posts: 15
Default OSC to MIDI simple script

Hello, Im noob in scripting and almost all examples of scripts for OSCIIbot inaccessible now.
Can I request to help me create simple script what receive one parameter from OSC and translate it to custom MIDI port as CC#100 and midi channel 16?
ljekio is offline   Reply With Quote
Old 05-16-2017, 02:28 AM   #2
goldenarpharazon
Human being with feelings
 
Join Date: Feb 2016
Posts: 189
Default

Take a look at the simple "alphatrack.txt" example script bundled with OSCII-bot itself. "sample_script.txt" there should also be helpful. Try them out whilst looking at the associated Midi and OSC traffic in OSCII-bot's console window, or along with a Midi monitor and one can see what they do. Modify these examples one step at a time to gradually become what is wished.


For more complex fully worked script examples that have plenty of explanatory comments see the scripts for the Peavey StudioMix available at http://forum.cockos.com/showpost.php...&postcount=284 or the Akai MIDIMIX at http://forum.cockos.com/showthread.php?t=172908
goldenarpharazon is offline   Reply With Quote
Old 05-16-2017, 10:56 PM   #3
ljekio
Human being with feelings
 
Join Date: Nov 2009
Posts: 15
Default

Thanks, but I did not succeed. I do not know how to write functions correctly to receive the osc parameter that I need.
These examples are too complicated for me, I can not achieve the elementary thing yet.
ljekio is offline   Reply With Quote
Old 05-17-2017, 02:26 AM   #4
goldenarpharazon
Human being with feelings
 
Join Date: Feb 2016
Posts: 189
Default

One needs the correct call to oscmatch(...) in the @oscmsg block of code in the script to detect i.e. match the OSC string and then within oscmatch(...) call the corresponding Midi output.


An example of this can be seen in "alphatrack.txt" where Midi output is done after the "/track/%d/volume" string is detected. The comments in "sample_script.txt" in its oscmatch() also explains how the matching works. The pattern string varieties are set out at http://www.cockos.com/oscii-bot/osci...doc.html#match.


There's also a very simple OSC example here http://forum.cockos.com/showpost.php...7&postcount=75 with hints on how to form different Midi output


What is the OSC string parameter to be detected in your wish, to then go on and create the corresponding matching pattern string for oscmatch(...)?

Last edited by goldenarpharazon; 05-20-2017 at 12:54 PM.
goldenarpharazon is offline   Reply With Quote
Old 05-21-2017, 11:26 PM   #5
ljekio
Human being with feelings
 
Join Date: Nov 2009
Posts: 15
Default

@goldenarpharazon, thank you for your advises.

So, in example wrote this:

Code:
(oscmatch("/track/%d/select"))  && (oscparm(0,0) > 0)?
(
	msg1 = 176;
	msg2 = 0;
	msg3 = fmt0;
	midisend(bcr2000_in);
What is "/track/%d/select"? If I know name of OSC-host and OSC sending parameter, what I must write at this string?

"msg1 = 176" its first byte (CC number), "msg2 = 0" is second byte (channel) and "msg3 = fmt0" is value from oscmatch, right?

MIDI part is clear for me, but not OSC.
ljekio is offline   Reply With Quote
Old 05-22-2017, 03:30 AM   #6
goldenarpharazon
Human being with feelings
 
Join Date: Feb 2016
Posts: 189
Default

Quote:
Originally Posted by ljekio View Post
What is "/track/%d/select"?
%d matches any integer so this will match any string like "/track/1/select" and "/track/2/select" etc.

Quote:
Originally Posted by ljekio View Post
If I know name of OSC-host and OSC sending parameter, what I must write at this string?
In your example, what is the OSC string being sent from TouchOSC and any parameters or variable parts of the string? This string will be visible in the OSCII-bot console window. This will then be used to determine the corresponding matching format string for oscmatch(...)


The way that format strings are written in EEL2 & OSCII-bot scripts is similar to the widely used "C" programming language so this explanation of format strings (for scanf in "C") might also be helpful https://wpollock.com/CPlus/PrintfRef.htm

Quote:
Originally Posted by ljekio View Post
....and "msg3 = fmt0" is value from oscmatch, right?
Yes that is right. Note that using fmt0 is deprecated but it should still work if your example needs to catch a value for use in the Midi output. The other script examples given in the earlier posts contain examples of the current recommended way of catching the matched value.
goldenarpharazon 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:29 AM.


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