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 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 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.
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)
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?
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:
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.
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);
}
oh nooooooooooooo, i can't believe it!!! It is actually WORKING!!!
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!
=)
I took a close look and, indeed, some of the piezo wires were a bit loose from all the moving around. I fixed that and now they all play a different not and i run the Serial <> Converter through Processing.
When i now open the MIDI Monitor i get this kind of result:
*** ZERO *** From Xilof OUT Note On 1 D3 127
*** ZERO *** From Xilof OUT Note Off 1 D3 127
*** ZERO *** From Xilof OUT Note On 1 F3 127
*** ZERO *** From Xilof OUT Note Off 1 F3 127
*** ZERO *** From Xilof OUT Note On 1 A3 127
*** ZERO *** From Xilof OUT Note Off 1 A3 127
(from pressing 3 piezos in sequence)
So, is it now ok to assume the "assembly" and Midi Conversion parts are working fine?
= = = = = = = = = =
So, my next step would involve two things: add some LEDs and add some controls.
LEDs
I would like to add an LED to each piezo, that would light up when we play and then would slowly fade out (maybe 1 second)
What would be the easiest way to achieve this?
Controls
I would like to add 4 buttons (MIDI, that i could then assign for things like Play, Stop, trigger some event, change sound,...)
and add also 4 knobs (that could be assigned for things like volume, modulation, tempo,...)
Would this be easily done by just enabling one other multiplexer from the code?
Any extras you add are going to increase the latency because the code has to look at them as well. Anyway you can pile on the extras until it gets too much.
You should have some spare pins left on the arduino.
So i can just add normal buttons to a digital pin? This shouldn't then be a problem, at the moment i am using only 3 of the digital pins.
With the LEDs the simplest from a programming point of view is to add a shift register:-
for the LEDs, i have a couple of 74HC595N. I saw http://arduino.cc/en/Tutorial/ShiftOut that we can use it to plug several LEDs. But i would have really NO IDEA on how to right a code reading which piezo was played and telling which LED should light up!
Well, i think i will start with the buttons. Maybe that is something accessible for my level.
Anyway, i don't have anymore multiplexers, so i need to wait until tuesday when i'm going to town to buy one more.
Two things, that schematic has an error, there should be no capacitor on the latch pin. Second that software will not give you the fading you want. Use the code in the link for that.
Just do a few examples, given in the link, and you will get the hang of how to control the shift registers.