Chiptunes

Preamble

Everyone is talking about Chiptunes these days, the retro sound obtained from the games devices, and home computers of the 80s:

Featured image courtesy of Button Masher T.O.

See also

Links

SID

ArduinoBoy

See ArduinoBoys and others.

TeensyBoy

See ArduinoBoys and others.

The hot devices

From The ultimate chiptune producers’ gear guide

  • Commodore64
  • MSSIAH – for C64
  • GameBoy
  • LSDj and Nanoloop
  • Magical 8bit plug – VST
  • VOPM
  • NES
  • MIDInes – for NES
  • Famitracker
  • Chipsounds by Plouge – VST
  • KORG DS-10
  • Anything with an AY-3-8910 in it – Spectrum128, Intellivision

Synth-in-a-MIDI-plug

Whilst not strictly chiptunes, in the retro sense, this is still cool, MIDI on the ATtiny,

synthcable2

synthcableschem

See also, An even smaller, even sillier synth

MOS 6581 and 6582/8580

From MOS Technology SID

SID chip versions

The first version was the 6581 followed by the 8580, (in the later flat grey Commodore C64C). The 6582 was sold as replacement for defective 8580s, and sounds very similar. The main difference is the supply voltage and filter caps. The 6581 takes 12V and requires 470pF caps while the 8580 and 6582 take 9V and require 22nF caps.[3]

There are also sound differences. The filter of the 6581 sounds more moody and dirty, while the 8580/6582 filter sounds more precisely. Resonance has nearly no effect on the 6581, some mixed waveforms are not working, and it has a much higher background noise. The 8580/6582 is normally the preferred choice.[3]

6581

From Commodore 64 Pseudo Stereo Dual SID boards

6581
6581

6582

The 6582 is found usually on a C64 motherboard:

8580

From Commodore 64 Pseudo Stereo Dual SID boards

8580

It’s location on a C64 motherboard is (from Commodore 64 C64C motherboard has Fault. Assy no. 252311 Rev B-Boots Up Ok.):

C64 Motherboard SID.jpg

and from Index of /~rcarlsen/cbm/c64/SCHEMATICS/250469

board-250469

8581

From SID 6581 / 8580

6581

Signal Description

(Click here for ASCII version)

Pin(s) Signal Dir Description
1-2 CAP 1A/B ? Capacitor #1 for the programmable filters. 6581: 470pF, 8580: 22nF*. Note that both capacitors (see pin 3-4) should have the same value. [1] recommends 2200pF for normal operation, which was AFAIK never used in the C64.
3-4 CAP 2A/B ? Capacitor #2 for the programmable filters. See pin 1-2.
5 /RES in RESet. If this line remains LOW for at least 10 ø2 cycles, all internal registers reset to zero and the audio output is turned off.
6 ø2 in Phi2**. System clock cycle. All data bus action takes place only when ø2=1.
7 R/-W in Read/Write. 0=write access, 1=read access.
8 /CS in Chip select.0=data bus valid, 1=data bus high impedance state (tri-state).
9-13 A0-A4 in Address bits 0-4 for selecting one of the 29 registers.
14 GND GrouND (0V). To reduce noise, this line should be connected separately to the power supply.
15-22 D0-D7 in / out Data bits 0-7.
23 POT Y in POTentiometer Y. Analog input #2 for paddles. (ADC#2)
24 POT X in POTentiometer X. Analog input #1 for paddles. (ADC#1)
25 Vcc Supply voltage. +5V.
26 EXTERN IN in External Input. Max. input 0.6V.
27 AUDIO OUT out Audio output of all voices.
28 Vdd Secondary voltage. +12V (6581) or +9V (6582, 8580).

*   You might find 330pF in some boards, too.
** The ‘ø’ is used as Greek ‘phi’ here.

 6581 / 8580 Signal Description
 ------------------------------

 Pin(s)  Signal      Dir    Description

   1-2     CAP        ?     Capacitor #1 for the programmable filters.
          1A/B              6581: 470pF, 8580: 22nF*. Note that both
                            capacitors (see pin 3-4) should have the same
                            value. [1] recommends 2200pF for normal
                            operation, which was AFAIK never used in the
                            C64.

   3-4     CAP        ?     Capacitor #2 for the programmable filters. See
           2A/B             pin 1-2.

    5      /RES      in     RESet. If this line remains LOW for at least
                            10 ø2 cycles, all internal registers reset to
                            zero and the audio output is turned off.

    6       ø2       in     Phi2**. System clock cycle. All data bus
                            action takes place only when ø2=1.

    7      R/-W      in     Read/Write. 0=write access, 1=read access.

    8      /CS       in     Chip select.0=data bus valid, 1=data bus high
                            impedance state (tri-state).

  9-13    A0-A4      in     Address bits 0-4 for selecting one of the 29
                            registers.

   14      GND        -     GrouND (0V). To reduce noise, this line should
                            be connected separately to the power supply.

  15-22   D0-D7   in / out  Data bits 0-7.

   23     POT Y      in     Potentiometer Y. Analog input #2 for paddles.
                            (ADC#2)

   24     POT X      in     Potentiometer X. Analog input #1 for paddles.
                            (ADC#1)

   25      Vcc        -     Supply voltage. +5V.

   26     EXTERN     in     External Input. Max. input 0.6V.
           IN

   27     AUDIO      out    Audio output of all voices.
           OUT

   28      Vdd        -     Secondary voltage. +12V (6581) or +9V (8580).

*   You might find 330pF in some boards, too.
** The 'ø' is used as Greek 'phi' here.

-------------------
[1] C64 Programmer's Reference Guide (excerpt)


Author: Marc-Jano Knopp <mjk@c64.org> on 97/11/21
Source: http://mjk.c64.org

Technical info

The SID 6581 was first used in the Commodore 64. It is a synthesizer with many synthesis controls and filters; additionally, it has two builtin A/D converters (used for the paddles and analog mice in the C-64). It needs both 5V (Vcc) and 12V (Vdd) supply voltage, the latter generated from the 9VAC delivered by the power supply by using a rectifier bridge with a 12V voltage regulator after it.
With the new boards (C64G and late flat case-C64s), Commodore introduced a new version of the VIC and the SID. The new SID 8580 only needs 5V (Vcc) and 9V (Vdd) for operation.

The sound of the two SID versions differs, partly due to different filter capacitors, partly due to the greater number of possible waveform combinations with the new SID. Alas, the filters in the new SID have less effect than the ones in the old SID.

The 8580’s digital sound output is quite soft, but you can easily increase the digital volume to make it sound like the old 6581.

Programming info

In the Commodore 64, the SID is mapped to $d400-d7ff. For more programming information, you should refer to Mr. SID’s Technical SID documentation.


[1] C64 Programmer’s Reference Guide (excerpt)

SWINSID

As MOS Technology SID states, under Hardware Emulation, there is an Arduino (Nano, or ATmega328PU) based replacement for the MOS 6582/8580. However, it does not sound the same.

From COMMODORE 64 128 SWINSID SID MOS CSG 6581, 6581r3 , 8580, 8580r5 , 6581r4ar, €18

SWINSID
SWINSID

From Swinsid commodore 6581 8580 sid replacement, £10.50

s-l1600-4.jpg

It sits on the motherboard like this:

s-l1600-5

SID links

From C64 Soundchip SID 6581 with Arduino Duemilanove

Schematic

ds_6582 - schematic.png

SID with Arduino (ATmega8) as MIDI device

From Homebrew 8080 Computer – MIDI, (original image)

atmega_sid

See also Arduino SID Interface (Source and Schematic)

Arduino SID Shield

76489/76496

Application manual for SN76496, link, PDF: SN76494,_SN76494A,_SN76496,_SN76496A_Application_Manual

Available on eBay:

AliExpress: 5pcs/lot SN76489AN SN76489 76489AN DIP16, £1.28

EagleCAD parts:

Note that the two ICs are identical, apart from pin 9:

The simplest hookup

See Experimenting with an Arduino and a SN76489, for the simplest set up:

arduino1

Code

//typedef uint8_t PROGMEM prog_uint8_t; // may be required

const int PIN_D0 = 2;
const int PIN_D1 = 3;
const int PIN_D2 = 4;
const int PIN_D3 = 6;
const int PIN_D4 = 7;
const int PIN_D5 = 12;
const int PIN_D6 = 11;
const int PIN_D7 = 10;
const int PIN_NotWE = 5;
const int PIN_NotCS = 8;

void SendByte(byte b)
{
  digitalWrite(PIN_D0, (b&1)?HIGH:LOW);
  digitalWrite(PIN_D1, (b&2)?HIGH:LOW);
  digitalWrite(PIN_D2, (b&4)?HIGH:LOW);
  digitalWrite(PIN_D3, (b&8)?HIGH:LOW);
  digitalWrite(PIN_D4, (b&16)?HIGH:LOW);
  digitalWrite(PIN_D5, (b&32)?HIGH:LOW);
  digitalWrite(PIN_D6, (b&64)?HIGH:LOW);
  digitalWrite(PIN_D7, (b&128)?HIGH:LOW);
  digitalWrite(PIN_NotWE, HIGH);
  digitalWrite(PIN_NotWE, LOW);
  digitalWrite(PIN_NotWE, HIGH);
}

Use two ICs for stereo, with or without glue logic.

Derived from simplest

A derivation from the above, using a Nano, Arduino and the Texas Instruments SN76489

Github: MusicSequencerTest

Arduino Shield for SN76489

SN76489 arduino shield – part 1 testing the chip, using an ATtiny45 as the clock. The ATtiny45 can be set to be a ATtiny15 by setting CKSEL fuses to 0011, which puts the ATtiny45 Timer1 into ATtiny15 compatible mode. See A tiny oscillator for more details.

There doesn’t seem to be any other parts (only part 1), unfortunately, as it was written in 2013 and there are no further articles.

VGM

See this video ESP8266 SN76489 PSG VGM Player. The code and schematic are on Github: AidanHockey5/ESP8266_VGM_Player.

Parts required:

Improved schematic (and stripboard) at GitLab: ESP8266_SN76489_VGM_Player.

ESP8266_SN76489_VGM_Player schematic
ESP8266_SN76489_VGM_Player schematic
ESP8266_SN76489_VGM_Player board
ESP8266_SN76489_VGM_Player board

The PIC is not necessary and can use the ESP8266 SPI (original image):

nodemcu_spi_pins

The NodeMCU can apparently struggle to keep up (although this may be a bug (overly long delay) in the firmware that has now been fixed apparently). Requires a µC with 4 MB flash, and fast clock.

 

See also this video, for an excellent improved sound: ESP8266 YM2612 SN76489 VGM player prototype part 3 (Audio mixer/amp)

Squareinator

Squareinator – a SN76489 Monosynth

YM2612

An Arduino Uno is insufficient. Arduino test project:

https://github.com/skywodd/avr_vgm_player/tree/master/ym2612_test

See also this video, for an excellent improved sound: ESP8266 YM2612 SN76489 VGM player prototype part 3 (Audio mixer/amp)

2 thoughts on “Chiptunes”

  1. Noticed you linked our ShieldBoy, which works great!

    I experimented on a few things though, such as if I could make a rackmount version (easier to use multiple ArduinoBoys in a 1U) but ended up settled on what I call the StageBoy (https://github.com/m00dawg/stageboy). This is what we use for both recording and live performances of the GameBoy with the band.

    It combines an ArduinoBoy with the PISS Box design (though with a MUCH bigger and better transformer) into a single metal box. I had meant to make 3D printed panels for it but the open sides haven’t been enough of a bother to mess with it (if I do, I’ll be sure to add them to the project).

    Like

    1. HI there, thanks for the comment. Yes, I like your design. Do you actually sell the board (either as a kit or assembled)? You should really add a few photos of the board (at different angles) to the page, as the only image of it is a brief blurred shot of it in the video. By the way, there is an unfortunate typo in your menu item, and URL, of the AdvanceRack (Ardunio) page, the “i” is in the wrong place.

      Like

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 )

Google photo

You are commenting using your Google 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 )

Connecting to %s