Offline
vienna

Hi there,

I tried to bring this to the arduinoboy group and to trash80 directly, as well as on 8bc, but still no luck with an answer, maybe I get one here? smile

I'm trying to build an arduino-based hardware controller for mGB, but I'm getting quite random results when sending MIDI data with the sendByteToGameboy(byte send_byte) function from arduinoboy. As far as I understand from the code, the MIDI command is sent bitwise, and each bit goes along with two clock signals, one 0, one 1.

What I'm wondering right now is whether that's all it takes to control mGB (and therefore I just don't quite get MIDI) or if the transmission must also be at a specific baud rate (like the 31250bps for MIDI). If the baud rate matters, I guess I could use the serial out of the arduino to send the data to the DMGs serial in, but I'm puzzled how to send the clock signal at the same time. I guess I could also just send MIDI date through serial out to an arduinoboy, but I'd prefer to keep ist simple and direct between the controller and mGB.

Offline
vienna

no one? :-(

*bump*

Offline
Los Angeles

ok so...

but I'm getting quite random results when sending MIDI data with the sendByteToGameboy(byte send_byte) function from arduinoboy.

Note: low battery power can also result in wacky behavior.

As far as I understand from the code, the MIDI command is sent bitwise, and each bit goes along with two clock signals, one 0, one 1.

Correct

What I'm wondering right now is whether that's all it takes to control mGB (and therefore I just don't quite get MIDI)

Yes, the midi processing is done inside of mGB itself, all the arduino does is push the bytes to the gb.
this site helps in understanding how midi works: http://www.gweep.net/~prefect/eng/refer … ispec.html

or if the transmission must also be at a specific baud rate (like the 31250bps for MIDI).

Yeah the only important thing here is if the bytes come in too fast the gameboy wont be able to read them. so to be safe I would not run serial at anything faster than 38000baud, but it might be better to go slower than midi, not faster- if you have the option.

As for the rest, the easiest first step would be to use the arduino's usb serial at a baud of 38000, you need to have arduinoboy code work at that rate, which is already in the code as:
boolean usbMode   = true; //sets the baud to 38000

And use some program (max,pd,processing) to send midi serial data to the arduino.

Offline
vienna

Thanks for the answer smile I don't really get, what you're describing with your easiest first step (the whole thing should generate the MIDi data in the arduino without the need of a PC), but I guess I were just going too fast when I expected to be too slow. Guess I should do a little math now smile

Offline
Los Angeles

sendByteToGameboy(0x90);   //note on channel 1
delay(1);
sendByteToGameboy(0x30);   // note pitch   (range 0x00 - 0x7F)
delay(1);
sendByteToGameboy(0x7F);   // note velocity   (range 0x00 - 0x7F)

should work

Offline
vienna

Just tried, the delay works big_smile thanks again, also for arduinoboy and mGB smile