Noises from the Arduino
January 18, 2009 – 12:50 am by Michael KoppelmanThe Arduino is a little programmable doo-hickie that can be used for lots of things. I was playing with mine recently and hooked the digital outs up to an analog sound board. This is a common thing to do with the Arduino. You can coax the thing into making analog-like sounds through the digital output. Since it is digital, everything is a square wave.
All of these sounds were made with a little routine I got from the sample code for making a sound:
void playTone(int tone, int duration) {
for (long i = 0; i < duration * 1000L; i += tone * 2) {
digitalWrite(speakerPin, HIGH);
delayMicroseconds(tone);
digitalWrite(speakerPin, LOW);
delayMicroseconds(tone);
}
}
Here are a few little audio samples that I made tonight whilst fooling around. The first one is just random frequencies:
long i = 0; i= random(5, 100); playTone( i*i, 100 );
The rest are just a sweep using different durations:
for(int i = 5; i < 100; ++i ) {
playTone( i*i, 50 );
}
for(int i = 100; i >= 5; --i ) {
playTone( i*i, 50 );
}
It has digital and analog inputs as well, so my next goal is to use some sort of control voltage to make noises. More to come!
M.

3 Responses to “Noises from the Arduino”
Nice one, Michael. I have yet to do anything with my Arduino. Still researching a bit until I’ve made a decision. I might make a bit crusher, or a MIDI to CV converter. When you say, “hooked it up to an analog sound board”, what hardware do you mean exactly? Can you connect it directly to a pre-amp, or does it need to go through an op-amp first? Cheers!
BTW: you said, “doo-hickie”. ;)
By John Keston on Jan 18, 2009
I just basically took a guitar cable and stripped the 2 wires and stuck them in the breadboard and then took digital pin 9 to one and the ground to the other.
It’s unfortunate there is no D/A in the Arduino (i.e. no analog out). I don’t know how heavy the MIDI spec is, but CV MIDI seems totally doable.
By Michael Koppelman on Jan 18, 2009
Check out the arduino piano from crittari and guitari:
http://www.critterandguitari.com/home/store/arduino-piano.php
I had already a lot of fun programming that little thing:
http://www.gorehole.org/nostromo/tag/arduino-piano/
By M-.-n on Jan 19, 2009