Arduino Uno - How to store data for voice recording into SD ?

Hello everyone,
I would like your suggestion on a project I am working on. I already purchased a microphone break out board with max output +5V, combined it with a 2nd order sallen key topology sallen key filter and I am using the ADC of arduino to convert the analog into digital, my question is : in what kind of form should I store the data into a SD card module I have?
Storing the data in a form of array or .txt file in general will it be ok?

Thank you in advance,


Probably the format should suit whatever is going to use the data subsequently. From the Arduino's point of view, it doesn't care what format you choose.

Thank you!
So there will not be any trouble reading the data , to play back the recorded audio?

So there will not be any trouble reading the data , to play back the recorded audio?

I have no idea. What is going to read the data and play back the recorded audio?

some kind of shiled with the arduino uno.

I suggest you figure that part of it out then, before you work out how you're going to get the data to it and what format it requires.

There are many questions you need to ask. What is the desired bit resolution of the audio and the samples per second that you plan to record?

Sounds like you know this already if you’re talking about using an ADC, but for the sake of it… Remember that a Mic gives you AC voltage. Sound pushes the diaphragm back and forth which generates very small negative and positive voltages. In order to read those on an analog pin on an Arduino, you need to level shift the signal so that negative voltage is read as 0, null voltage is read as 512, and full positive voltage is read as 1023. If you don’t do that, you won’t capture the audio properly. You’ll only get half the waveform and it won’t sound right.

The analog input pins on an Arduino will only give you a range of 0-1023 which is a 10-bit number. You would need to 2 bytes to store each sample. If you only need 8-bit audio, you could map the 10-bit number to an 8-bit number and only store a single byte per sample.

Now for the samples per second… 8kHz is 8000 samples per second. So if you were recording 8-bit audio, 1 second of audio would be 8000 bytes. If you are doing 10-bit audio, that would be 16,000 bytes for 1 second of audio!

As for file format… the most common would be a .wav file. A .wav file is basically just a header describing how may channels of audio, the sample rate, etc, followed by the raw stream of samples. You can find documentation explaining how to create .wav files on the Internet. The added bonus here is if you do it right, you can test your recordings on a computer to verify you are actually capturing the audio correctly.

As for playback… there are lots of different ways to about this. I’d look at using an SPI DAC (digital to analog converter) chip. Since you’re already reading the .wav file back in via SPI, why not output the raw samples to the DAC?

You could of course pulse digital I/O pins with an added circuit to approximate the sound on a speaker, or you could try using the analog pins and level shift the voltage. In either case, you’ll likely need an amplifier.

Thanks for response and your time to answer!
So far I am using a breakout board with a microphone and an amplifier on it (SparkFun Electret Microphone Breakout - BOB-12758 - SparkFun Electronics)
I already took care about the ADC shifting to avoid negative voltages, fortunatelly I have learnt how to use it.
Due to the lack of pins I will purchase an Arduino Mega 2560 and 2 DAC breakout boards (Breakout Board for MCP4725 I2C DAC)
of course later on the DAC will be connected with an amplifier and speakers.My next few steps will be investigating how to store data into a .wav format and not into a .txt

Thanks again for your response, it really helped me!

hi , i would like to ask you few querries bcz i am doing the same project

  1. how you have used the Microphone amplifier board used for recoding voice samples

  2. why you have used shallen key filter

can you give a proper information

Take a read thru this topic, where 16-bit audio is being recorded to SD card at CD-audio rate (44.1KHz, mono).

Thanks for your great response

I need you suggetion it would help me a lot ( i am new to electronic stuff)

So as you siad SpakfunElectret Microphone Amplifier board connected to AD7680 16 bit ADC IC then ADC connected to Analog pin of Arduino board ( correct me if i am wrong)

I have been stuck doing this project from 2 months

I have the recording set up ( APC's April issue is on sale now! | TechRadar )

i have tried to feed the voice signals using condenser microphone with basic amplification using LM386 op amp (to A0 analog port of arduino mega ) it didnt work well

what can i do with this collabrating volunteers and all ?