I know this is surely a dumb sampling rate problem or something but i can't figure out which one...
I've never used TMRpcm and I didn't realize it has a recording function…
Is it 8-bit audio?
This is a WAV file, right? Not raw audio data?
And, there's no easy to check the audio data (other than listening)
So we would like to hear what's going on, by sharing to us the resulting audio file as it is.If you are going to attach it to your next post, keep in mind that the file limit is 1 MB; so don't try to upload a long recording. Also wav files aren't directly allowed here, but you can get around this by compressing it into a zip one.
Here is what Mediainfo tell me about my file: 16 KHZ, 128 Kbps, 8 bits, Unsigned PCM. On paper, a really normal file right?
Is there any reason to think it's the SD card that screwed the all thing up?
Yes. I don't think an AVR microcontroller is capable of stereo or 16-bit recordings with its built-in ADC
even the processing power is not enough for a decent sampling rate at this format.
Stereo is possible, but since there is one-shared ADC you can't sample left & right a exactly the same time.
At typical hifi sample rates this is unimportant as the time discrepancy corresponds to a few mm difference,most I2S DACs and ADCs sample L and R interleaved I think.
My last piece of experimental music:
Somewhere, I read about write-speed limits with SD cards but I don't think that's true. I've got a video recorder that records to an SD card.
The ADC is 10-bits, so you could write it into a 16-bit word, and then bit-shift to get full-volume.
Stereo is possible, but since there is one-shared ADC you can't sample left & right a exactly the same time. And, the ADC speed-limitation is also "shared" so you'd have to cut the sample rate in half.
I don't think "processing" is the limitation/bottleneck.
8-bit WAV files use unsigned integers, whereas everything else uses signed integers
P.S.You know... In theory recording is "easy", especially at 8-bits... You just read the data at a known sample rate and write it to a file. (With a 10-bit ADC you have to right-shift two bits before throwing-away the high-byte of a 16-bit integer.) The only tricky thing is writing the header, but that's not too bad if you're always writing the same format. And, you do have to go-back and write the data-chunk size when you stop recording.
...Playback is not so easy when you don't have a DAC.
And, it's more like a couple cm's at "Arduino sample clock rates".
The wandering about 00-FF suggests a small signed value, yet the main signal is clearly an unsignedsample waveform, yet the abrupt changes suggest simple buffering issues...
Perhaps there's some interaction with the analog input pin from something?
Or the adjustable gain is doing something odd (and has a DC offset)?
Are you talking about the buffer of the Atmega 328p?
I'm using only one analog pin. I tried to change, the 5 Analog pins are giving me this crapy music
I don't think so because with an other mic (KY-something) the result is the same.......
why does it happen with my specific circuit and components, and not with the other's?
What are you meaning by isolating the ground pins?