Recording Audio Sample Data

Hi all. First let me say that I am very new to the arduino and have been told that it has a rather steep learning curve. Furthermore, I have a fair amount of programming experience (C and C++), however my skills in electrical engineering are bit rusty :wink:

Anyway, to my question: I am doing a project for school that requires me to simultaneously read in 4 audio lines. I planned on using 4 electret condensers(standard mics) and simply plugging them into the analog inputs. However, after doing a bit of research on using microphones with the arduino (which seems to be lacking in any substantial amount of material), i read that using a mic through analog input could only distinguish between varying intensities of the detected sound. Is this so? Will I not be able to get accurate enough sample data to record a waveform? If so, is there any alternative method of accurately recording sound with the arduino?

Any help with this is greatly appreciated!

Welcome to the Arduino forum. I don't think you will find the learning curve too long as you have the language experiance and the hardware is a learn as you use it kind of situation. As far as your application there are two areas to consider.

  1. The amplitude of microphones is just millivolts and will need amplification via op-amp to get any useful resolution. The Arduino A/D are 10bit 0-5vdc inputs.

  2. Sample speed. One has to sample at better then twice the highest desired bandwidth frequency to be able to reconstruct the signal. If however you just want to destingious between sound and no sound then sample rate may be less. And if you are wanting to sample all four channels then that is X4 for a single channel.

Perhaps if you explain better the application we can steer you better. It could be that the Arduino will not have the speed if 4 channels of audio need to be sampled at hi-fi bandwidths.

As far as reference material the best hardware reference is the chip's data sheet:


Thank you for the reply!

Essentially, I am attempting to triangulate the location of a sound by analyzing the frequency and intensity of that sound using four different microphones positioned in four different places. My first step is simply to look at the intensity of the sound. In the future, however, I foresee having to analyze frequency (likely via an FFT). Luckily, the frequency of this sound will likely be relatively low (<800Hz range).

In the meantime, Ill look into what you have suggested.

Once again thank you for the help!

Remember that Arduino only has 1KB of RAM for storing your sound samples + all other variables in your program.

Yes, that was also a concern of mine, however, I was under the impression that it would be possible to stream the data directly to system memory one value at a time as opposed to populating an array and then obtaining the waveform

sorry but i don’t understand what you mean by:

"to stream the data directly to system memory one value at a time "

No matter how you store the audiodata you still only have 1KB RAM.

Sorry, "stream" probably wasnt the best terminology. Ultimately, I planned on simply using the 1k as a buffer. The actual data would be recorded and processed on my desktop system as opposed to doing everything on the arduino itself. This shouldnt be terribly memory intensive. Hopefully that is a better description?

That makes sense :-), just remember that Arduino uses some of the 1K for internal structures, and all your variables are also allocated from the same 1K, so you probably won't have more than around 700 bytes available.

What exactly will Arduinos role be ? capture data from 4 mics. and send it to the PC ?

"capture data from 4 mics. and send it to the PC ?"

Yup, exactly... through in the future ill probably play around with its many other features ;)

Would could also check the phase of the signal to determine witch arive first. My 2 cent

wouldn't be easier to do this with a multichannel audio card? It's quite computational and bandwidth heavy. Not only the serial port is terribly slow, but maybe you introduce too much delays between the channels, and it would make it difficult to increase the accuracy of your project.

“wouldn’t be easier to do this with a multichannel audio card?”

The main problem with this is budget: Im currently not willing to spend that much… Also, I have a feeling there would be a lot of pain involved in receiving data from a commercial audio card.

what happened with this project? I've been interested in doing something similar and I'm curious about your final solution.

guys I'm working on a simple audio beacon project It's based on a jeenode but I can write an arduino conversion.