Zack Scholl

zack.scholl@gmail.com

Making a mellotron from a cassette player.

 / #hack #music #arduino 

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:

 1#include <Wire.h>
 2#include <Adafruit_MCP4725.h>
 3
 4Adafruit_MCP4725 dac;
 5String sdata = ""; // Initialised to nothing.
 6bool started = false;
 7void setup(void) {
 8  Serial.begin(9600);
 9
10  // For Adafruit MCP4725A1 the address is 0x62 (default) or 0x63 (ADDR pin tied to VCC)
11  // For MCP4725A0 the address is 0x60 or 0x61
12  // For MCP4725A2 the address is 0x64 or 0x65
13  dac.begin(0x62);
14  pinMode(2, OUTPUT);
15  pinMode(3, OUTPUT);
16
17  Serial.println("Begin");
18}
19
20void loop(void) {
21  if (started == false) {
22    started = true;
23    dac.setVoltage(0, 1);
24    digitalWrite(2, LOW);
25    digitalWrite(3, LOW);
26  }
27  byte ch;
28  if (Serial.available()) {
29    ch = Serial.read();
30    sdata += (char)ch;
31    if (ch == '\n') {
32      sdata.trim();
33      if (sdata.indexOf("voltage") > -1) {
34        sdata.remove(0, 7);
35        float newVal = sdata.toFloat();
36        // set voltage
37        float newVoltage = round(910.0 * newVal);
38        if (newVoltage > 4095) {
39          newVoltage = 4095;
40        }
41        uint16_t newVolts = uint16_t(newVoltage);
42        dac.setVoltage(newVolts, 1);
43        Serial.print("volts: ");
44        Serial.println(newVolts);
45      } else {
46        Serial.println("?");
47      }
48      sdata = "";
49    }
50  }
51}

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 Golang).

1$ git clone https://github.com/schollz/tape-synth
2$ cd tape-synth
3$ go build  
4$ ./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.

 1var voltageMap = {
 2    "C": 0,
 3    "C#": 0.7,
 4    "D": 0.9,
 5    "D#": 1.2,
 6    "E": 1.4,
 7    "F": 1.62,
 8    "F#": 1.85,
 9    "G": 2.25,
10    "G#": 2.6,
11    "A": 3.0,
12    "A#": 0,
13    "B": 0,
14}

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.