Commodore 64 + Raspberry Pi 4 = Synth6581

We have a special blog today from one of our own design engineers, Simon Martin. He’s the designer of Raspberry Pi 400 and our High Quality Camera and spends his free time tinkering with electronic music.

This video is a classic. Settle in…

Simon has wanted to make his own electronic musical instrument with Raspberry Pi for some time. He designed a circuit board for the project a year ago, but it lay around in a drawer in his desk while he finished Raspberry Pi 400. Finally, the winter months gave him the incentive to get it working. 

Simon’s electronic musical journey

Simon: The Synth6581 device doesn’t look much like an electronic musical instrument, but just like circuit boards stacked on top of a Raspberry Pi 4. You have to plug a musical keyboard into a USB port and a pair of speakers into the audio jack on the bottom board to make it work.

Hefty stack ready to play some electronic music

The code is written almost entirely in Python, with a little bit of C to speed up the communications to the chips. I designed and laid out the circuit boards, which were ordered online. The first six boards cost only £20, but the components were another £100. I spent more than a day soldering the components on the boards by hand. It took much more time to check every chip and connection worked, a common problem with hand-soldering new boards.

Synth6581 — no ordinary sounding instrument

The 1982 Commodore 64 – works like Raspberry Pi 400, only slower

And Synth6581 is no ordinary sounding musical instrument. It’s based on the music chip inside a vintage computer: the Commodore 64. The microchips are almost forty years old and they have a quirky sound that kids in the 1980s loved and parents hated. By the way, did you know that the Commodore 64 was the inspiration for Raspberry Pi 400?

The SID chip sound

The MOS6581 SID chip — just a little smaller than a Raspberry Pi Pico board

I was one of many hobby programmers in the 1980s that used to attempt to program Commodore 64s. Much like people today dabble with programming on Raspberry Pi 400s, kids and adults were dabbling with the BASIC programming language on their Commodore 64s back then. Nowadays, Raspberry Pis have video, graphics, and audio readily available, but back in the 1980s, the hardware registers had to be ‘poked’ one by one into the console window. You had to get quite technical just to get the computer to make a musical sound. Those sounds came from the MOS6581 or ‘SID’ chip. It had such a famous sound character that it formed the basis of the chiptune music genre, and people are still writing music on Commodore 64s today.

Using BASIC POKE commands to control SID chips on a Commodore 64. Not the easiest thing to read.

Poking SID chips

By borrowing a few chips from broken Commodore 64s, including one or two lying around Raspberry Pi Towers, I made those 1980s ping noises into a polyphonic synthesiser controlled in Python on Raspberry Pi. The registers in the SID chips are simply being ‘poked’ by Raspberry Pi instead of Commodore 64. I also reverse-engineered the music from old games and made the sound effects and instruments work across the keyboard.

Simon with his creation
Simon with his electronic music creation

One of a kind electronic musical device

This device is unique: only one of these will ever be built, so please don’t wait for a launch date. There were over 10 million chips manufactured for Commodore 64, but production of the chips ended nearly 30 years ago. The Commodore 64s and spare parts for them are still in high demand, which is pushing up second hand prices. Nonetheless, the code and schematics are available online on GitHub, and I invite other Raspberry Pi users to use them to make musical instruments out of other games consoles. I reckon Sega Megadrive has a lot of potential for a Raspberry Pi port…

Simon Martin youtube channel
A few of the demos of the electronic instrument on Simon’s YouTube channel

For more video demos of this instrument, head to my YouTube channel.

13 comments

Thomas McQuaid avatar

great project, sounds great! what’s the latency on it like?

Gareth Qually avatar

That was amazing. I was wondering when this would happen. I have a spare SID that I was going to put into my C64 as a dual sid system. Well this may change things. Very cool.

Bruce Mardle avatar

Awesome!
I’ve got an old Yamaha FM synth chip and its associated ADC and keep meaning to put that on a Pi, but then I think “why not just use CSound?” :-/
(At least the Yamaha chips only need 5V, not 12. It’s a pity the Pi doesn’t have an 8-bit port (or does it?), but I guess it’s fast enough to treat assorted GPIOs as one.)

Simon Martin avatar

Yes a Pi 4 has 28 I/O pins on the GPIO header that can be configured as an 8-bit bus. You may be able to reverse engineer sid_driver.py and sid_lib.c to reconfigure to other ICs and circuit boards.

Tom Beck avatar

I was a hobbyist in the early ’80s and started a lifelong fascination with programming with the VIC-20. I taught myself 6502 programming before an assembler was available for the VIC-20 so I had to hand assemble the assembly code, convert from HEX to DEC and then poke those values into memory from a DATA section of a basic program.

I was also a professional classical musician at the time and I got a Commodore 64 as soon is it was available. I was intrigued by the sound chip and immediately began to write programs for it. I wanted to be able to input a 3 voice Bach Organ trio and play it through the SID. I wrote a program in Basic that I used to enter notes and duration, but the loop I used to play the notes was too much for the Basic interpreter. I ended up writing an assembly language program that read the note and duration values and performed each “track”. The performance was excellent. The Basic program also specified the envelope, etc. for each voice. The performance was controllable in real time for volume and temp.

I think I probably wrote what was one of the first sequencer apps. I had never heard of one before and so I wrote what I did out of necessity.

In any case, I still have great memories of my old Commodore computers.

Anders avatar

The poke into ram technique for hand assembled code is something that we of that era share. Also, entering the hex codes sequentially into a prom programmer on its keypad was a long old task and frustrating if you made a mistake.

Neil avatar

Love hearing Wizball music. One of my all time favourite games that I still play regularly! Great project!

Dan avatar

I’m soooo impressed!

Aayush avatar

Yeah, I got the Pi 4, And guess what, I’m using it more than my main PC setup nowadays. I’ve automated several tasks using python, which makes that tiny machine more interesting to use for me. I don’t know how long I’ll be figuring out the new use cases of Pi 4.

ram avatar

Hi aayush, I am just starting to use Ras Pi 4 and python. Out of curiosity, could you please tell me what actions you have automated so far?

Per avatar

Cool project!
What about a synthesizer made of a Raspberry Pi and a stack of ZX Spectrum ULAs?
I guess background noise will not be the biggest problem… :)

Toni avatar

The Commodore 64 was my first PC. I can still remember how roughly the sound was. Especially if it kept crashing. A great project. :-)

leor avatar

This is so awesome! I just got a SWINSID clone to play with. I was trying to interface it to a STM32 Nucleo board. May have some questions for you!

Comments are closed