0

I am using a Sparkfun Electret Microphone with Arduino Pro-Mini to stream audio over serial port. The goal is to create a wav file from the audio data.

The wav file header requires "sampling frequency" as one of the entries in the header. Here are my questions:

  1. How can I check what is the current audio frequency of the analogReads from the microphone on my arduino
  2. How can I configure/change some settings in my arduino pro mini to get a sampling rate of 16 kHz (that's what one of my applications that will consume the WAV file requires)
Darth.Vader
  • 5,079
  • 7
  • 50
  • 90

1 Answers1

0

Well, sampling frequency is all about timing.

1) use micros() statements to check the timing of the analog read operations

2) the best way to get a consistent sampling rate is by using interrupts. Specifically, a "timer interrupt". You will have to make sure that the hardware can actually sample fast enough to keep up with the audio requirements.

mhopeng
  • 1,063
  • 1
  • 7
  • 17