Adding a MIDI input to a Game Boy

[Sprite_tm] is back again, and his work never fails to impress. His latest project is a Game Boy Advance MIDI synth that takes MIDI data from a keyboard or sequencer and maps that to Game Boy sound channels.

Because he seems to never do anything the normal way, [Sprite_tm] decided to run the Game Boy without a cartridge. We’ve seen this before; the GBA boots into the synth software over the link cable with multibooting.

[Sprite_tm] designed a circuit around an ATMega168 to boot the Game Boy, receive MIDI messages, then translate and send them through the link port. The main Game Boy code also has a simple interface to display graphics on the screen and a sequencer that allows him to record MIDI messages into 8 different tracks. We’re thinking that being able to sequence Game Boy chiptunes with a keyboard is a huge improvement over Little Sound DJ.

As [Sprite_tm] freely admits he’s not the best keyboard player, he gave his GBA synth to a musician friend. The resulting song is a veritable deluge of 8 bit chiptunes. The electronics behind this build are very simple (and can fit inside a MIDI cable), so we’re ready to break out the iron for this one. All the relevant code is posted [Sprite_tm]’s build page. There’s also a video walking through the features of his creation, viewable below.

21 thoughts on “Adding a MIDI input to a Game Boy

  1. Nice hack to obtain retro style GB sound. But the GBA hardware is infra utilised in this hack. GBA is capable of sample based synthesis and other nice things.

    The system is capable of 4-bit wave output acording to this link.

    1. That’s why I built in the polyphonic 8-channel software synthesizer bit on MIDI channel 4. I was thinking about adding a complete wavetable synth, but I discarded it: if you want that, you’re probably better off picking any PC softsynth anyway :)

  2. Seems to me this could(and perhaps should) be expanded upon for other purposes(like running your own code). I might have to play with this myself – I’ve got a few GBA’s laying around, would be cool if you could use them as a ready to go interface w/ an Arduino or other processor.

  3. Oh right, I’d forgotten about that. The gameboy advance can totally boot from the link cable (you can write programs for it cross-compiled with an ARM-THUMB gcc port too.) With the caveat that the programs have to be under a certain size limit (much much smaller than the carts, program basically runs from ram.)

    .. Still, way simpler than building a custom rom kart (and less risky than buying one with drivers that won’t work on any OS past windows 98… or an custom interface program that has all the dialogs in chinese…)

  4. Mikey: The limit is 256K (the size of the EWRAM in the GBA) which is actually quite huge if you’ve just finished cramming your bootloader in the 2K the AVR provides for it ;)

    1. Hey Sprite™, Do you dump the whole ARM program using the multiboot protocol or do you use some sort of two stage boot loader which switches into regular UART mode? I have been looking at doing the same thing just recently but I have a 100kb of tables I want in GBA RAM and am worried it will take a while to start up over multiboot.

      1. My program is only 14K, so the upload usually is done before the GBA is finished with all the animations it does. 100K probably is a bit much indeed, you may want to ‘borrow’ the 2nd stage multiboot loader from the software I mentioned somewhere in my article.

    1. Sorry, I can’t really re-use Pushpin: first of all I can only upload native GBA code that way, so I can’t run Pushpins Z80 code. Secondly, the AVR that uploads the code doubles as a MIDI-to-GBA-link-port-converter, so I don’t really need to cycle-count to acquire the MIDI-signal. Thirdly, I actually /have/ written my own synth-software, it’s the bit of code that makes all the noise when I press the keyboard keys.

      BTW: I have gotten a few mails from people wanting to buy one of the cables, so I may be going to whip up a small batch and sell them. Contact me if you’re interested.

  5. Cool for sure but…

    “We’re thinking that being able to sequence Game Boy chiptunes with a keyboard is a huge improvement over Little Sound DJ.”

    LSDj supports MIDI in.

  6. Has anyone had success with building one of these? More specifically flashing the AVR?

    I have a programmer and have been trying to get it to work with no luck. His readme text says to use the makefile, but I’m getting errors when I try that. prolly cause I’m not using WinAVR like he is (I’m using mac). I’ve been just using avrdude to set the fuses and upload the .hex file provided. I still can’t get any mutiboot response out of it though. I’m actually a beginner, so I don’t know anything past what I’ve been able to piece together from tutorials/forums/help texts. If anyone with actual knowledge and experience with this could tell me if I’m doing things right/wrong I would be very grateful. Here’s what I’ve been executing.

    $ avrdude -c usbtiny -p m168 -u -U flash:w:gbamidi.hex -U lock:w:0x2f:m -U hfuse:w:0xdF:m -U lfuse:w:0xFf:m -U efuse:w:0x00:m

    I found those fuse bit values inside his makefile.

    One thing that struck me as odd is that when I use terminal mode in avrdude and ‘dump flash 0 16800′ the lines 0000 all the way through 3800 are all ‘ff’, which if I’m not mistaken, that means blank. Though it might have something to do with something else I saw in the makefile. near the top under where he declares the MCU, it says ‘BOOTLOADER_ADDRESS=0x3800′. Like I said I’m a beginner so I don’t know much about any of this stuff. All I wanted was a MIDIboy Advance :(

Leave a Reply

Fill in your details below or click an icon to log in:

WordPress.com Logo

You are commenting using your WordPress.com account. Log Out / Change )

Twitter picture

You are commenting using your Twitter account. Log Out / Change )

Facebook photo

You are commenting using your Facebook account. Log Out / Change )

Google+ photo

You are commenting using your Google+ account. Log Out / Change )

Connecting to %s