Hi All,
i am trying to interface MAX9814 mic with ESP32 and converting mic input into .wav file and sending it to server. Please can anyone help me out on how to take mic input and convert it into wav file
I can't help with the actual code but maybe I can get you started.
Digital audio is simply a sequence of samples, each representing the amplitude (wave height) at one instant in time. You sample at a known sample rate (44.1KHz for CD quality audio). When the audio is played-back, the samples are read at the same sample rate and the DAC "connects the dots" to re-create the analog signal. The Audacity website has a nice introduction to digital audio.
Here is some information about the WAV file format. The main thing is the header which gives the sample rate, bit depth, etc., so it can be played-back properly.
I assume you have a complete microphone board... The 9814 is an amplifier chip, not a mic. If you have a board the output will be biased because they usually don't have a negative power supply and the Arduino can't directly read the negative half of the AC audio waveform. You'll have to subtract-out the bias before writing the WAV file (unless you are making 8-bit files which uses "biased" unsigned values).
...You should also be aware of the Nyquist limit which says the audio frequency can't be more than half of the sample rate. Practically speaking that means you should have a low-pass filter in-front of the analog-to-digital converter (between the 9814 and the Arduino). Every audio ADC & soundcard has this filter. Without it you can get aliasing (false frequencies).
But you can often get-away without the filter if you don't need high-quality because the higher frequencies are usually weak, making the alias frequencies weak.