/blog

📼 Hacking a cassette player into a musical instrument

Instructions on converting an old walkman-style cassette player into a synthesizer using an Arduino, a DAC, a few wires, and some code.

I love weird music projects. I’ve recorded an album soundtracking the Apollo 12 mission and recently used my heart beat to control music tempo. You can find more of my music at music.byinfinitedigits.com

Recently, I finished converting an old walkman-style cassette player into a MIDI-controlled synthesizer using an Arduino and a little code - dubbed the cassette synthesizer.

The cassette synthesizer works by playing a pre-recorded drone (a single tone) from tape and then modulating the speed of the playback to pitch up the tone to any pitch you want. I got this idea for the cassette synthesizer from Onde Magnétique who got the idea from the Mellotron.

Here’s a video of me playing the cassette synthesizer, controlled via MIDI by my other keyboard:

The neat thing about this synthesizer is that it has a very “analog” quality to the changing of notes - the pitch often slides between notes in a neat way (i.e. lots of portamento). It also is versatile because you can record any sound to the tape and use that as your synthesizer.

Making a cassette synthesizer

To make one of these things is actually really easy. I found a great video from Analog Industries showing exactly how to hack a cassette player to add voltage control to the cassette player. I followed that and then wrote a simple MIDI controller in the browser to modulate the voltage to specific notes.

These instructions will take you through the hardware (Arduino / Cassette player) and the software for the MIDI controller.

Supplies

Hacking the GE 3-5362A tape player

Note: You don’t necessarily have to use the GE 3-5362A. Any tape player with a variable playback will work. You’ll just have to figure out how to hook up the voltage :)

First thing is to open up the tape player. There are four screws on the back. Just unscrew them and open it carefully. The power lines are connected on the back plate so just don’t rip those out.

Hacking the GE 3-5362A tape player.

To get this tape player working for us we will solder two new components. First we will solder in the Vin which will allow us to control the speed of the cassette player with a voltage controller. Then we will add an audio splitter as a Line in which will let us record directly onto tape (in case you don’t have a tape deck).

If you don’t know how to solder - don’t sweat. Its easy. Check out this video which shows you how to use the existing solder pad and put something onto it.

Adding the Vin to control tape speed

Locate the dial that says “Variable Speed Playback”. This is where we will splice in two lines. I like to use red for active and brown/green for ground. Attach the active line to VS+ and the ground to the pad right below the one labeled B+.

Solder a cable to VS+ and one to the pad next to B+.

A note - I like to use jumper cables that have a female end so I can easily plug stuff into here!

Add in a Line in to record directly onto tape

Locate the red and black cables plugged into pads labeled “MIC-” and “MIC+”. You can solder and remove these cables and attach your own from the audio breakout cable. Just solder red to “MIC+” and black to “MIC-".

Solder a line-in via the MIC- and MIC+.

Record a drone to tape

Put in a tape and record via the line in! Record any note you want, usually a single drone on C works well as a starting point. Record a long time - 30 minutes or so (this would be a good place for tape loops if you have them!). Make sure to record a single tone because you will pitch it up/down later.

Recording a drone from my OP-1 to the tape.

Setup an Arduino as MIDI interface

The Arduino serves as a bridge between MIDI and the voltage. A MIDI keyboard is plugged into a computer and a Chrome browser gets the response. The browser executes a request to a server running which sends the serial information for the voltage change to the Arduino, which then modulates the voltage on the walkman.

Connecting the MCP4725 DAC to the Arduino

First, simply connect the Arduino to the MCP4725. The MCP4725 is a digital-to-analog converter (DAC) that allows modulating specific voltages directly from the Arduino. The OUT from the MCP4725 should go to the RED wire you connected to the cassette player. Then attach the ground wire on the cassette player to the ground on the Arduino.

The code for the Arduino just communicates via a Serial port to send voltages. For instance, sending voltage1.1 will change the output voltage on the DAC to 1.1. Here is the code:

#include <Wire.h>
#include <Adafruit_MCP4725.h>

Adafruit_MCP4725 dac;
String sdata = ""; // Initialised to nothing.
bool started = false;
void setup(void) {
  Serial.begin(9600);

  // For Adafruit MCP4725A1 the address is 0x62 (default) or 0x63 (ADDR pin tied to VCC)
  // For MCP4725A0 the address is 0x60 or 0x61
  // For MCP4725A2 the address is 0x64 or 0x65
  dac.begin(0x62);
  pinMode(2, OUTPUT);
  pinMode(3, OUTPUT);

  Serial.println("Begin");
}

void loop(void) {
  if (started == false) {
    started = true;
    dac.setVoltage(0, 1);
    digitalWrite(2, LOW);
    digitalWrite(3, LOW);
  }
  byte ch;
  if (Serial.available()) {
    ch = Serial.read();
    sdata += (char)ch;
    if (ch == '\n') {
      sdata.trim();
      if (sdata.indexOf("voltage") > -1) {
        sdata.remove(0, 7);
        float newVal = sdata.toFloat();
        // set voltage
        float newVoltage = round(910.0 * newVal);
        if (newVoltage > 4095) {
          newVoltage = 4095;
        }
        uint16_t newVolts = uint16_t(newVoltage);
        dac.setVoltage(newVolts, 1);
        Serial.print("volts: ");
        Serial.println(newVolts);
      } else {
        Serial.println("?");
      }
      sdata = "";
    }
  }
}

Server to send serial commands

To communicate with the Arduino you can use a simple server that hooks the MIDI to the voltage Serial. You can get this code from github.com/schollz/tape-synth. Make sure you have Golang installed (install here).

$ git clone https://github.com/schollz/tape-synth
$ cd tape-synth
$ go build  
$ ./tape-synth -com ARDUINOCOM

Note: you’ll have to run in sudo to access the USB ports usually if you are using Linux. The ARDUINOCOM is the COM-port for the USB-connected Arduino. For Windows it is usually COM4.

The server will serve a webpage from index.html. You should open up Chrome to localhost:8080 and you’ll be able to connect a MIDI keyboard and send voltages to the Arduino (Chrome is the most popular MIDI-capable browser).

Connect everything and play!

To get it going, start the serial server. Plug in a midi keyboard. Open chrome to the localhost:8080. Turn on the cassette player and start jamming! A note on the keyboard should translate into a note on the cassette synthesizer.

Tuning the synth

Because we are dealing with mechanical pitch shifting (via tape speed) its necessary to tune the synth. To tune each pitch, just open index.html and edit the voltageMap. Each note should have a voltage (between 0 and 3) associated with its pitch.

var voltageMap = {
    "C": 0,
    "C#": 0.7,
    "D": 0.9,
    "D#": 1.2,
    "E": 1.4,
    "F": 1.62,
    "F#": 1.85,
    "G": 2.25,
    "G#": 2.6,
    "A": 3.0,
    "A#": 0,
    "B": 0,
}

That’s it!

If something is unclear (it probably is) don’t hesitate to reach out to me. I’m yakcar @ twitter and infinitedigits @ instagram.

 / music programming arduino 

❤️ Use your heart beat for the tempo 🎹🖥️ Getting MIDI and Golang to work on any system
Made by Zack, filed in Blog. 2019.