Sustaining midi notes through OSC with Osculator

I have an oF sketch that sends OSC messages to OSCulator. This lets me play midi notes on VST synths in Ableton Live. My problem is that when a message is sent the note plays for a second and then immediately stops. I tried looping the message but that just loops the midi note so it sounds like I’m stabbing the synth key repeatedly. I’m not sure if the problem is with how I’m coding things or how I have Osculator set up. I posted in their forum and the response I got was:

“I guess there is a problem with the messages you send to OSCulator.
You should send a message with a value over 0.5 to trigger a note ON, and under 0.5 to trigger it OFF.
There is no need to “sustain” the note and this has nothing to do with TouchOSC.”

How would I go about sending larger message values out of oF? Anyone else run into this problem?

can you post some code?

haven’t work with osculator but usually a note on triggers the envelope or the note and it remains in the sustain level till a note off arrives which triggers the decay. perhaps you’re sending a note off just after the note on?

it can also depend on the synth you’re sending the message to, for example a drum cannot be sustained.

I’m reading byte data through the serial port coming from touch sensors on an arduino. Any time I trigger the arduino, availVal changes and oF reads the incoming byte message. I have it set up so there is only one byte message coming in at atime from arduino. When I trigger the touch sensor, arduino sends one message (depending on which of the 20 sensor inputs I hit). If I keep my finger on the sensor, no other bytes are sent until I release it. Then it sends myByte == 0. Right now I just have a bunch of if statements sending all the OSC messages out. I didn’t include them all because there are 20 (21 including zero), which is a lot of code to look at.

void testApp::update(){
int serialAvail = serial.available();

int availVal = 0;
int lastAvailVal = 0;

availVal = serial.available();

if (availVal != lastAvailVal) {

int myByte = serial.readByte();

printf(“myByte: %d\n”, myByte);

if (myByte == 0){
ofxOscMessage m;
m.setAddress( “/keyz” );
m.addStringArg( “Zero” );
sender.sendMessage( m );
}

else if (myByte == 1){
ofxOscMessage m;
m.setAddress( “/keyz” );
m.addStringArg( “One” );
sender.sendMessage( m );
}

else if (myByte == 2){
ofxOscMessage m;
m.setAddress( “/keyz” );
m.addStringArg( “Two” );
sender.sendMessage( m );
}

//---------- etc for all 21 myByte values.
//-------and then…

}

lastAvailVal = availVal;
}

Also,
Just to compare what I was doing to one of the prepackaged examples for OSCulator, I tried controlling one of their example templates with an ipod touch. When I press a virtual key on the Ipod I see a message come in and immediately go off in OSCulator, but the note in Ableton plays until I release my finger on the ipod touch. Then I see a second OSC message register in the monitor window. So in their example ON comes in and leave the note on until OFF comes in. But when I send OSC from oF, ON comes in to OSCulator and the note plays and goes right off despite no OFF being sent from oF (as far as I can tell). I’m using the same VST synth in Ableton so it should definitely be able to sustain notes. Also, as far as I can tell my setup in OSCulator for oF is pretty comparable to the setup in their ipod example. I think I am missing something or making a mistake in my code in oF.

I think I figured it out. The problem had to do with how I was handling my address calls. I needed to have a separate address for every key and I didn’t really have that. I used

m.setAddress( “/keyz” );

with

m.addIntArg( 1 );

or

m.addStringArg( “one” );

to differentiate the individual keys.

What I needed to do instead was:

m.setAddress( “/keyz/one” );

m.setAddress( “/keyz/two” );

etc.

then I need to send

m.setAddress( “/keyz/one” );
m.addFloatArg( 1.0 );

to turn note one ON, and

m.setAddress( “/keyz/one” );
m.addFloatArg( 0.0 );

to turn note one OFF.

and

m.setAddress( “/keyz/two” );
m.addFloatArg( 1.0 );

to turn note two ON, and

m.setAddress( “/keyz/two” );
m.addFloatArg( 0.0 );

to turn note two OFF.

I’m still playing around with what the best way to structure this is, but I have it working.

Hello brettburton.
I’m about to start a project where I need to do pretty much the same thing you did.
Did you bump into any other problem? Any tips or advices?
Thank you.

It’s been awhile since I worked on this, so my brain is pretty foggy as far as what problems I had. I remember I had some odd issues just with naming the addresses. I tried to throw them all into an array but it glitched when I changed the naming convention for the addresses in Osculator. I wound up using individual lines of code for each of them, but I could probably have cleaned it up if I went back to it. Other than that, I didn’t have too many issues. Feel free to email me if you get stuck. It might help if you explained what you’re doing in more detail, so I can see how similar it is to what I did.