Intro: Adding CV Inputs to the Auduino Granular Synth
When I first got into the Arduino I went looking for audio projects. One of the first things I built was TobaTobias' Auduino granular synth. I was so impressed I built a permanent unit in a heavy duty enclosure and incorporated it into my occasional sets and demos.. This simple project makes really impressive sounds- from clean bass to dirty, brassy highs. Whenever I play out the funky growl of the Auduino granular synth gets people's attention. With this project I will add inputs so that the Auduino can be controlled by an external sequencer, in this case a Lunetta CMOS based noise synth.
A Lunetta is a DIY sound generator. They are modular, meaning they consist of multiple discrete units. The modules are connected with patch cables- wires with alligator clips that can be rearranged in many ways. Lunettas are built with CMOS logic chips. These chips are the basic building blocks of computers and digital circuits. They are used to create, combine and control binary digital signals- 'ons' and 'offs'. In a typical Lunetta set up the pins of these chips are connected to metal posts. These posts can be connected with the patch wires to create complex circuits that produce tones, rhythmic patterns, melodies and many weird sounds.Here are few tracks made with my Lunetta- Confidence is High and Makeshift Morgue.
For this project I'll be adding vactrols to allow the 12v from the Lunetta to control the 5v input of the Arduino. I'll also add another vactrol to act as a gate, turning the output signal on or off with an external signal.
My Lunetta is one of my favorite projects ever! It has over thirty modules- from oscillators and counters to dividers and rate multipliers. It's built into a gun case that my buddy Gordy rescued from a dumpster. The panels are made from 4" PVC fence posts cut down to size. I've had more use and entertainment out of it than anything else I've ever built. I will be building a new one soon and writing an instructable about the process. For now enjoy this introduction.
Step 1: Preparing the Arduino.
I connected my Arduino to the computer with a USB cable and went to the Auduino Instructable and opened the sketch in my editor. I had the choice of how I wanted my granular synth to make notes. It can be set to make a chromatic or pentatonic scale with distinct notes or it can be set to a smooth scale where there are no stepped notes at all. The granular synth I use for performing is set to have stepped pentatonic mapping. This makes it sound very musical. For my Lunetta project I decided to use the smooth note mapping to match the chaotic nature of the instrument. The mapping changes are all explained inside the Auduino code. Be sure to read the Auduino Instructable for a better idea of what we're doing.
Step 2: Preparing the Panel.
The panels of my Lunetta are made from PVC fence posts. I cut about three inches from the middle of two opposite sides to create two flat panels with right angled short sides for rigidity. This is a really cheap material and it's very easy to mark and drill. The panel I'm using for the Auduino is at the end of the instrument and is cut to fit the contour of the case. I used graph paper to lay out my posts and pots. The pots are standard 10k pots salvaged from an old mixing board. The posts are made from a bolt, washer and nut. I taped the paper tp the front of the panel and used a sharp awl to mark the center point of each part. I used a hand drill to drill out the holes using appropriately sized bits for the intended part. When everything was drilled I populated the panel to make sure everything would fit. When I was satisfied with the results I removed and wired the pots and reinstalled them with knobs. I wired the common power and ground leads of the individual pots and installed leads to connect to the Arduino's +5v out and ground. It is important to color code your leads to make it easier to connect everything at the end. By having the same color wire carry the signal from start to finish within the circuit it also makes it much easier to figure out what's wrong if it doesn't work right. I started with the top pot and soldered a lead to the center lug- purple, blue, green, yellow and orange respectively. The controls are frequency, pitch A, decay A. pitch B and decay B. I also decided to use white wire for the audio out and gate portion of the circuit. At this point I tested the Auduino by connecting the colored wires to the corresponding analog pins on the Arduino. I connected the common power and ground leads from the pots to the board and connected digital pin 3 to an amp with a ground connection. Everything was A-OK so it was on to the next step.
Step 3: Building and Setting Up the Vactrols.
I wanted to add inputs to the five control knobs for control voltage (CV) from my Lunetta noise synth. Since the Lunetta is a raw lofi instrument this project will use a very basic form of CV. Don't expect one octave per volt precision like you find in modular additive synthesis or midi gear. This isn't an instrument for writing music, it's an instrument for discovering music. My philosophy regarding the Lunetta is to just let it do it's own thing- the circuit knows how it wants to sound.
Since the Lunetta operates at 12v and the Arduino's analog inputs want 5v I decided to use DIY vactrols to allow CV from the Lunetta to control the Auduino.. A vactrol is basically an LED coupled with a light dependent resistor (LDR or photoresistor) in a light proof casing. An LDR is a variable resistor. Instead of relying on a rotating knob like a potentiometer, the resistance of an LDR is determined by the amount of light shining on it. The dimmer the light, the higher the resistance until the LDR blocks all current. When a current is passed through the LED of the vactrol it illuminates and allows another current to flow through the LDR. By varying the current to the LED it gets brighter or dimmer which changes the resistance of the LDR and current at the output. This variable voltage is used to control another circuit, in this case the pitch or decay of our Auduino.
I make vactrols by putting an LDR and an LED face to face inside a piece of heat shrink tubing. I heat the tubing to shrink it and crimp the open ends over the leads to seal the package. I use a paint pen to mark the +v side of the LED. This saves much confusion later. Check out the illustration above to see how the vactrols fit into the Auduino circuit. Basically we're taking CV from the Lunetta and passing it through the LED of a vactrol into a common ground. The other side of the vactrol is inserted between the pot and the analog in of the Arduino. The vactrol varies the voltage to the pin of the Auduino while the pot itself allows you to control the range of the particular control parameter of the granular synth. An additional vactrol is included to gate the audio output. Gating means that the output can be switched on and off by an outside CV signal.
Vactrols are not an ideal switching optical isolator. LDRs have a little lag. When the LED goes off the resistance of the LDR does not stop the signal immediately, but sort of 'fades'. While this latency would not work in a high frequency circuit, at lower frequencies it gives an interesting decay effect to the signal. For more exact switching applications the PC817 optical isolator is a much better choice. It is a four pin monolithic IC with an LED and a phototransistor which has a much quicker response time. When I had six vactrols completed I mounted them on a board with LED resistors, common grounds and input/output leads installed. See the above schematic. The leads to the analog ins of the Arduino are soldered to a set of five header pins bent at a right angle.
Step 4: Putting It All Together.
Now I put everything together. First I soldered the colored leads from the pots to the corresponding
leads from the vactrol board. I connected the +v in leads from the vactrols' LED sides to the corresponding posts. This allows the Auduino to be controlled by external signals. I soldered the white audio out lead from digital pin 3 to the final vactrol's LDR. The other side of the LDR is connected to the audio out pin. The LED side of the final vactrol is connected to the gate pin. I put a piece of paper for insulation between the vactrol board and the panel mounted pots and arranged all the wires neatly. Next I installed some offsets to hold the Arduino above the pots, posts and the vactrol board. I plugged the headers from the vactrols into the analog inputs. I made a new four pin header to connect the leads from the common power and ground of the pots to the +5v and ground pins of the Arduino I also connected a power in and master ground lead so I could power the Arduino from the 12v supply of the Lunetta. I plugged these headers into the Arduino. Finally I installed a lead from the Arduino's digital pin 3 for the audio out and carefully mounted it on the offsets.
Now's the part where I admit that in my haste to get everything hooked up and making noise I forgot to drill holes for the gate and output posts when I was setting up my board earlier. Drilling into a pnel with things already installed is always a nerve wracking expeience. Luckily nothing was damaged.
I connected the unit to my Lunetta and wired a simple CV circuit to test the Auduino. Success! I tried two different kinds of digital-to-analog-converters (DACs) and different configurations and was very pleased. The Auduino granular synth will definitely have a hamo in my noise setup.
One thing I'd like to change is the range of the analog read for all the parameters. It seemed as though the range of the CV controlled unit wasn't as wide as the range of the manual instrument I usually play. This could be fixed by changing some variables in the sketch.
Here's a video of the CV controlled granular synth in action along with a few other new modules-