Or how to get a vintage 1980’s drum machine sound without selling your kidneys!
There was a discussion on the SynthDIY mailing list recently about how the early digital drum machines like the LinnDrum or the Oberheim DMX used to change the pitch of drum sounds by simply changing the sample rate. They literally just played the samples back faster or slower, exactly like speeding up or slowing down a tape recording. At the time, this was relatively easy because each drum sound had its own DAC and its own sample rate clock, and that clock could be a VCO if you wanted. This variable sampling rate was a key feature of a lot of early digital gear – the PPG synths and the Prophet VS used the same trick – and it accounts for a lot of the “crunchy”or “gritty” character of those instruments. The other key element of these early digital drum machines was that they used 8-bit samples, although as I discovered, this is not all it seems.
I was rather inspired by the thought of getting a vintage drum machine sound, and wondered if I could playback original 1980’s drum samples using a PIC.
I headed for one of my recent favourite chips, the 16F1778. This chip has 16K of program memory, but mostly why I like it is that it also has three 10-bit DACs on the chip. That makes it really good fun for generating signals like LFOs or envelopes…or drums!
As well as three DACs, the 16F1778 also has three 16-bit timers, so those could be used to generate the required sample clocks. This was looking good! With a bit of luck and some cunning coding, I might be able to get three variable-rate 8-bit drum samples onto a single chip, assuming the samples were short enough. At least, that was the target to aim at.
My first step was to try and find some of the original 8-bit samples for some of these machines. I found this great site with images for the Oberheim DMX EEPROM chips. Many of the samples were 4K, so I’d be able to fit three of them into my 16K program memory and still have plenty of room (four whole kilobytes!) left for code. So far so good.
It was at this point that I hit my first snag. I discovered the 8-bit samples in the LinnDrum and the Oberheimn DMX aren’t really 8-bit!
When is an 8-bit sample not an 8-bit sample? When it’s µ-Law encoded!
It turns out that saying that early drum machines like the Linn Drum or the Oberheim DMX “used 8-bit samples” isn’t really true. It’s true that they used 8-bit memory, but those samples where played out through an interesting device, the AM6070 µ-Law DAC. You can have a look at the AM6070 µ-Law DAC datasheet if you’re curious. What makes this DAC different from the ones we’re more used to today is that it is not a linear output DAC. Instead, it accepts data in “µ-Law encoded” format, which is a type of simple floating point format, essentially. Human perception of volume is not at all linear (that’s why we invented decibels) in the same way that the human perception of pitch is not at all linear. Similarly to pitch, where we hear “octaves” (e.g. a multiple of two in frequency terms) as “equal”, we hear multiples of two in volume as roughly equal too (+6dB). The µ-Law takes advantage of this, and distributes the 256 possible 8-bit values across a much wider range by using 16 values for each 6dB range. This gives a much wider range than if the the values were mapped linearly to the output, and we don’t really hear the errors because we’re much less sensitive to loud signals than to quiet ones. Clever stuff. The net result is that the 8-bit data in the LinnDrum and DMX actually has more like a 12 or 13-bit dynamic range.
So what could I do? I can’t really get hold of a AM6070 DAC, and I want to use what I’ve got available, so I decoded the original data into 12-bit format, and then truncated it to 10-bit, since that’s all my DACs can output. So, yes, technically it’s even worse than a 1980’s drum machine. If that frightens you, look away now.
However, that was the only major hurdle. Implementing the variable sample rates using the 16-bit timers worked well, and I used a look-up table to convert from input CV values to 16-bit timer values so that I could give the sample rate controls an “equal octaves” character. Again, as noted before, this feels more “natural” to us poor humans. I assumed I’d need three control voltages per drum voice, but thus far I’ve only used two, one for the sample rate and another for the sample resolution. There’s another available in the code if you get a good idea what to do with it.
So it sounds terrible, right?
You be the judge of that. I like it, but it sure ain’t hifi! Here’s a sound sample, demonstrating the three sounds, and also tweaking the sample rates and the sample resolution for some really crunchy lo-fi chaos. The recording is my usual low standard – just a live laptop mike in the workshop, so not “studio quality” by any stretch of the imagination!
Incidentally, these samples were triggered using an Erica Synths Pico RND module feeding a CD4013 flip-flop on the breadboard, so the Snare and Kick are on alternate beats, and the Tom drops in randomly.
The chip has plenty of unused pins and resources besides CV inputs, in fact. One possible addition would be to use the UART to read MIDI data and allow the drum sounds to be triggered by MIDI. I haven’t done this, but it’s an obvious next step. Here’s what it looks like currently:
The code presented below uses three of the original Oberheim DMX samples, the Kick, the Tom and the Snare. Each of these samples is 4K, so they were obvious ones to go for. I could have included some of the others, but they might have required a whole chip to do it. Nonetheless, it should be possible to provide a full set of DMX or LinnDrum samples in 5 or 6 chips. That’s pretty good when you consider that the 8K sounds like the Ride cymbal on the DMX had to use two EEPROM chips just for the data! We can easily get the whole thing into one chip, and wrap up the clock and the DAC too, saving still more circuitry.
So what is left to do?
As I’ve mentioned, you’d need more chips with different samples in them. This is a question of decoding the original EEPROM images (or finding them decoded somewhere) and then turning the data into a table that can be pasted into the PIC ASM code. I use PHP for jobs like this, but there are lots of tools that would work.
Having individual outputs is handy, but a mixed output would be good too. The typical drum machine of this era lets you set the level for each drum, and we could add a pan pot to position each sound in the stereo field too. This is just a basic multiple-mono-sources-in/stereo-out stereo mixer application.
Finally, there’s nothing to trigger the drums with. You can use 0-5V trigger pulses from somewhere else (an LFO, for example) but it’ll be hard to program patterns like that! Writing a bit of code to convert MIDI information to triggers would be a simple way to allow the drums to be sequenced, or you could go the whole hog and build a standalone drum machine with its own onboard sequencer modelled on the originals, complete with chunky keyboard switches and lots of LEDs!
Druid DRUMS details
- Variable sample-rate drum sample player PIC 16F1778 DRUMS.ASM code
- Assembled DRUMS.HEX code from above file
- DRUMS 28-pin drum sample player Circuit Diagram
Currently, there are no plans to offer the DRUMS chip in the shop, so I’m afraid you’ll have to program your own chip, or find a friend to program one for you. If you’d like to see programmed chips in the shop, send us an email, and if there’s enough interest, we’ll do it!
Drums by Tom Wiltshire for Electric Druid is licensed under a Creative Commons Attribution-NonCommercial-ShareAlike 4.0 International License. Here’s the legal stuff.