Arduino and Sound

October 14th, 2008. Filed under: arduino, hardware, processing.

I modified another old Processing program of mine to graphically react to sound using the Minim library. The program outputs the sound level to an Arduino connected to a breadboard, creating a sound level meter using LEDs. The code is a bit sloppy (and uncommented!) as I quickly tried to prototype these ideas:

Arduino Code, Processing Code 

12 Responses to Arduino and Sound

  1. robert

    cool…one neat thing about the minim library (if you don’t know already) is that you can do FFT analysis and then average on a log scale…it could be nice to have each LED illuminate based on the amplitude of a specific band of frequencies.

    you could also use PWM (analogWrite) to vary the brightness of the LEDs, too.

    nice progress!

  2. nick

    good ideas rob. i’ve only done some cursory reading on FFT analysis and PWM, but i’m excited about implementing them.

  3. Cool toys and Gadgets » Blog Archive » Visualizing sound with an Arduino

    […] More about Visualizing sound with an Arduino […]

  4. Visualizing sound with an Arduino | SquareCows

    […] More about Visualizing sound with an Arduino […]

  5. gmuller

    I’ve been goofing off with this same stuff lately (the Minim library and FFT analysis). The problem I’ve running into is that something like lighting up an LED will be darn close to realtime, but displaying a sketch will be off by a small amount. For recordings this is easy to combat, simply read the file into a buffer without playing it, then based on each sample write out a frame, of course you have to put it all together with some other piece of software later, which is kinda lame. For live work I’ve been using MIDI to control the visuals

    Very cool work though, I haven’t tried with the actually Arduino board yet, just working with processing thus far…

  6. nick

    @gmuller I’ve noticed this as well. I thought it was due to my computer being too slow, but I’m not convinced. If you find a way to improve the latency, I’d love to hear about it.

  7. WombatNation » Arduino and Processing Experiments

    […] the Minim library for working with audio, inspired by a link on someone’s Twitter feed to someone else’s experiment with Minim and an Arduino. I’ve cleaned up and reformatted his code in my own fetishistic manner, and now I’m […]

  8. Ninjia Arduino» Blog 存档 » 4 in 1 Environment Test Meter !

    […] http://nicklally.com/?p=330 […]

  9. Amber

    So I tried getting the arduino to react to music. It doesn’t want to for some reason. Is it just any music player or some special program on your computer that would have it react? I’m working on a project for my electronics class and this is the code that would make my project actually do what I want it to but for some reason it doesn’t react… Anything I can do?

  10. nick

    No special player, just the code for both Processing and Arduino running together. It is using the internal mic in my computer, so you might check that the volume on it is turned up.

    Are you seeing the Processing program react to sound and not the Arduino? I would need more details to troubleshoot your problem.

  11. Amber

    Yes actually the processing program is reacting nicely to the sound. I was really surprised to notice that it picked up my voice too.

  12. » mpm 33 documentation: starbox > Mike’s Blog

    […] Processing Code was based off of this code here written by Nick Lally. We altered the object from circles to stars that still change colours while […]

Leave a Reply

You must be logged in to post a comment.