Monday, December 28, 2009

Experiment 4 - pd and arduino

I've been thinking about a platform for building musical instruments made of out physical controllers, and one plausible option is to use the Arduino as a data gathering device feeding into PureData (pd). There is a firmware project (Firmata) that turns the Arduino into a data gathering device for pd, and a pduino project for pd that provides pd objects that can read from and write to the Arduino.

I haven't played with pd very much, so I'm only scratching the surface here, but I assembled a little instrument that responds to the ambient light in the room by altering the pitch of a sine wave oscillator. Of course, I couldn't see fit to leave well enough alone, so I added a bit of FM synthesis (based on the pd tutorials), whose parameters are also controlled by the ambient light, so this is sort of a twisted theremin.

I can't figure out how to record the audio output of pd (in the 30 minutes I spent trying to figure it out), so there's no recording of this experiment. The circuit is very simple - a voltage divider to measure the voltage drop across a photoresistor, connected to analog input 0 on the Arduino. Here's a screen capture of the pd patch.



I got a little tricky where the sampled output of the photoresistor feeds the oscillator input frequency, but also feeds the amplitude and frequency of the FM component of the sound (for more information on FM synthesis, see the "A09.frequency.mod.pd" section of the PD help files. It sounds like a theremin with a "send-back-to-factory" problem.

No comments:

Post a Comment