11 posts tagged “physical computing studio”
Complete Arduino code here.
I've built all the functionality I want for this semester for the CrudBox (I plan on continuing with it for NIME and likely beyond). Check out the video.
It can now remember 4 different loops. You can see which one you're one on the 7 segment display and scroll to different ones with the rotary encoder knob next to it. The tempo can now be seen on the 4 LEDs in the lower right corner.
To reiterate how it works:
There are 4 speaker terminals on the box, into each of which you can plug any object that can run on 5 volts. In the video I've plugged in LEDs because it makes the interaction clearer, but my main interest is in plugging motors in, attaching them to the box, and amplifying the sounds they make. Each speaker terminal has a button and a pot. Pay attention to which of the 4 tempo LEDs is on, then press a button, then let go. It will switch on the object (motor, LED, etc), then switch it off when you let go. The next time it cycles through the loop of 4 LEDs it will switch on and off at the same points. The object will pulsewidth modulate at different speeds depending on what position the pot is in when you switched it on. You can do this up to 8 times and can change the PWM with each one, then do the same with the 3 other objects.
Whatever number is currently displayed on the 7seg display is the number of the loop you've created. Turn the rotary encoder and the number will change, and you can do what you just did with this new loop. The 7segment display shows numbers 1-4, so you can record 4 different loops.
The code above uses 1 MC14067BCP analog multiplexer for all the switches and knobs for the 4 objects. The rotary encoder and the erase button use digital pins directly on the Arduino. The output is two 74HC595 shift registers in sequence, one for the 7segment display and one for the objects output.
I made my own 7 segment LED with 21 LEDs and a small piece of perfboard. I had planned on using a normal premade 7 seg display, but I fried 2 of the 3 I bought trying to use them with a 16 channel LED driver chip and a darlington array (i gave them too much power and some of the segments burnt out), and I couldn't find the third one, and in a rush to accomplish something I ended up building this. It took a few very focused hours of soldering. I really dig the look, definitely something of a happy accident.
Since I don't have enough digital outs left on my Arduino for a 7 segment LED driver chip I had to control it through my chain of shift registers. I had to manually write an array for which shift register pins to switch on and off for digits 0 through 9. Here it is:
int digitArray[] = {//zero
1,1,1,1,0,1,1,
//one
0,0,1,1,0,0,0,
//two
0,1,1,0,1,1,1,
//three
0,1,1,1,1,1,0,
//four
1,0,1,1,1,0,0,
//five
1,1,0,1,1,1,0,
//six
1,1,0,1,1,1,1,
//seven
0,1,1,1,0,0,0,
//eight
1,1,1,1,1,1,1,
//nine
1,1,1,1,1,1,0
};
And here's two examples of it in action. The top video shows it counting 1... 2... 3... 4... with the tempo of the loop. The bottom video shows it moving from 0 to 9 as I turn the shift register.
Today I wrote the code to do pulsewidth modulation on the CrudBox's outputs. The 4 buttons above and below the speaker terminal outputs switch on the LEDs hooked into the terminals. When I press a button its output terminal switches on and pulses at a speed controlled by the pot next to it. The main point of the CrudBox for me it to control motors but I used LEDs here because they better illustrate the pulsing action, as a motor pulsing quickly and slowly probably look about the same on a compressed YouTube video).
The pulsing is done using a shift register with digital outputs (a SN74HC595N to be precise (very helpful Arduino tutorial for it here)) by rapidly switching on an off the output pins in my Arduino code. It takes a pot's value, gets it's square root (since the pots are "volume" style the value goes up more quickly on one end that the other and I had to find a way to make the values more linear) and normalizes it with some other math so that so you get a value between 1 and 5. If the value is 5, the output pulses on and off once every 5 Arduino loops. If it's 1 the output is on continuously. If it's 2, it switches on and off every other loop. And so forth.
The Mechanical Synth has officially changed its name to the CrudBox. The Mechanical Synth sounded too generic, and I'm really trying to emphasize
1) the idea of music made from junk, or of using new, cutting edge technology to control junk and
2) the kind of grimy, totally atonal (yet controllable) sheet metal sounds it makes which I like so much.
Things to add or finish by the end of the semester:
-Figure out how to "pulse" the motors to make them move at varying speeds (thus producing sounds of varying pitches)
-Add 2 7 segment LEDs, one which will allow you to scroll through the beats you've recorded, and one to count from 1 to 4 over the course of a loop, so the user can easily get an idea of the current tempo.
-Build a simple preamp into the device so that it doesn't absolutely have to be hooked up to separate amplification by way of guitar pedals and a mixer.
Also:
-Get a plastic bag and as hygenically as possible stick motors and contact mic in my mouth. I keep thinking about doing this and probly won't be able to stop until I actually try it and see what the results are.
Things to add once the semester is over:
-DosOnChip nonvolatile memory board (for saving your beats)
-Some sort of Master/Slave system where numerous Crudboxes can be synched up
I'm also thinking about:
-Wireless control of motors and sequenced devices
-Building reverb coils, then experimenting with using motors to physically hit them, hopefully resulting in that splashy reverb drenched thwack sound which has been featured on every dub track ever made.
-Experimenting with building the Crudbox interface into enclosures of different materials. Right now its in an aluminum sheet metal box, and whenever someone plays with it their first instinct is to get sounds by attaching the motors to the box. Some other things to potentially build the Crudbox interface into are hollowed out wood, a crash or ride cymbal on a stand, and something with some sort of goo or liquid inside it.
318-ENC111F-20P Rotary Encoder at Mouser
A rotary encoder essentially functions as endless potentiometer. But unlike a pot which measures resistance, it measures how much it has turned using two digital signals which switch on and off in a way which can tell you which direction the pot is turning. The accuracy of a rotary encoder is its "resolution", which is how many small turning increments or rotation it can detect in a 360 degree turn. I believe the 318-ENC111F-20P has a resolution of around 25, meaning every 25th of a full 360 degree turn you turn it, it can tell you that it just moved a little in that direction. So far it's working very well, it's totally accurate and can tell you how much it's turned even if you spin it very quickly.
This particular pot is good for me because on every 25th it clicks into position, so if someone wants to control the 7 segment display (in the post below) it will be a very clear interaction for one "click" of rotation to increase or decrease the number on the display by one.
How to get it working:
In the image above pin 3 is connected to 5 volts, and pins 2 and 3 are connected to digital inputs on Arduino. The resistors to ground (I'm using 4.7ks) are ABSOLUTELY NECESSARY(!!). It will not work without them.
The code is taken directly from "Reading Rotary Encoders" on Arduino Playground. I used the simpler code on the top, which works like a charm, so I didn't try the significantly more scary looking code on the bottom.
The only problem with the 318-ENC111F-20P is that its pins are very flimsy, I don't think they're really made to be soldered to: all 3 snapped off within a few days on soldering wires to them. My solution was to cover the connections with lots of hot glue, which is doing well so far.
As you can see in the video, when I turn the pot, the numbers on the display go up or down. The 7 Segment LEDs are controlled by Darlington Arrays, which are controlled by a TLC5940 Texas Instruments 16 Channel LED Driver, which is controlled by Arduino.
The TLC5940 may seem like a strange choice since it has pulsewidth modulation which I'm not using here since I want each LED to be either on or off, but they can be strung together like shift registers, so I could forseeably use only 7 Arduino output pins to control all of the dozens of outputs my project is going to have, some of which are actually going to need pulsewidth modulation.
For whatever reason the current coming out of the TLC5940 is really weak, so my solution is to use Darlington Arrays for every output. They're only 40 cents each at the NYU Computer Store and are very easy to implement.
There was one strange thing that happened with the LED driver and the Darlington Arrays though. At first when I hooked everything up the LEDs on the display which were supposed to be off were actually pulsing very slowly, which didn't look so nice. For some reason putting a 4.7k resistor to ground on just one output pin on one of the two Darlington Arrays fixed this problem.
JaeWook made me these amazing drawings of potential interfaces for the Mechanical Synth... Just look at em!
I particuarly like the cassette, partly because its the exact proportions of the classic Califone suitcase turntable, which I've been considering building the MS into. I think at this point its becoming more and more likely it is going to be built into some kind of suitcase (something which opens and closes to reveal the actual interface, which keeps it safe when not in use, with a handle for carrying it around).
Okay, so I'm not sure whether to make the Mechanical Synth look like the kind of sequencer or drum machine you'd see at Guitar Center, or like a unique "art object". There are pros and cons to both. Assuming I was to build the same rather elaborate functionality explained in my first post into both:
Pros of more generic looking instrument:
-more appealing to a "real" musician, easier to learn to use for such a person with experience with electronic music
-very easy for me to design
Cons of more generic looking instrument:
-not really a visually interesting object
-might not be as fun for a beginner or nonmusician to play with because of the lack of novelty
Pros of more unique art object of an instrument:
-more of a toy or a novelty, more likely to draw the attention of nonmusicians and people not excited by a Dr. Rhythm (see below)
Cons of more unique art object of an instrument:
-depending how unique the design is, some advanced functionality may have to be sacrificed
-will take more time and energy to design (though this may not necessarily be such a bad thing)
-*probably* more expensive to design (assuming nothing could be much cheaper than a generic plastic Radio Shack enclosure and using the generic knobs and switches i already have)
So I guess all that stuff is fairly obvious. The thing to focus on is functionality and ease of use vs. beauty and novelty.
Examples of generic instruments:
Boss Dr. Rhythm DR-770
I have one of these at home and, though most of the cheesy drum hits leave something to be desired, and I doubt I'll ever use it for anything, it's a lot of fun and I'll probably never get rid of it. Anyone with a rudimentary knowledge of music (really, anyone who knows what Beats Per Measure and Tempo are) can figure out how to set the key parameters (BPM, tempo, etc) the way they want it, record, and play the recording back within a few minutes of taking it out of the box. However the more advanced functionality, like creating your own drum kit, changing the reverb and ambience settings, quantizing your beats, will take a bit more time and effort to figure out. These advanced controls are pretty intuitive, they generally make sense, but there are so many buttons and settings that it is easy to get confused your first time around.
So: very easy to understand the basic functionality, gets more complicated as what you're doing with it gets more complicated. You can have a blast playing with it right out of the box, and with some practice sequence the rhythm section for entire songs. It takes 10 minutes to learn, a lifetime (almost) to master, thereby satisfying both beginning and advanced musicians and users for the most part.
Examples of art object instruments:
Quintronics Drum Buddy (link)
This is simultaneously the most beautiful instrument I've ever seen and an extremely limiting and just not very impressive composition tool IMHO. The sounds are made by light from inside the rotating can (you punch holes in the can, and can take it out and put in more cans with different holes) hitting photo cells in the colored tubes pointed it it. The various knobs and switches control which sounds are created by the photocells. That's it. The sounds are all analog and some, especially the drum sounds, are quite nice, but some are not that far beyond what you can get with Arduino or 555 squarewaves. Still these are absolutely gorgeous and different ones go for between $1000 and $5000, though I've never heard of anyone besides Mr. Quintron (the guy who makes them) using them in performance or on a recording, so I'm assuming these are all being used as conversation pieces in the living rooms and entryways of the wealthy and eccentric.
The main point I'd like to make about the Drum Buddy is that a toy or instrument with less than impressive functionality can still be a successful object if it looks great and will continue to look great long after you're sick of playing with it, and/or if its functionality is complimented by its aesthetics. Not that I would want to approach this or any other project with that attitude, but still something to think about.
to be continued...