MIDI Xilophone (over serial) to Ableton

Do you get any sound from tapping the sensors generated in processing?

no, i get no sound...

This morning i was reading the code from the Converter (which i am opening in Processing) and i noticed that it sais that having mmj installed makes some kind of bug.

I went to uninstall it, restarted the computer, opened again Processing...

...and got still the same result!

When baud rates are at the same speed i get only red light and no signal in Midi Monitor!
:confused:

OK, try this. Can you replace the Extensions folder with this one attached and see if it makes any difference.
It is to be found at:-
Macontosh HD -> Library -> Java

What version of the OS are you on?
It might be worth searching for people who have had trouble with Serial <> MIDI with your version.

If this doesn't work then we might have to explore going directly into Ableton. I don't have it but I could download the trial version and see what can be done directly.

Extensions.zip (27.3 KB)

i have osx 10.6.8

i have replaced the extension folder and it still doesn't work, but i got an error message from Processing:

Stable Library

Native lib Version = RXTX-2.1-7
Java lib Version = RXTX-2.1-7
RXTX Warning: Removing stale lock file. /var/lock/LK.008.011.010

Bah... =/

If i would add a MIDI out port to the setup, would it mean i had to change all the code?

= = = = = = = =

Let me see if i am doing things right.

I plug the Arduino via USB.
Open Arduino software and upload the sketch.
"play" a couple of piezos to confirm i get the TX light in arduino board.
Open Processing and the SMv2d sketch.
Run the sketch.

?

i have osx 10.6.8

Me too.

I plug the Arduino via USB.
Open Arduino software and upload the sketch.
"play" a couple of piezos to confirm i get the TX light in arduino board.
Open Processing and the SMv2d sketch.
Run the sketch.

Sounds OK as well, as long as the arduino serial monitor window is not open.

When I run processing I just get:-

Stable Library

Native lib Version = RXTX-2.1-7
Java lib Version = RXTX-2.1-7

That error message :-
RXTX Warning: Removing stale lock file. /var/lock/LK.008.011.010
might mean you have to find that file and then delete it. Then restart processing, worth a try.

i can't find that file. Not even the folder...
=/

RXTX Warning:  Removing stale lock file. /var/lock/LK.008.011.010

Is just a warning. It's telling you that it removed the stale file, that's why you can't find it.

I couldn't run the stand alone application on my machine until is set it to run in 32 bit mode.
Click on the Serial_MIDI_Converter_V2D icon. Then select information from the finder and click the open in 32 bit mode in the window.
Now it opens fine. It might be worth trying this and see if it improves things. You could also try running Processing in the 32 bit mode as well.

The message

RXTX Warning: Removing stale lock file. /var/lock/LK.008.011.010

come when i chose the "Midi Out Port".

Then when i press any of the piezodisks the only thing i get is the Serial RX Light blinking RED!!

I now tried running the both the stand alone application and Processing in 32-bit mode. Everything goes exactly the same.

If the lights blink red, it means that at least some kind of information is getting to Processing (?). Is it possible to see WHAT is getting there?

= = =

I am getting king of crazy (sad, frustrated, desperate,..., curious,...) , so i am tried something that maybe is also not so smart...
should the Arduino code run on Processing also?

I copied it into Processing and i got an error saying :

unexpected token: unsigned

processing.app.SketchException: unexpected token: unsigned
at processing.mode.java.JavaBuild.preprocess(JavaBuild.java:326)
at processing.mode.java.JavaBuild.preprocess(JavaBuild.java:197)
at processing.mode.java.JavaBuild.build(JavaBuild.java:156)
at processing.mode.java.JavaBuild.build(JavaBuild.java:135)
at processing.mode.java.JavaMode.handleRun(JavaMode.java:176)
at processing.mode.java.JavaEditor$20.run(JavaEditor.java:481)
at java.lang.Thread.run(Thread.java:680)

the error was refering to this line of the code:

unsigned char PadNote[8] = {60,62,64,65,67,69,71,72};

well, maybe that is supposed to happen...

I am getting king of crazy (sad, frustrated, desperate,..., curious,...)

Yes it is understandable. I don't think there is a sympathy smilie.

should the Arduino code run on Processing also?

No, while the syntax is similar it is the language C in the Arduino and Java in Processing, so it will not work.

Is it possible to see WHAT is getting there?

You can add print statements to processing to look at any variables while it is running. That could give you an insight into what is happening.
I was asking a friend about this yesterday and he said he had trouble with this program at first and it was down to the way the MIDI configured using the Audio MIDI setup application. The website for the serial <> MIDI converter had a guide to setting this up have you gone through this?

Yes, when installed the Serial <> MIDI i have followed the instruction in their website on how to set things up.

i will try to get some kind of Serial Port Monitor and see if i can get some info there also...

i have just tried a Serial Monitor (Serial Tools) and i got the same. i got green light blinking and the same value as before with the "Midi information".
I guess this means the serial information is arriving ok?

= = = = =

When i got to the Audio MIDI Setup -> Preferences and then choose Information, i get this:

Can it be that i am missing something i should have? Can i have something outdated?

It looks the same as mine, attached.

I think we need to find out where it is going wrong.
Can you run up a sketch that talks from the arduino into processing.
Just something on the arduino that prints a string every second, and the processing prints out what it receives.
That would check the serial path into processing.
There is a sketch in Examples -> Library -> Serial -> Simple read.
After the :-

val = myPort.read();

put a

println(val);

You should then be printing the ASCII value of the bytes you receive from the arduino.

FWIW, I can't get it to work either. I've done a number of Arduino to Processing serial things successfully. I have Lion - 10.7.3.

Just to make sure we are on the same page.
This is the arduino sketch I have been using to test the MIDI input. It just generates random chimes. Run it on the arduino and see if the Serial <> MIDI make sense of it:-
If you choose the Java Synth option you should here the chimes.

/* Midi note fire - Mike Cook March 2012
 *
 * ----------------- 
 * send MIDI serial data, automatically for a test
 * 
###############################################################################################

HARDWARE NOTE:
The MIDI Socket is connected to arduino TX through a PNP transistor to invert the MIDI signal.
A common anode RGB LED is pulled down through pins 9, 10, 11

################################################################################################
*/
 #define MIDI_TEST   // un comment for a test to format the data for the serial monitor

#define midiChannel (byte)0
void setup() {
 //  Setup serial
   Serial.begin(9600);    // Serial speed
   programChange(0xc0, 14);  // Change MIDI voice

}

//********************* MAIN LOOP ***********************************

void loop() {
  int val;
  val = random(20,100);
    noteSend(0x90, val, 127);
    delay(200);
    noteSend(0x80, val, 127);
   delay(800);
    } // end loop function
    
//********************* Functions *********************************** 


//  plays a MIDI note
 void noteSend(char cmd, char data1, char data2) {
  cmd = cmd | char(midiChannel);  // merge channel number
  Serial.write(cmd);
  Serial.write(data1);
  Serial.write(data2);
}
//  change the voice
 void programChange(char cmd, char data1) {
  cmd = cmd | char(midiChannel);  // merge channel number
  Serial.write(cmd);
  Serial.write(data1);
}

//  change the bank
void bankChange(char cmd, char data1) {
  Serial.write(0xB0 | char(midiChannel));  // control change
  Serial.write(cmd);
  Serial.write(data1);
}

OK I think I have cracked it.
You need to change the MIDI_TX() function in your code to this:-

void MIDI_TX(unsigned char MESSAGE, unsigned char PITCH, unsigned char VELOCITY)
{
  status = MESSAGE + midichannel;
  Serial.write(status);
  Serial.write(PITCH);
  Serial.write(VELOCITY);

Then make sure the baud rate is set the same between MIDI and Arduino.

Sorry for taking so long and not having spotted this before.

Mike, your test code worked ok for me.

It seems to be working fine for me now. I might have had the Midi setup wrong. I can pass midi into Live now.

oh nooooooooooooo, i can't believe it!!! It is actually WORKING!!! :smiley:

There are two piezos not working and one that plays two notes at the same time. But i'll take a look at this tomorrow when there is more light and i have some more energy (probably i have some connections in the breadboard that opened from all the moving around)!

THANK YOU SOOOO MUCH! I think this has been a great step towards making this project come true!
=)

Stay tuned for the next chapter...
:wink: