Raspberry Pi sensing audio?

Hi all --

I have been programming all kinds of things all my life, but I have never had a chance to build a program that responds to audio input.  Suddenly: Dancing Baby Groot.  I have a great idea for an algorithm for making a very clever and funky Dancing Baby Groot using Raspberry Pi or Arduino -- if I can figure out how to get the processor to "listen" to audio input.

How would I get one of those processors (or any processor) to "listen" to the mic and translate it into either digital or analog data which one could then plunder to figure out the tempo and beat in order to get Baby Groot to Dance?  I am 100% sure I can do the plundering (because it works on digital files) if I can get the processor to "listen" to the mic and create a file of numbers which represent the music being played.

Any suggestions?

caitlinsdad2 years ago

Essentially the mic will probably outputting some kind of analog signal - voltage values. The arduino or pi would convert that input using onboard hardware DAC(digital to analog converter) to digital values 0-1024 that can be used by your program. You have to account for electronic noise and variable gain or amplification of the mic input if it is not sensitive enough or doesn't give a signal in the range that the microcontroller can interpret.

Look up any project on "color organ" with an arduino or pi. They take sound input and make LEDs or lights flash/change color according to the input. Adafruit has some good tutorials with the "ampli-tie". If you are looking to analyze the sound by frequency rather than loudness levels, the adafruit's "picollo" project shows the Fast Fourier Transform FFT frequency analysis algorithm in use. Instead of light, you just program the response in different ranges to drive servos. Good luck.

TheFrankTurk (author)  caitlinsdad2 years ago

You know: as a person who has been on all kinds of forums for decades, it is rare to get a perfect response from the first person who posts a response to a question. Yet here we are at Instructables, and I have all my questions answered.

Thanks C-Dad. You made my whole year!

Thanks.