Why are my .wav files blank?

Hello all! I am in the middle of making a voice recorder and I am using some test code before I integrate the code into a larger project. All I want to do with this test code is record something using my MAX 9814 microphone and save it onto my micro SD card. So far my project will only record blank audio files onto my SD card. The recording lengths are the correct size but they have no content, only static. Am i using the wrong SD card? is my mic broken? thanks for all the help!

<----------------------------------------------------------------------------------------------------->

#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
#define microphone_pin A0
TMRpcm audio; // create an object for use in this sketch

void setup() {

pinMode(12,OUTPUT); //Pin pairs: 9,10 Mega: 5-2,6-7,11-12,46-45

Serial.begin(9600);

if (!SD.begin(SD_ChipSelectPin)) {
Serial.println("sd faild");
return;
}else{
Serial.println("SD OK");
}
// The audio library needs to know which CS pin to use for recording
audio.CSPin = SD_ChipSelectPin;
}

void loop() {

if(Serial.available()){                          //Send commands over serial to play
  switch(Serial.read()){
    
    case 'r': audio.startRecording("test.wav",16000,microphone_pin); Serial.println("recording start"); break;    //Record at 16khz sample rate on pin A0
  
    case 's': audio.stopRecording("test.wav"); Serial.println("recording stopped"); break;              //Stop recording
  }
}

}

Please post a link to the microphone module, and a hand drawn wiring diagram, with pins and components clearly labeled.

Have you been able to obtain useful signals of any sort from the microphone module? If not, that is a required first step.

The "recording" feature of the TMRpcm library is supposedly under development, and is not guaranteed to work. Can you post a link to a working example? I've never seen or heard of one. Note that the SDFat library is recommended, not SD.

1 Like

Here are the sources of my inspiration.

here is the picture of the wiring diagrams used but I am not applying any gain to my microphone.

1 Like

Why not? What microphone? Does it even work?

Please do not post Fritzing diagrams, and especially, someone else's Fritzing diagrams, since they do not necessarily apply to your project.

Very few people on this forum will watch a video, in order to figure out what you did.

My Apologies, I am very new to this.

image

Here is the microphone I am using and I am not sure that it works. The microphone has auto gain control that defaults to 60db so I figured that would work.

In just about any modular project, make sure that all the components function individually, before trying to put them together. Adafruit sensors tend to be of good quality, but you simply can't expect a new item to work every time, out of the box.

Most Arduino libraries come with test code that can be used to verify correct operation of sensors, SD cards, etc.

Given that the TMRpcm library cautions that the "record" option is still being developed and may not even work, how do you plan to test that?

This topic was automatically closed 180 days after the last reply. New replies are no longer allowed.