samirkumardas/pcm-player

Player plays a little faster than a true audio source

surfskidude opened this issue · 2 comments

Hey, your player is very cool. I connected it to an audio source, sampling data at 20Khz on an ESP32. The problem is that I get these glitches in the sound as the player is a little ahead of the true audio source. I have verified this by popping up an alert in the browser at startup, thus making it possible to collect some data. The sound is then perfect for a while. Not that you can run this, but I have attached my script designed for the ESP32.
pcmplayer.txt

Did you try decreasing flushingTime to smaller e.g. 500?

I tried your suggestion and it did not work. I also tried setting it to zero. However, after analyzing the sound, I noticed that it has a higher pitch in the browser compared to real life. Therefore, I adjusted the PCMPlayer's sampling rate to 3000 less than the actual sampling rate, and now it seems to be working correctly.