Thread: String to Hex
View Single Post
Old 07-02-2022, 07:53 PM   #1
procedure
Human being with feelings
 
Join Date: Jun 2022
Posts: 11
Default String to Hex

Hi.
I'm testing OSC output from TouchOSC and hoping to convert OSC to Midi to send to my DAW. TouchOSC can send Midi directly but I'm just testing using it for now.
I'm able to capture an OSC message and multiple parameters. In all my tests, OSCii-bot will only receive OSC parameters that are strings. I can send out an Integer or Float of course but OSCii-bot will not read it.

I created a Fader for testing in TouchOSC called "/Note" with 2 string parameters. The 1st parameter outputs "60" to represent the Middle C note. The 2nd parameter outputs the fader level to represent Velocity from 0-127.

I'm able to log the OSC message using the following code:
Code:
oscmatch("/Note",$'s') ? (
	  oscparm(idx,type);
	  type=='s' ? (
		    #note = null; #volume = null; //must use #variables
		
		    oscparm(0,'s',#note);
		    oscparm(1,'s',#volume); 

		    printf(oscstr);
		    printf (" Note: ");
		    printf (#note);
		    printf (" Volume: ");
		    printf(#volume);
	  );
);
How can I convert the string output to Hex in order to create my msg1, msg2 and msg3 needed to output Midi? I have researched this forum and don't see the solution to this seemingly obvious question. FYI, you can probably tell I'm not a programmer. Just trying to get by using the examples I see. This took me a very long time to cobble together the code above ha ha.
Thank you.

Last edited by procedure; 07-07-2022 at 09:45 AM.
procedure is offline   Reply With Quote