The file below labeled “good” was recorded by my Uno at 38,500 samples per second. As you can hear, the music itself is clear, but has some random pops and skips.
Deciding the problem was likely that 38,500 samples were too fast for the SD Card to keep up with, I cut that in half, down to about 18,000 samples per second, and am still happy with the quality for voice.
However, now there is a new problem. The file below labeled “bad” has a motorboat sound that is making my voice “gurgle”. (Terrible). And I’ve tried everything I can think of, yet can’t solve it.
Listening to the wires to the SD Card, I find their signal is the “motorboat”. But the SD Card didn’t “motorboat” at all in the “good” sample, so why now?
Another change is that the “good” sample was made when I had more free memory, the buffers were buffA and buffB. Now as you can see, they are buffA and buffB. But I don’t see a way that could cause “motorboating” or make voice gurgle.
As a test, I have in the below sketch, dispensed with using the buffers (buffA & buffB) and send each byte of audio directly to the SD Card from within the interrupt function. I didn’t expect that to work, thinking I couldn’t call an interrupt from within an interrupt, but it actually sounds a little better than using the buffers! (Slightly less motorboating). It was with this sketch I made the “bad” file, also below.
The sketch probably doesn’t make much sense to you, being a part of a larger project that connects three Arduino Uno’s. But I’m hoping you’ve seen/heard the gurgling problem before, and can easily point out the error of my ways.
DM_Waves.ino (8.02 KB)