Vote count:
0
I am trying to record sounds from the microphone when there's something happening (be it somebody talking or just moving things around - basically anything that isn't just random noise)
Up until now, my approach has been to record for 1-2 seconds, check if the recording passes the test for "anything happening", if so, I could record for as long as the new 1-2 second recordings didn't pass the test.
Now my problem here is the test. What I am doing now is basically setting a threshold, so it basically looks like this:
for(uint32_t i = 0; i < SAMPLE_RATE * NUM_SECONDS; i++) {
if(buffer[i] > threshold)
return true;
}
return false;
All was working nice and sound until I've tested the application on a laptop with a very weak microphone. The problem is that on a decent built in microphone, the "loudness" (or more like, sample value) of background noise (nothing happening, basically) equals to ~130, and when you speak, depending on how far you are from the microphone, the values go up to 160-135 (close-far). But there is a difference, and you can cross the threshold.
The thing is, that with the weak microphone the values don't seem to change. It stays at 130 (Althrough it might be moving by one point now and then).
Now, my guess would be that I lack precision. But I'm recording in 16 bits. Is it even possible to record in more than 16 bits? (for example, floats or doubles) You can hear the weak microphone user when he's talking on skype, for example, so I pretty much think that it's a precision issue (weak microphone has a hard time detecting sounds, so I suppose that the default noise value is 130, and it goes up to something like 130.2 when somebody's talking)
Any suggestions?
Recording audio - too low loudness differences
Aucun commentaire:
Enregistrer un commentaire