Showing posts with label chiptech. Show all posts
Showing posts with label chiptech. Show all posts

Monday, January 30, 2023

SMSM SEGA Master System MIDI Interface Github

I've put some old files of my SMSM Sega Master System MIDI Interface on Github. 

https://github.com/little-scale/smsm

Monday, June 01, 2020

SN76489 USB

I wanted to make a slightly more modern implementation of my SN76489 USB. The main changes are: Teensy LC, 3.2, 3.6 compatibility, and no need for an external crystal oscillator as the Teensy generates a 3MHz signal for the timing of the SN76489.

The hardware connection is as follows:

  • Pin 0 to SN76489 write enable 
  • Pin 3 to SN76489 clock input
  • Pin 4 - 11 to SN76489 D0 to D7
  • Teensy 5V to SN76489 5V
  • Teensy ground to SN76489 ground and output enable





Download the code from here: https://github.com/little-scale/arduino-sketches/blob/master/sn76489_USB.ino


Monday, January 01, 2018

Oct SN76489 MIDI Array




The SN76489 is the same sound chip as found in the SEGA Master System. This is an array of eight SN76489 sound chips playable via USB MIDI, for a total of 32 hardware channels.



MIDI channels 1 - 16 are each split, so that each channel can represent two hardware channels. This is achieved by splitting the MIDI pitch range across two SN76489 channels. A C3 played on MIDI channel 1 with a transposition of -36 semitones will sound like a C3 being played on SN76489 chip 1, channel 1. A C3 played on MIDI channel 1 with a transposition of +24 semitones will sound like a C3 being played on SN76489 chip 1, channel 2. 

Thus, the 16 MIDI channels are mapped as follows: 
SN76489 Chip 1, Channel 1: MIDI Channel 1 -36 semitones
SN76489 Chip 1, Channel 2: MIDI Channel 1 +24 semitones
SN76489 Chip 1, Channel 3: MIDI Channel 2 -36 semitones
SN76489 Chip 1, Channel 4: MIDI Channel 2 +24 semitones
SN76489 Chip 2, Channel 1: MIDI Channel 3 -36 semitones
SN76489 Chip 2, Channel 2: MIDI Channel 3 +24 semitones
SN76489 Chip 2, Channel 3: MIDI Channel 4 -36 semitones
SN76489 Chip 2, Channel 4: MIDI Channel 4 +24 semitones
SN76489 Chip 3, Channel 1: MIDI Channel 5 -36 semitones
SN76489 Chip 3, Channel 2: MIDI Channel 5 +24 semitones
SN76489 Chip 3, Channel 3: MIDI Channel 6 -36 semitones
SN76489 Chip 3, Channel 4: MIDI Channel 6 +24 semitones
SN76489 Chip 4, Channel 1: MIDI Channel 7 -36 semitones
SN76489 Chip 4, Channel 2: MIDI Channel 7 +24 semitones
SN76489 Chip 4, Channel 3: MIDI Channel 8 -36 semitones
SN76489 Chip 4, Channel 4: MIDI Channel 8 +24 semitones
SN76489 Chip 5, Channel 1: MIDI Channel 9 -36 semitones
SN76489 Chip 5, Channel 2: MIDI Channel 9 +24 semitones
SN76489 Chip 5, Channel 3: MIDI Channel 10 -36 semitones
SN76489 Chip 5, Channel 4: MIDI Channel 10 +24 semitones
SN76489 Chip 6, Channel 1: MIDI Channel 11 -36 semitones
SN76489 Chip 6, Channel 2: MIDI Channel 11 +24 semitones
SN76489 Chip 6, Channel 3: MIDI Channel 12 -36 semitones
SN76489 Chip 6, Channel 4: MIDI Channel 12 +24 semitones
SN76489 Chip 7, Channel 1: MIDI Channel 13 -36 semitones
SN76489 Chip 7, Channel 2: MIDI Channel 13 +24 semitones
SN76489 Chip 7, Channel 3: MIDI Channel 14 -36 semitones
SN76489 Chip 7, Channel 4: MIDI Channel 14 +24 semitones
SN76489 Chip 8, Channel 1: MIDI Channel 15 -36 semitones
SN76489 Chip 8, Channel 2: MIDI Channel 15 +24 semitones
SN76489 Chip 8, Channel 3: MIDI Channel 16 -36 semitones
SN76489 Chip 8, Channel 4: MIDI Channel 16 +24 semitones



The hardware setup has one Teensy LC, with a common data bus (digital pins 0 - 7) and individual chip select (digital pins 8 - 15). One external 4 MHz crystal provides the timing for all eight SN76489.



Sunday, July 19, 2015

Sample Sequencer Prototype for SEGA Master System - ROM and Source Code



Someone asked about this on YouTube, so I'm posting the code and ROM. It will be good to come back to this, actually.

Download ROM here: http://milkcrate.com.au/_other/downloads/ROMs/sample_sequencer_prototype.sms

Download source code here: http://milkcrate.com.au/_other/downloads/ROMs/sample_sequencer_prototype.txt

Demo video:

Friday, May 01, 2015

Video: SEGA Controlled via iPad!

Thursday, April 09, 2015

GenMDM Factory Line - Fulfilling Old Orders


GenMDM factory line, fulfilling old orders. Yes, it's been too long.

Wednesday, October 08, 2014

I am Speaking on a Panel at PAX Australia


http://aus.paxsite.com/schedule/panel/retrofuture-new-advancements-in-vintage-video-game-hardware

Friday, April 25, 2014

I Am Playing and Interfacing at Erit Satis: Ventilation on May 17th



Facebook event: https://www.facebook.com/events/665116246883449/

When: Saturday, May 17th, 7.30PM +
Where: Tenth and Gibson (in Bowden, Adelaide, SA)

Erit Satis is back with a night of new music at Tenth and Gibson.

Embracing a diverse field of music from traditional instruments to custom made ocarinas by Mr Yannii Pouferis, some exquisite pressure-sensing electronic floors once used by Philippa Cullen, a vintage theremin and a collection of talented composers and performers:

Melanie Walters will be playing these with a cheeky premiere!
Houston Dunleavy - Skimming for Solo Piccolo
Michael Smetanin - Nontiscordardime (Bass flute/piccolo/c flute)
Mary Finsterer - Ether
Anne La Berge - Revamper

Sebastian Phlox, Nathan Cummins play:

Irān Sanad-Zadeh - 4485

Iran Sanadzadeh, Dan Thorpe, Sebastian Tomczak: Iran Sanadzadeh (new work) - Philipa's Boat.

Sebastian Phlox: Blitzem [Snail Eyes IV]

Dan Thorpe:
Christine Richers — New Work,
Dan Thorpe — New Work, Daniel Matej — Pages and Structures (Structured Improvisation, featuring Melanie Walters, Dan and Sebastian Tomczak)

Alexander Thumm : Solo Set

There will be delicious drinks and nibbles

Sunday, April 20, 2014

LSDJ Kit: Loud TR808



Download the LSDJ kit, original, edited and converted samples here:
http://milkcrate.com.au/_other/downloads/lsdj_kits/TR808L.zip

LSDJ Kit: ACTFD1



Download the LSDJ kit, original, edited and converted samples here:
http://milkcrate.com.au/_other/downloads/lsdj_kits/ACTFD1.zip

All Classic LSDJ Kits as WAV Files



Download here: http://milkcrate.com.au/_other/downloads/lsdj_kits/LSDJ%20Kits.zip

Sunday, November 17, 2013

Chiptune Array: 128 Hardware Channels

A critical mass of simple things, combined. 



An array of sound chips, yielding 128 channels of chiptune hardware:
• 32 SN76489 sound chips addressable via 8 USB MIDI connections
• Uses the quad flavour of the SN76489 USB MIDI synth
• 96 square wave channels and 32 noise channels
• 8 audio channels
• Each audio channel carries the summed analog output of 4 SN76489 sound chips (or 16 voices / sound chip channels)
• Every channel of every SN76489 sound chip is controllable via MIDI, and includes sample playback via amplitude modulation, noise channel control, pitch bend and velocity control

 Currently, every SN76489 chip is clocked at 1.8432 MHz. I would like to experiment with different clocks for different chips, giving a wider pitch range over all. Currently, every group of 4 SN76489 chips is summed and then digitised via a Focusrite ADAT preamp and RME interface. I would like to (possibly) carry each audio channel from every SN76489 as a discrete digital input, however this may be stretching my resources. I am also working on a set of tools that are designed to help generate MIDI data en masse for such a setup. Stay tuned!

I am loving how thick and overflowing 96 square waves sound...





Sunday, May 26, 2013

SN76489 USB MIDI 103 Firmware: Quad Support!

Overview
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.



Mapping 
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
Required:
• 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:




Code

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.

Three SN76489 Pulse Channels for Sample Playback

I have updated the code for how my SN76489 USB MIDI plays back samples.

Previously, I would use a single pulse channel and then trigger samples using the volume of that single pulse channel using amplitude sample data.

The aim of using only one pulse channel was that it would free up the other channels for melodic and harmonic use.

However, the result is that the sample playback is very, very soft in volume, meaning that there is more overall unwanted noise, and that there is also a limit to how the other channels can be used velocity-wise in order to balance out the single pulse channel that is used for sample playback.

I have decided to try out using all three pulse channels for sample playback, and all though this limits the use of all pulse channels on that particular SN76489 chip whenever sample data is playing.

The effective outcome is a much more balanced sample function in terms of volume. Samples also seem to sound 'crisper', less gain is needed to bring the chip up to appropriate levels.


Saturday, May 25, 2013

Piggybacked SN76489 Chips








One SN76489 is piggybacked on another. They share many pins and only a small number need to be isolated from each other.

• Removal of !READY pin
• Isolation of !WRITE_ENABLE pin
• Isolation of SOUND_OUT pin
• Shared data bus, ground and 5V pins

Quad SN76489 Prototype Demonstration


SN76489 USB MIDI Firmware 102: Linear Pitchbend, Clock-based Pitch

Overview
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/downloads/teensy/SN76489_USB_MIDI_102/SN76489_USB_MIDI_102.ino



Example Breadboard Layout



Demonstration Video




Saturday, May 11, 2013

SN76489 Controlled By Samsung Galaxy S4

A demo of this process and this process.

Friday, May 10, 2013

SN76489 USB MIDI 101 Firmware for Arduino

The SN76489 Firmware has been ported to Arduino.

Note that a variable called "byte USB_SERIAL_MODE = 1;" sets whether or not data should be read from a traditional MIDI input or from a USB serial connection.

If USB_SERIAL_MODE = 1, then the mode is set to accept input from a USB serial connection. A traditional 5 pin MIDI connection will not work.

If USB_SERIAL_MODE = 0, then the mode is set to accept input from a traditional 5 pin MIDI connection. A USB serial connection will not work.

Download the firmware here: http://milkcrate.com.au/_other/downloads/teensy/SN76489_USB_MIDI_101/SN76489_USB_MIDI_101_ARDUINO.ino



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

==== CONTROL AND MIDI INPUT ====
Arduino PORTD 2 = Arduino Digital Pin 2 --> SN76489 Pin 5 (Write Enable)
Arduino PORTD 0 = Arduino Digital Pin 0 / RX --> Receive data from MIDI INPUT CIRCUIT

==== POWER AND CRYSTAL ====
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 CIRCUIT (ONLY IF REQUIRED) ===
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







Here are diagrams of the various devices.

SN76489 USB MIDI 101 Firmware

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/downloads/teensy/SN76489_USB_MIDI_101/SN76489_USB_MIDI_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)

==== CONTROL AND MIDI INPUT ====
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

==== POWER AND CRYSTAL ====
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 CIRCUIT (ONLY IF REQUIRED) ===
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


Here are diagrams of the various devices.