Arduino recording .wav files ?

Hello everyone,
I am bit stuck, how can I make my arduino record into .wav files?
The arduino is connected with a microphone,amplifier(reaching 0-5V) and im using the ADC of Arduino.
Any ideas? Will I be able to play them back using my pc?

Thank you in advance,

Napster

I would like to avoid using any shields!

Well, my library will do it Advanced Features · TMRh20/TMRpcm Wiki · GitHub and yup you can play them from a PC also. You can also easily generate your own wav files using wav templates.

I am also nearing completion on a live audio recording/streaming library using wireless/radio RF24 modules. No ETA, but soon.

Advanced Features · TMRh20/TMRpcm Wiki · GitHub is useful , thanks for sharing this links :slight_smile:

and im using the ADC of Arduino

That only yields 10-bit digital.
.wav like you hear from a CD is 16 bit digital.
So the sound quality might not be what you are used to.

Cassette tapes recorded professionally aren't much better. Someone's mix tape is probably never better than a good 8 bit recording. So you have to consider what you are trying to do.

If you are trying to record an orchestra, you'll want a lot better than the Arduino's ADC can give you. If it is just a voice, it should be good. Just make sure you have a low-pass filter with cutoff of about 1/3 the capture frequency. Nyquist, blah blah... That says that you should have -no- spectral content 1/2 of the capture frequency or higher. And a low-pass filter is not a brick wall, it has a slope. So the corner frequency of the filter must be quite a bit lower than 1/2 the capture frequency.

Hey, can i record .wav file using just an arduino microphone connected to Arduino UNO :grin:
let's say i would like to record for3 min, is that possible. Also do i have to connect an SD card to my Arduino
any help would be appreciated
thx in advance
laaaaaaaaaaroussi salah XD

You can record with ADC, 10-bit sound quality will be low (like a telephone), and you need to save to SD Card, there is not enough SRAM on arduino to store sound there.
I don't know about digitizing with Arduino and sending to Pi for storage as it is digitized, I suppose that could be made to work if the Pi could save it fast enough.

Thank you Cross Roads for replying.
Another question can i use this module
http://www.google.tn/imgres?imgurl=http%3A%2F%2Fi01.i.aliimg.com%2Fwsphoto%2Fv0%2F1321905001%2FWholesale-Retail-New-Electronic-Brick-Sound-font-b-Sensor-b-font-Microphone-font-b-Mic-b.jpg&imgrefurl=http%3A%2F%2Fwww.aliexpress.com%2Fmic-sensor_price.html&h=1000&w=1000&tbnid=oBW2nNxlLX7mkM%3A&zoom=1&docid=zqgUktArd3V8ZM&ei=ajiPU52iI4aQ4gSZtYEw&tbm=isch&ved=0CIoBEDMoWTBZ&iact=rc&uact=3&dur=2&page=6&start=75&ndsp=16
with my arduino uno to do the job

also i got this which have an amplifier http://www.google.tn/imgres?imgurl=http%3A%2F%2Fwww.adafruit.com%2Fadablog%2Fwp-content%2Fuploads%2F2012%2F10%2Fwindow-2-102.jpg&imgrefurl=http%3A%2F%2Fwww.adafruit.com%2Fblog%2F2012%2F10%2F10%2Fnew-product-electret-microphone-amplifier-max4466-with-adjustable-gain%2F&h=450&w=600&tbnid=uUuItKmiH6mG9M%3A&zoom=1&docid=Dfcn6IdoCw6neM&ei=ajiPU52iI4aQ4gSZtYEw&tbm=isch&ved=0CGsQMyg6MDo&iact=rc&uact=3&dur=495&page=4&start=45&ndsp=16

There are ways to get around the ATmega's 10-bit ADC resolution limit but consider 10-bits as a good resolution.
As someone wrote the compact cassette is only about 70db or 9-bits of digital resolution.

You need to utilize the entire 10-bits resolution by using a compressor.

And the biggest hurdle is the 2K SRAM.
That is not going to store any useful length of a sound.

You need some external memory attached to the Arduino.
Either SPI or lots of wires of parallel SRAM chip.

But it's doable.

hi everyone

I don't know but how can i get it, i mean recording wav file. how if i use this library GitHub - TMRh20/TMRpcm: Arduino library for asynchronous playback of PCM/WAV files direct from SD card. Arduino Uno,Nano,Mega etc supported the Recording.ino file say :This sketch demonstrates recording of standard WAV files that can be played on any device that supports WAVs. The recording
uses a single ended input from any of the analog input pins. Uses AVCC (5V) reference currently.
Requirements:
Class 4 or 6 SD Card
Audio Input Device (Microphone, etc)
Arduino Uno,Nano, Mega, etc.
that mean that with a microphone let's say this one http://www.google.tn/imgres?imgurl=http%3A%2F%2Fwww.adafruit.com%2Fadablog%2Fwp-content%2Fuploads%2F2012%2F10%2Fwindow-2-102.jpg&imgrefurl=http%3A%2F%2Fwww.adafruit.com%2Fblog%2F2012%2F10%2F10%2Fnew-product-electret-microphone-amplifier-max4466-with-adjustable-gain%2F&h=450&w=600&tbnid=uUuItKmiH6mG9M%3A&zoom=1&docid=Dfcn6IdoCw6neM&ei=ajiPU52iI4aQ4gSZtYEw&tbm=isch&ved=0CGsQMyg6MDo&iact=rc&uact=3&dur=495&page=4&start=45&ndsp=16 which has an amplifier i can use it for the purpose

microphone--> analog signal amplification--> to the arduino uno anlaog input-->Arduino (which contain the library above)--> storage to an SD card connected via SPI.

Need some help plz this is urgent
:~ :blush:

This is the sketch from the library, from file: Recording.ino

/*
This sketch demonstrates recording of standard WAV files that can be played on any device that supports WAVs. The recording
uses a single ended input from any of the analog input pins. Uses AVCC (5V) reference currently.

Requirements:
Class 4 or 6 SD Card
Audio Input Device (Microphone, etc)
Arduino Uno,Nano, Mega, etc.

Steps:

  1. Edit pcmConfig.h
    a: On Uno or non-mega boards, #define buffSize 128. May need to increase.
    b: Uncomment #define ENABLE_RECORDING and #define BLOCK_COUNT 10000UL

  2. Usage is as below. See Advanced Features · TMRh20/TMRpcm Wiki · GitHub for
    additional informaiton.

Notes: Recording will not work in Multi Mode.
Performance is very dependant on SD write speed, and memory used.
Better performance may be seen using the SdFat library. See included example for usage.
Running the Arduino from a battery or filtered power supply will reduce noise.
*/

#include <SD.h>
#include <SPI.h>
#include <TMRpcm.h>

#define SD_ChipSelectPin 53 //example uses hardware SS pin 53 on Mega2560
//#define SD_ChipSelectPin 4 //using digital pin 4 on arduino nano 328, can use other pins

TMRpcm audio; // create an object for use in this sketch

void setup() {

audio.speakerPin = 11; //5,6,11 or 46 on Mega, 9 on Uno, Nano, etc
pinMode(12,OUTPUT); //Pin pairs: 9,10 Mega: 5-2,6-7,11-12,46-45

Serial.begin(115200);

if (!SD.begin(SD_ChipSelectPin)) {
return;
}else{
Serial.println("SD OK");
}

}

void loop() {

if(Serial.available()){ //Send commands over serial to play
switch(Serial.read()){
case 'r': audio.startRecording("test.wav",16000,A0); break; //Record at 16khz sample rate on pin A0
case 'R': audio.startRecording("test.wav",16000,A0,1); break; //Record, but with passthrough to speaker.
case 't': audio.startRecording("test.wav",16000,A0,2); break; //Do not record. Output direct to speaker
//Note: If samples are dropped before writing, it
// will not be heard in passthrough mode
case 's': audio.stopRecording("test.wav"); break; //Stop recording
case 'p': audio.play("test.wav"); break; //Play the recording
case '=': audio.volume(1); break; //Increase volume by 1. Does not affect recording
case '-': audio.volume(0); break; //Decrease volume by 1. Does not affect recording
case 'S': audio.stopPlayback(); break; //Stop all playback

}
}
}