Below is an elaborate explanation of some of the biggest challenges in building the Crudman and the solutions which made their way into the finished product1.
1Before getting deep into this you should know that virtually all of the solutions to the challenge of making a powerful and musically useful "one Walkman Mellotron®" began with finding a single model of Walkman, the Sony TCM-200DV, which has a three phase motor and an unusually overengineered motor driver circuit based around the Sanyo LB1979 IC. This allows for unusually precise motor/pitch control as well as a simple way to measure the speed of the motor in real time, which is crucial to the audio circuits described in parts 1 and 2 below.
(Both features described below can be switched on or off with built in switches)
1. With any audio tape (cassette, reel to reel, etc), volume goes down significantly as its speed decreases.
It's just how tape works. It's not specific to the Crudman or to the particular model of Walkman it uses. All magnetic tape behaves this way. You may think, if you've ever played with an adjustable speed Walkman, that this isn't a big deal, its because most tape speed controls actually only change frequency by a few notes (even though it seems like more), not a few octaves.
If you play the highest note (so the motor is spinning at its fastest speed) and move down note by note, the volume will begin to decrease audibly at just around half an octave down, and gets bad at around 1.5-2 octaves down (and gets even worse beyond there). Unless this is improved somehow, the instrument will be musically useless for many situations, since the effect of the volume increasing dramatically as the pitch increases is generally not something you want.
The solution: Create an Automatic Gain Control (AGC) circuit which constantly checks the actual speed of the motor, and then use that speed value to proportionally increase or decrease the volume, so that it seamlessly stays at the same volume at any speed.
The Walkman has a three phase motor. That means it has 3 control wires which are constantly being pulsed on and off, in order, one after the other. When pulsed, each one momentarily switches on an electromagnet which then causes the motor to spin. You can easily and accurately see how fast the motor is spinning at any moment just by measuring the frequency of these pulses. And so that's what we do.
With the help of the microcontroller brain inside the Crudman, we constantly check the speed of the motor, then use its speed to set the voltage output of a DAC. We then use the DAC's output voltage as the control voltage for a VCA, whose audio input is the Walkman's audio out. The higher the motor speed, the higher we set the output voltage of the DAC, which then proportionally turns down the volume as the speed and volume increase. By doing this the Crudman's output stays at a consistent volume even as the Walkman's headphone out volume changes dramatically as you change the motor speed.
In order to accurately get the motor pulse frequency I had to do some finagling to turn the weirdly shaped waveform into a clean squarewave suitable to be used with the microcontroller's digital input.
2. Tape hiss completely overwhelms the audio signal as the motor speed decreases.
As stated above in #1, the volume of the sound recorded onto the tape decreases as the motor/playback speed decreases. And unfortunately the background white noise (which is generally referred to as tape hiss) stays at that original volume. If you slow down more than a few notes, the tape hiss becomes louder than the signal, which is generally not desirable even if you are a fan of tape hiss.
The solution: Constantly check the speed of the motor, and use that speed value to control a lowpass filter which kicks in at lower motor speeds and chops off most of the high pitched white noise.
The noise is white noise. Or at least, something close enough to white noise that for our purposes we can call it white noise. White noise is by definition concentrated in the higher frequencies. A simple digitally-controlled analog RC lowpass filter, set dynamically by the motor speed, can be used to filter out this excess white noise which becomes increasingly prominent at slow motor speeds. For this we use a digital potentiometer as the resistor in an audio-friendly RC lowpass filter. If the tape speed is fast enough, we don't need the filter and can basically turn it off. As the motor speed gets lower, we adjust the the cutoff accordingly. Since the white noise is concentrated in higher frequencies, and gets louder as the motor speed/pitch goes down, we can safely use it to chop off most of that noise without actually messing with the audio signal on the tape which we want to hear.
3. The far majority of Walkman motors are simple two-wire DC motors which are not designed to spin with precision at a wide variety of speeds.
In addition to being innacurate, they can be damaged if fed too much or too little power while attempting to speed up or slow down the motor.
The solution: Use only a specific Walkman with a 3 phase motor and a powerful voltage controlled motor driver IC, which combine to create something more accurate than a DC motor.
Long story short, a three phase motor's speed can be controlled 1) far more accurately and 2) over a far greater range of speeds than the cheapo DC motors found in most other Walkmans. If you really want to get a better idea of how 3 phase motors work this Youtube video has a good explanation.
There is absolutely no info available online about the Walkman's motor driver IC, which is a Sanyo LB1979. But after a good amount of experimenting I determined that the motor speed could easily and accurately be controlled by disconnecting and removing the resistor going into one of its input pins, and replacing it with a voltage source.
ACCURATE EXPONENTIAL VOLTAGE CONTROL
Soon after discovering that the motor driver IC was voltage controlled I somehow realized that the pitch/speed of the motor had a surprisingly accurate exponential response to the voltage control. What does that mean? By default the LB1979's Control Voltage input pin is getting about 0.5v. If you double that voltage, to 1.0 volts, the speed of the motor increases in such a way that the pitch of the audio on the tape increases by exactly one octave.
Similarly if you halve the Control Voltage and go from from 0.5 to 0.25 the speed of the motor decreases in such a way that the pitch of the audio on the tape decreases by exactly one octave. Then if you divide the voltage by 2 again, from 0.25v to 0.125... the pitch goes down exactly one more octave.
This is an exponential response curve. The tape-sounds' pitch goes up one octave every time you double the control voltage and vice versa. (sidenote: With this motor and driver, it seems you can't go much higher than 1.2v, the motor simply can't go any faster. You also can't go much lower than 0.125v, the motor's motion becomes jerky.)
DAC and VCA
To control the Walkman motor with a microcontroller we first need a DAC (digital to analog converter). We're using the 12 bit DAC built into our Teensy.
Above I explained that the motors voltage-to-pitch ratio is exponential. Our DAC outputs voltage on a linear scale, not an exponential one (and as far as I know there's no exponential DACs).
Very long story short, we can convert the linear voltage from our DAC into the exponential voltage we need using a VCA. Our circuit uses a Coolaudio V2164 Quad VCA.
That long story, if you're really curious to read it, is as follows:
(***In this section I will not go into the actual software/code that sets the DAC, I'll just say "you set the DAC to this or that position" and assume you have a vague understanding of what that means.)
If you look at the datasheet linked above you'll eventually find the sentence that says the inputs are controlled by -33mV per dB into the control voltage (CV) inputs. So for every 33mV you put into one of its CV inputs, the signal voltage gets attenuated by 1 dB. This in itself isn't that useful. But, if you decrease any voltage by 6 dB, you cut that voltage in half. Conversely increasing a voltage by 6dB doubles it. 33mV * 6 = 200mV, so for every 200mV (or 0.2 volts) we put into the CV input, the signal voltage will be cut in half.
So if the VCA's signal input is 1.0v and the CV is 0.2v, the output is 0.5v (1.0 / 2). If the signal input is 1.0v and the CV is 0.4v, the output signal is 0.25v (1.0 / 2 / 2). If the input voltage is 1.0v and the CV is 0.6v, the output is 0.125v (1.0 / 2 / 2 / 2). Also if you couldn't guess if the input is 1.0v and the CV is 0v, the output is simply 1.0v.
We want to use our VCA and DAC to set the motor to any voltage between 1.0v and 0.125v. So we set the VCA's input voltage to 1.0v, which is easy enough with a voltage divider and an op amp. We want to our control voltage to be able to go from 0v to 0.6v, as explained in the previous paragraph. But our DAC goes from 0-5v, so we just put it through a voltage divider so that its attenuated to 0-0.6v.
Our DAC is a 12 bit DAC. 12 bits is 4095, so it has 4096 equally spaced voltages, from 0-5v. So if we set it to position X (X being between 0 and 4095), its output voltage is 5 * (X / 4095). If we set everything as described above, our Walkman will now give us 4096 perfectly musically spaced voltages, going from 2 octaves below the original sound on our tape, to 1 octave above.
We now have a musically consistent tuning. But we want to actually hit notes on the traditional 12 tone scale. We can play across 3 octaves, which is a total of 37 evenly spaced notes. So, we divide our 4095 by 36, then multiply that by the note we want to hit (note 0 is C2, note 36 is C5, all others are in between... for example C3 is 12, and C4 is 24).
To hit note Y (which again, is a number from 0 to 36), we set our DAC to position Y * (4095 / 36). And that's it, and we can set it with whatever we want... MIDI in, external CV in, whatever, and it works nicely.
4. The motor can speed up quickly, but slows down too slowly for many musical uses.
The motor moves from low note to high note pretty fast. It's not perfect, but close enough that its reasonable to say that the little ramp up you hear is part of the unique character of the instrument and of cassettes in general. But it moves far slower when moving from a higher note to a lower note and it gets worse and worse the further away the two notes are. You hear it slowly ramp itself down over somewhere between a quarter to half a second, which, if I didn't find a way to improvement, would make the thing musically useless if you want to play anything faster than that, which you presumably will.
The solution: The motor driver IC has a pin which, when switched on, quickly stops the motor. By pulsing it for a small fraction of a second, at the exact moment you set the motor to move from a high note to a low note, one can halt the motor for just long enough to get it almost immediately spinning at the slower speed. There's no chance of me spending days trying to figure out the mathematical formula for how quickly the motor is moving for a fraction of a second it moves from full speed to stop, so I just tested different times until I found some that worked.
5. There should be an effortlessly easy way to chain multiple Crudmans together to turn them into a single polyphonic MIDI instrument.
The solution: A user puts two or more Crudmans on the same Midi chain and sets both to the same channel. If a user hits one note on a Midi controller, it sends a Midi noteOn message to the first Crudman in the chain, note is played, and the noteOn is discarded. With that note still held down, the user hits a second note. That note is sent to the first Crudman. It sees that it's already playing a note, and so sends the note to the next one. If that one isn't already playing a note, it plays the new note. Using this simple technique endless devices can very easily be chained together to form a polyphonic instrument of any size. You just have to make that many copies of the same sound/tape.
6. The device needs to be about as easy to tune and calibrate as a commercially available analog synthesizer.
The DC motors in most Walkmans have a seemingly nonlinear relationship between voltage and speed, and as far as I can see, the only way to tune them to be highly musically accurate is to have an individual tuning knob to set each note individually. Having to individually tune 37 knobs (one for each of the 37 notes) to keep the thing in tune would be unnaceptable.
The solution: Design a fancy circuit which can accurately calculate the voltage required to hit every note over 3 octaves if the user simply tunes the lowest and highest note.
Some of this was covered in #3, but there's more.
As stated #3 above, the highest pitch/note/speed we want from the Walkman is about 1.0v. By controlling that with the DAC and VCA we want it to sweep between there and 0.25v, which gives us the lowest speed we want. We plug 1.0v into the signal input of a VCA, and sweep the VCA's CV from 0.0-0.6v, and that in turn sweeps our signal output from 1.0v (with a CV of 0) to 0.25 (with a CV of 0.6). The circuit has a trimpot which allows us to accurately set our maximum signal input to the correct voltage, around 1.0v. So we can easily set that and measure with a multimeter or scope, and/or fine tune with our ears. And it has another trimpot which allows us to set the max CV, which should be around 0.6. If we set the instrument to play its lowest note, with either MIDI or CV, the CV DAC should be at around 0.6v, and if it isn't, you similarly set it with the trimpot and then fine tune with your ears as necessary.
The best way to do this is to tune by ear with a tape of a simple tone tuned to C. Play the highest possible note via MIDI or CV, set the signal input trimpot so that it's playing a C one octave above the original recorded sound. Then play the lowest possible note, and set the CV input trimpot so it hits a C two octaves below the original recorded sound.
And that's it. If you set those two notes, every note in between will be set automatically.
7. The user should be able to change the software running on the Crudman's Teensy microcontroller brain if he or she really wants.
The solution: Base the circuit around the Teensy 3.1 microcontroller. The Teensy is Arduino-compatible (so you can program it from the Arduino IDE) but its ARM-based so is much faster than the AVR-based Arduinos. It's physically small. It's designed to be stuck into a breadboard by its male header pins, so it can just as easily be connected to and removed from female header pins on the Crudman's PCB. You can safely pull it off the PCB with your fingers, reprogram it however you want, and then put it back in.
AND THAT'S ABOUT IT. IF YOU HAVE ANY QUESTIONS OR COMMENTS FEEL FREE TO GET IN TOUCH AT LAB@CRUDLABS.ORG.