Noises from the Arduino

The 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);
    digitalWrite(speakerPin, LOW);

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 );


Arduino Random

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 );

Arduino Sweep Slow

Arduino Sweep Medium

Arduino Sweep Fast

Arduino Sweep Very Fast

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!


3 thoughts on “Noises from the Arduino

  1. 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”. ;)

  2. 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.

Leave a Reply