Go Down

Topic: 8u2 midi (Read 2095 times) previous topic - next topic


Hello everyone

Im trying to reprogramm the 8u2 as generic MIDI device. I got as far as sending hard-coded MIDI-messages to my computer, but i cant catch the serial messages sent from my Arduino and change them to MIDI-messages.
As base file i took the Arduino-usbserial.c
I think my fault lies in taking the wrong variable as input from the atmega:
Code: [Select]

while (BufferCount--)
     channelMIDIMessages(RingBuffer_Remove(&USARTtoUSB_Buffer), buffercnt);
     if(buffercnt == 2)
           buffercnt = 0;
     } else

I thought, the function RingBuffer_Remove(&USARTtoUSB_Buffer) returns the byte read from the atmega, but i never get anything from it.


Here is my entire code from the file Arduino-usbserial.c



I would put a bounty on this.

Sadly enough, I don't know much about LUFA :( , but it's one coolest and most interesting aspects of the new arduino UNO.

hold on!


I had MIDI working in the other direction (computer to arduino) but that was easier. Even then it only seemed to work on Linux and not on Windows so I gave up.

Getting MIDI from the Arduino into the computer is a little harder. From reading the docs I think you have to wait for all the bytes of the message to come through before sending it (usually 3 bytes). So you do have to do a little parsing of the data as it comes in. Don't bother with ringbuffers, you don't need them at MIDI speeds, just send each complete message as you get it.

I might have another look at it again in the future, i have an idea for a project which might need it...
Due VGA library - http://arduino.cc/forum/index.php/topic,150517.0.html


I got it to work now, after i decided to throw out all this ringbuffer stuff since i found a very simple command to read serial messages from the arduino on this forum (Serial_IsCharReceived() and Serial_RxByte()).
The parsing i do on the function channelMidiMessage, i save the messages in an array of length 3 and as soon as i have 3 messages i put it together and send it further on.
If anyone is interested, my colleague will put the project on sourceforge as soon as were finished with it and i will post the link here ;)
Thx for the help

Go Up

Please enter a valid email to subscribe

Confirm your email address

We need to confirm your email address.
To complete the subscription, please click the link in the email we just sent you.

Thank you for subscribing!

via Egeo 16
Torino, 10131