Sunday, May 26, 2013

SN76489 USB MIDI 103 Firmware: Quad Support!

SN76489 USB MIDI now supports up to four SN76489 chips per one Teensy! This means controlling up to 12 pulse wave channels and up to 4 noise channels using MIDI.

Additionally, sample support has been added for the first SN76489 chip and is handled by the first three pulse channels.

The 16 MIDI channels of the SN76489 USB MIDI are mapped to up to four SN76489 chips in the following way:

The sample playback of up to sixteen samples are mapped in the following way:

Note: Whenever a sample is playing, pulse channels 1, 2 and 3 of SN76489 chip 1 cannot be used.

The SN76489 USB will respond to:
• Note on events
• Note off events
• Pitch bend
• MIDI CC 11: expression
• MIDI CC 81: bend amount in semitones (default 12)

Parts, Pinouts and Circuit
• 1 x Teensy 2.0
• 1 - 4 x SN76489
• 1 x Crystal oscillator (1.00 MHz - 3.00 MHz, typically 1.8432 MHz)

Here are the pinouts for the Teensy 2.0, the SN76489 and the crystal oscillator.

Here is how these components should be connected. Download the spreadsheet here.

Here is an example breadboard layout for a single SN76489 chip:

Here is a picture of a breadboard layout for all four SN76489 chips:


Download the code here. Please feel free to modify as you see fit, and have fun making chiptunes.

If you are having trouble triggering the notes in terms of matching up the channel numbers, please read this post.

Note that there is a line of code in the program that reads: long clock = 1843200; Simply change the value of clock in Hz to support any value of crystal oscillator whilst staying in tune!

The default is 1843200 (i.e. a clock speed of 1.8432 MHz) as this is the crystal speed that I prefer, however the SN76489 can accept a wide range of clock speeds. If you want a bassier pitch range, simply use a lower value crystal oscillator.


Circuit Ben said...

Is it possible to add traditional 5-pin midi in to this? I'd love to play the chip from my keyboard/hardware sequencer.

Sebastian Tomczak said...

Yep! Simply connect a MIDI input circuit to Teensy pin digital 7, and voila! The code should work with both USB and trad MIDI, obviously with MIDI you'll need to supply 5V and ground from elsewhere, or simply not use the USB connection..


If you end up trying this with MIDI, let me know how you go!