|
|
|
03-20-2019, 09:05 AM
|
#1
|
Human being with feelings
Join Date: Jun 2009
Location: Croatia
Posts: 4,593
|
Help from OSCII bot wizards (OSC to MIDI)
Hi guys, I need a little help urgent. Can someone please write me an example OSCII script that will:
1.Capture incoming OSC msg
2.Display it
3.Convert to XY midi msg
4.not sure if possible but resend incomming OSC to another IP? (this is optional)
?
I have one program that spits out lots of OSC msgs and I need to convert them to even more MIDI msgs.I've checked sample scripts but still do not understand how to display ANYTHING (even incoming OSC does not work/show anything, I'm getting them in Reaper with no problem).
Code:
@input test OSC "192.168.0.23:8000"
@init
gfx_init("show input and output", 320,200);
function showmsg(type, desc, wp) local(colpos,w,h,str)
(
gfx_setfont(1,"Verdana",max(gfx_h/16,10));
gfx_a=1;
gfx_mode=0;
sprintf(str=#,"%s message: %s\n",type,desc);
gfx_measurestr(str,w,h);
gfx_x=gfx_w/2-w/2+2;
gfx_y=wp - h/2;
gfx_r=gfx_g=gfx_b=0;
gfx_drawstr(str);
gfx_r=0.5+0.5*cos(colpos);
gfx_g=0.7+0.3*cos(colpos+$pi/4);
gfx_b=0.6+0.4*cos(colpos+$pi/8);
colpos+=0.03;
gfx_x=gfx_w/2-w/2;
gfx_y-=2;
gfx_drawstr(str);
);
@oscmsg
showmsg(msgdev==test ? "OSC-IN" : "OSC-OUT", oscstr,gfx_h*.4);
@timer
gfx_clear=-1;
gfx_x=gfx_y=0;
dx=gfx_w*0.01;
dy=gfx_h*0.01;
gfx_a=1.0;
gfx_blit(-1,0,0.003,dx,dy,gfx_w-2*dx,gfx_h-2*dy,0,0,gfx_w,gfx_h);
gfx_a=0.01;
gfx_r=gfx_g=gfx_b=0;
gfx_rect(0,0,gfx_w,gfx_h);
This does not output anything, IP is good,port is good,reaper can see this messages (OSC LISTEN), so something is missing here
A simple example of a script will be sufficient for me to do the rest.
Thank you very much
Last edited by Sexan; 03-20-2019 at 10:31 AM.
|
|
|
03-20-2019, 02:21 PM
|
#2
|
Human being with feelings
Join Date: Feb 2009
Location: Reaper HAS send control via midi !!!
Posts: 4,031
|
This is my joyosc.txt I am using, maybe some parts help you?
PHP Code:
@input osc_in OSC "localhost:8880"
@output osc_out OSC "localhost:8000"
// @input midi_bus MIDI "Midi Through Port-7"
// @output osc_output OSC "127.0.0.1:8000" 0 0 // localhost = 127.0.0.1 (IPv4)
@init
// log = 1;
max=32767;
min=-32768;
// ------------------------------
function logOsc()
// ------------------------------
(
#pattern = oscstr;
msgdev == HOST_IN ? device = host_name : device = "scripts";
device != old_device ? (
old_device = device;
printf("\nOSC from %s: ", device);
):(
printf("\n ");
);
oscparm(idx,type);
type=='s' ? (
oscparm(0,'s',#string);
printf("%s Value: %s",#pattern,#string);
):(
type=='i' ? (
val=oscparm(0,'i');
printf("%s Value: %i",#pattern,val);
):(
val=oscparm(0,'f');
printf("%s Value: %f",#pattern,val);
); );
); // end of function
@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_out, control, value);
/* logOsc(); */
/* oscmatch("/joyosc/devices/gc0/button") ? ( */
/* oscPar = oscparm(0,0); //get parameter name */
/* oscVal = oscparm(1,0); //get parameter value */
/* printf("button was pressed:\n " + oscVal); */
/* ); */
/* oscmatch("/joyosc/devices/gc0/axis")? printf(" axis was moved\n"); */
// DEMO ONLY is incoming OSC message from parameter 1 of fx 1 of track 1 ?
/*
oscmatch("/track/1/fx/1/fxparam/1/value") ? (
oscVal = oscparm(0,0); //get parameter value
ccVal = floor(oscVal*127+0.5); //scale (round) to int between 0 and 127
msg1 = 0xB0 | ch ; //set midi-message to send a CC event to specified channel
msg2 = ccNo; //set CC number
msg3 = ccVal; //set CC value
midisend(midiOut); //send msg1/msg2/msg3
);
*/
// ===================== END ================================================
|
|
|
03-20-2019, 02:24 PM
|
#3
|
Human being with feelings
Join Date: Feb 2009
Location: Reaper HAS send control via midi !!!
Posts: 4,031
|
Did you define osc output?
|
|
|
03-20-2019, 02:34 PM
|
#4
|
Human being with feelings
Join Date: Jun 2009
Location: Croatia
Posts: 4,593
|
I've got OSC input to work, now I'm searching how to send midi msg out
Code:
@input midi_out MIDI "loopMIDI Port"
msg1 = 90;
midisend(midi_out);
not working atm (do not know what I am doing)
how do you define midi messages? how do you know which is what?
I'm cluelessly searching forum and google...
for example I just want to send a random note out
edit :
my bad
Code:
@output midi_out MIDI "loopMIDI Port"
msg1 = 90;
midisend(midi_out);
Now how to send a note,with some velocity on some channel ?
Last edited by Sexan; 03-20-2019 at 03:20 PM.
|
|
|
03-21-2019, 04:39 AM
|
#5
|
Human being with feelings
Join Date: Feb 2009
Location: Reaper HAS send control via midi !!!
Posts: 4,031
|
Maybe something like
for cc
PHP Code:
ch = 8; // for midi channel 9
ccNo = 1;
ccVal = 100;
msg1 = 0xB0 | ch ; //set midi-message to send a cc event to specified channel
msg2 = ccNo; //set CC number
msg3 = ccVal; //set CC value
midisend(midiOut); //send msg1/msg2/msg3
for note
PHP Code:
ch = 8; // for midi channel 9
pitch = 36;
velocity = 127; // max velocity
msg1 = 0x90 | ch ; //set midi-message to send a note event to specified channel
msg2 = pitch; //set pitch, e.g. 36 for kick on ch 10
msg3 = velocity; //set note velocity
midisend(midiOut); //send msg1/msg2/msg3
Last edited by TonE; 03-21-2019 at 04:46 AM.
|
|
|
03-21-2019, 10:28 AM
|
#6
|
Human being with feelings
Join Date: Jun 2009
Location: Croatia
Posts: 4,593
|
Figured it all out, thank you for your help
|
|
|
03-23-2019, 12:47 PM
|
#7
|
Human being with feelings
Join Date: Jun 2009
Location: Croatia
Posts: 4,593
|
how do you get osc msg value?
/test/val, 25 ?
Last edited by Sexan; 03-23-2019 at 01:01 PM.
|
|
|
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 08:21 AM.
|