Sunday, March 27, 2011

Intro To Circuit Bending (H.A.D.)


Electronic musical instruments are a lot of fun for a hacker because, with a small palette of tools, know-how and curiosity, they are easily modified. As with any hack, there is always the chance that the subject will be ruined, so it’s not necessarily worth the risk to muck about inside your thousand-dollar pro synthesizer. Luckily for all of us, there are shovel-fulls of old electronic musical toys littering the curbs and second-hand shops of the world. These fun little devices provide ample opportunity to get familiar with audio electronics and circuit bending techniques.
A note on definitions: the term “circuit bending” can be synonymous with “hardware hacking” in the world of audio electronics, and we have seen some debate as to which term is better suited to a given project. We welcome you to share your viewpoints in the comments.
Keep reading to get started.

Materials
So, you’ve heard of circuit bending and you want to give it a try eh? Well for this introduction, you’re going to need at minimum the following materials:
  • electronic musical instrument (the bendee) with batteries or AC adapter
  • alligator clips (for temporary connections)
  • various resistors and/or a potentiometer
  • ears
and it’s a great help if you also have:
  • oscilloscope
  • bench-top power supply
  • camera
For our first attempt at circuit bending, we will be using a Yamaha PSS-14 keyboard. We found it by the side of the road, abandoned and lonely and without a friend in the world. Like mad scientists conducting mad genetic experiments on lonely abandoned animals, we will rebuild this poor creature to be better, stronger, and stranger than before!
Background Research
Thanks to our high-fallootin’ academic standards, we’ll start by researching a little bit about the keyboard in question. The more adventurous among you can skip this step and dive straight into the fun part. From Yamaha’s site, we can see that this model sports “100 Advanced Wave Memory Voices”–that’s their hilarious marketing term for “100 Pre-written Sound Files”–making this what’s known as a “Wavetable Synthesizer”. Wavetable synthesis is a very easy and cheap way to create sounds because you can simply copy a bunch of sounds to the memory of the chip and then read through them sample-by-sample, changing the sampling rate to change the pitch (or having separate samples for each pitch value, depending how much memory you have to play with).
Further research reveals that we’re not the first to circuit-bend this particular keyboard. This example and also this one show some interesting possibilities, and by the end of this article we’ll have a better idea of what they’ve done. But enough talk, let’s crack this baby open!

Here we see the PSS-14 in its original state: operational, but missing the case screws (it was held together by duct tape when we found it). Perhaps a previous owner did some exploration of their own?

The preprogrammed songs cover all the major categories of music: Memories, Cool&Hot, Favourites, Fun Time. When we were younger we used to listen to Cool&Hot music all the time, but then it got mainstream so now we’re mostly into the underground Memories scene. You haven’t lived ’till you’ve heard the new remix of “Gallant Pig”.

There are twenty keyboard-controlled voices to choose from, most of which sound about the same. The volume controls seen here make a very loud “bongo” sound when you press them, no matter if the volume’s as low as possible.
Look Under the Hood
Clearly this thing could be better, so let’s open it up and see what we can improve about its operation.

The circuit board under the hood is pretty sparse, which is somewhat unsurprising seeing as it’s a wavetable synth and therefore most of the fun stuff is taken care of inside the microcontroller seen on the right. If you can find old electronic musical toys from before the digital era, you have access to a lot more of the nitty-gritty sound generation. Unfortunately those are much harder to find on the side of the road.

On the left side of the circuit board we can see the clearly-marked Vcc and GND connections, which would be easy enough to find from the battery terminals. The keyboard takes 4 AA batteries, which means it runs on a 6-Volt supply. We didn’t have the AC adapter for this keyboard so we’ll run it off of our bench-top power supply for now.
This hardly needs to be said but BE REALLY CAREFUL if you are going to use an AC-powered device. The bench-top supply we’re using has a current-limiter but a wall-wart transformer can push dangerous  crowds of electrons through your body, which we understand to be an uncomfortable experience.

On the right, we can see a bunch more resistors and–the holy grail–a clock component (it’s the blue blob to the left of the IC)! On digital synthesizers this is generally the main source of fun.

In the middle of the board there is a cluster of capacitors and what looks like a multi-transistor package. When we turn the board around and start probing, we’ll figure out what this is all about.

The soldered and printed side of the circuit board is much more interesting to look at. The dark patches that you see are conductive ink–this is a really common and cheap sensor technology used in everything from the humble NES controller to high-end Roland electric pianos. It’s a form of what’s known as a force-sensing resistor (FSR) and it suffers from major nonlinearity, hysteresis and repeatability. On the other hand, it’s dead easy to implement and it can be printed onto a board.

On the underside of the CPU we can start to characterize the pin functions. A lot of the pins go out to the various keys and buttons. A lot of those transistors that we saw topside are dedicated to this key matrix, too.
Scope it Out

Upon further investigation the button/key states are time-division multiplexed onto pulse wave signals based on a global excitation, illustrated here. According to this fellow who lists a circuit-bent PSS-15 (same model as this but with a silver control panel), connecting part of the audio output to the keyboard matrix returns can re-trigger buttons or keys to make “loops”. Very interesting, seeing as:

The keyboard uses a PWM-based DAC scoped here in comparison to the audio output further down the line. Again this is a very cheap technology (you can make one for your arduino pretty easily) and you can get a simple explanation here. Right off the bat we can see that a disadvantage to this technology is that its transition times between various voltage levels might be difficult to control, possibly leading to distortion. That aside, it will be interesting to connect the PWM DAC output to one or more of the keyboard matrix returns.

Here is a closeup of two interesting “hack points” on this keyboard. We’ll change the resistors on the right to see what it does to the signal, and we’ll change up the existing 8MHz clock for a different one.

The sine wave oscillations of component CL1 can be scoped to show a transformation into square wave, which we can safely assume is driving the operations of the microcontroller.
Modifying the Circuit
It just so happened that we had a spare 3MHz oscillator sitting around, so let’s find out what happens when we drive this device at 3/8ths of its normal speed.

A quick and dirty soldering job gives immediate results. In the video you can hear the results with the new clock and changing the resistor value at the PWM output–overdrive city!

Furthermore, by patching the audio output to parts of the keyboard matrix, we can create the “loops” as discussed eariler.
The results thus far have been, well, a little underwhelming. We can make the sounds slower and we can make little loops, and we’ve learned a little bit about consumer-level electronic toys. Still, at this point we were hoping to have unlocked some seriously badass digital fury.
Serendipity came to our help at this point, and an inadvertent touch of the oscillator legs produced the righteous vibes we’d been banking on!

The sounds that came out of this thing were incredible. Somehow, after assembly, this type of thing was happening at startup and it’s now only about a one in ten chance that the keyboard boots properly. Even then it’s at running 3/8ths speed… except some of the time, somehow, it properly adapts the PWM output so that despite the underclocked CPU the wavetables read at the original sampling rate. Who knows what is going on that ASIC.
What to do with it now?
At this point in our circuit-bending adventure we’ve characterized the operation of the device and found a couple of fun bends. Where to go from here? Well, one option would be to make the modifications permanent with the addition of pots, buttons, patchbays and what-have-you so that the end result is a sleek and performable instrument. We’ll be saving for a later date. Since, as we mentioned at the beginning of the article, it is quite possible to destroy a hacked piece of electronics simply by virtue of the stress caused by the modifications themselves, we’re going to finish this bend by recording the myriad new sounds that the keyboard produces, and composing a short celebratory piece of music:

Summary
While you may not have this exact toy keyboard at your disposal, the same techniques and methodology used here can be applied to many other audio devices. It’s simply a matter of
  1. Taking your time
  2. Understanding the technology
  3. Characterizing the circuit
  4. Experimenting
At the end of the day it’s not really that difficult to get started at this sort of thing–hopefully the concept of circuit bending has been demystified for some of you. This isn’t to say that circuit bending can’t go deeper than shown here, as this only shows the most elementary steps. And the complexity of the device you’re working with greatly affects the types of bends you can do–for example, the TR909 has many timing circuits that can be played with in much the same way as our Yamaha. We’ve recommended it and we’ll recommend it again, but for further reading be sure to check out Nick Collins’ Handmade Electronic Instruments. It contains a good section on toy hacking, and it’s generally a very good read.
If you enjoyed this introduction and want us to write further articles exploring different parts of circuit bending (or audio hacking in general), please let us know in the comments.

1 comment:

  1. Ah a friend of mine told me about this
    This helps me understand it a little better

    ReplyDelete