I bought a 2MHz and a 1 MHz crystal at conrad.fr yesterday
For European teensy etc found this http://www.pieterfloris.nl/shop/ avoiding major shipping taxes in my case
no chance with SN76489 so I end up buying 10 SN76489N  NOS on ebay (the ones with the non inverted output) hope there is one that work ^^
For the pitch however it should be out of tune unless we use the same clock seb use to derive is frq conversion, I think the relation between the note should be kept.

Correct, so it will be "in tune with itself" but out of tune with other things.

little-scale wrote:

I think I'll rewrite the code for pitch --> frequency conversion derived from a master clock.

I'll also port it to Arduino (will be super simple).

how simple is it to change the code to work with arduino?

ive been considering porting some rgb code to teensy.

id like to figure it out.


according to this it should run without any modification to the code.

Last edited by DUNGEONMASTER (May 9, 2013 9:40 pm)

little-scale wrote:

Correct, so it will be "in tune with itself" but out of tune with other things.

but it can be tuned by tweaking the code?

standalone midi input would be awesome.. might have a play with that..

The SN76489 USB MIDI 101 firmware includes the following changes:
• Support for traditional 5 PIN DIN Plug via an optional MIDI input circuit

Download the firmware here: http://milkcrate.com.au/_other/download … DI_101.ino

This firmware update changes the circuit of the Teensy and SN76489, as follows:

==== DATA ====
Teensy PORTB 0 = Teensy Digital Pin 0 -->  SN76489 Pin 10 (Data 0)
Teensy PORTB 1 = Teensy Digital Pin 1 -->  SN76489 Pin 11 (Data 1)
Teensy PORTB 2 = Teensy Digital Pin 2 -->  SN76489 Pin 12 (Data 2)
Teensy PORTB 3 = Teensy Digital Pin 3 -->  SN76489 Pin 13 (Data 3)
Teensy PORTB 4 = Teensy Digital Pin 13 -->  SN76489 Pin 15 (Data 4)
Teensy PORTB 5 = Teensy Digital Pin 14 -->  SN76489 Pin 1 (Data 5)
Teensy PORTB 6 = Teensy Digital Pin 15 -->  SN76489 Pin 2 (Data 6)
Teensy PORTB 7 = Teensy Digital Pin 4 --> SN76489 Pin 3 (Data 7)

Teensy PORTD 0 = Teensy Digital Pin 5 --> SN76489 Pin 5 (Write Enable)
Teensy PORTD 2 = Teensy Digital Pin 7 --> Receive data from MIDI INPUT CIRCUIT

Teensy Ground --> SN76489 Pin 8 (ground)
Teensy Ground --> SN76489 Pin 6 (Output Enable)
Teensy Ground --> Xtal Osc Ground
Teensy 5V --> SN76489 Pin 16
Xtal Osc Signal --> SN76489 Pin 14 (Clock)

==== AUDIO OUTPUT ====
SN76489 Pin 7 --> Audio Output Signal
SN76489 Pin 8 --> Audio Output Ground

MIDI Input DIN 5 Pin 4 --> 4n28 Pin 1
MIDI Input DIN 5 Pin 5 --> 4n28 Pin 2
N4148 Diode (positive anode) --> 4n28 Pin 1
N4148 Diode (negative cathode) --> 4n28 Pin 2
4n28 Pin 6 --> 100k resistor (leg 1)
100k resistor (leg 2) --> Teensy Ground
4n28 Pin 5 --> Teensy PORTD 2 = Teensy Digital Pin 7
4n28 Pin 5 --> 3.3k resistor (leg 1)
3.3k resistor (leg 1) --> Teensy 5V
4n28 pin 4 --> Teensy Ground

Aaaaand... arduino version: http://little-scale.blogspot.com.au/201 … 1-for.html

little-scale wrote:

• Support for traditional 5 PIN DIN Plug via an optional MIDI input circuit

damn, you're coding faster than the post around here!
heart heart

why did I think that was a compliment? Anyway.. good feels all round.

Last edited by liquidcalm (May 10, 2013 7:02 am)

I was chilling in my lunch break.

Samsung Galaxy S4 controlling SN76489 via MIDI directly:

finally got some SN76489 chips in the post! Breadboarded up this badboy.
My only issue so far is the tuning is out. I'm using a 1.8Mhz osc but everything is a good step and a half out.
Would it be easier to mess with the pitch tables or look for a different oscillator?

I reckon it might be easier to mess with the pitch table BUT I want to rewrite this with a variable for clock speed anyway, thanks for reminding me!! big_smile

Of interest: http://little-scale.blogspot.com.au/201 … inear.html

SN76489 USB MIDI Firmware 102 for the Teensy features the following changes:
• Pitchbend is musically linear, meaning that the same value pitch bend will give the same pitch distance no matter which pitch is played.

• CC71 on MIDI channels 1 - 4 sets the pitch bend range in semitones. The default is 12 semitones.

• The frequency data for the SN76489 is calculated using a formula rather than a look up table.

• The advantage of this is 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.

Download the firmware here: http://milkcrate.com.au/_other/download … DI_102.ino


Today I started adding support for a quad SN76489 setup from the one Teensy.

The basic functionality works great - note on / off, pitch bend and noise channels.

That is great!
further questions!
I have 2 channel of square waves on Ch 1+2 and noise on ch3.. is this right.. the demo has 3 channels of square wave.. am I just sending my CCs wrong?

Last edited by liquidcalm (May 25, 2013 10:48 am)