I am trying to make a basic VoIP implementation and I am stuck obtaining sound samples from the mic and playing the read data on a computer. I tried to sample the voice from the microphone and send it to the serial terminal using a very minimal code:
void setup() {
Serial.begin(9600);
}
void loop() {
int sensorValue = analogRead(A0);
Serial.println(sensorValue);
delayMicroseconds(122);
}
The delayMicroseconds(122)
causes the sample rate to be around 8192 Hz. I also tried with a sample rate of 1000 Hz. The data plot obtained looks good, however, when I try to play it with the MATLAB command
sound(csvread('samples.csv'), 8192);
I do not really hear what it should be (I just hear random noise). I am attaching a graph of the obtained data and my microphone circuit. (I also tried subtracting the average from the array so the values are centered around zero, but no use).
Data Obtained:
Microphone Circuit: