Hello there!
My idea goes like this: I want to try to record the sound from a microphone (like my voice), to an SD card. I guess I can't expect record it at a sampling rate higher than 8 KHz (due to the timing of the functions). The audio will be stored in a "raw file" (because I don't know how to create the WAVE/RIFF header automatically); and maybe playback that recording with the same board (but that's the "stage two" of my plan). Now here are my questions:
Shall I need amplification for the microphone's signal, or changing the reference voltage will also help?
Can an analog input pin handle negative parts of a waveform? I think even a schottky diode will completely kill the input signal.
Since the recorded samples must be unsigned 8 bit, which of the following is faster? Map the value or shift two bits?
Would you mind suggest me a way to automatically stop recording? I guess suddenly stop writing to a file without closing it is a bad idea.
Thanks beforehand and sorry if I made misspellings.
Is that like mixing 2.5V with my audio signal?
If so, can I just put both in the same pin, or do I need some additional components? (Apart from a voltage divider)
Almost all "computer microphones" are electret condenser types and they require 5V power (normally supplied by the soundcard).
[u]Here is an example[/u] of an electret microphone preamp circuit with power for the mic and biased output.
Is that like mixing 2.5V with my audio signal?
Yes. The Arduino can't read negative voltages, so and AC audio signal must be biased. (You can subtract-out the bias in software if you wish.) [u]Hre is an example[/u] of a bias circuit.
All right, thank you very much!
Is not that hard to do this, but now I'm worried about two things:
analogRead function is so slow by default (and still not yet tested its "fast mode")
I don't know how long takes writting a byte to a file in a SD card. Will the technique discussed in this thread work too?
I don't know how long takes writting a byte to a file in a SD card.
No and you will not find out because it is not fixed. It depends on the type of SD card, where abouts on the card it is and its age. Plus a lot more factors.
Will the technique discussed in this thread work too?
Yes it will work.
Another technique is to put a pin high, do the code and put it low, using port manipulation. Then measure the width of the pulse on an oscilloscope.
Will the "port manipulation" execute almost instantly?
Yes.
Will a cheapy one work too?
No that one is way too slow. It will only work at 1M samples per second. You have a 16MHz processor so to actually measure anything approaching accurately you need it 100 times better than this.
Grumpy_Mike:
No that one is way too slow. It will only work at 1M samples per second. You have a 16MHz processor so to actually measure anything approaching accurately you need it 100 times better than this.
Oh well, I don't wanna spend a lot of money on this, so the micros timer is my only way I think.
By the way, the MP3 module can be useful for this purpose, but I just wanna use the Arduino itself if possible. But, because the MCU hasn't enough memory for record sounds, then the cheapest way to get more space, is by interacting with a SD card (in any form factor). However, thanks anyways...
Take a read thru here http://forum.arduino.cc/index.php?topic=180769.0
I designed this card for the project, got hung up on integrating the ADC & DAC into it, but left myself some room to play some more when I had some time. You can see that fat16lib had the code working to record mono audio to SD card at CD quality speed/data (16 bit data, 44.1 KHz) http://www.crossroadsfencing.com/BobuinoRev17/
I've read it. Is that the code for that board of yours?
I designed this card for the project, got hung up on integrating the ADC & DAC into it, but left myself some room to play some more when I had some time. You can see that fat16lib had the code working to record mono audio to SD card at CD quality speed/data (16 bit data, 44.1 KHz) Cross Roads Electronics
Is that like "all-I-need-in-one" board? Yeah, it looks promising, but... I'm trying to keep up with the simple stuff.
By the way, how you can achieve a higher sampling rate? Because of the SRAM or the ADC?