ESP32-audioI2S icon indicating copy to clipboard operation
ESP32-audioI2S copied to clipboard

Mp3 with 48000Hz sampling rate playback failed, but 44100Hz is ok

Open eggfly opened this issue 3 years ago • 3 comments

As title mentioned. And besides why the ample rate was set to 16000?

https://github.com/schreibfaul1/ESP32-audioI2S/blob/6b9247673ce735015e1f88b13b3d3c7ee3b9b93b/src/Audio.cpp#L173-L174

eggfly avatar Jun 09 '22 10:06 eggfly

Let me double check it ..

eggfly avatar Jun 09 '22 12:06 eggfly

16KHz is just a default value, the actual sampling rate is set by the decoder.

schreibfaul1 avatar Jun 09 '22 15:06 schreibfaul1

This issue has been automatically marked as stale because it has not had recent activity. It will be closed if no further activity occurs. Thank you for your contributions.

stale[bot] avatar Aug 13 '22 10:08 stale[bot]

16KHz is just a default value, the actual sampling rate is set by the decoder.

@schreibfaul1 where can i find the decoder sample rates, if I want to play some wav files, which sample rates is 96kHz or 192kHz, does the project support? or do I have to change anything, Thanks

xfce avatar Nov 30 '22 09:11 xfce

Common sample rates are 44.1KHz or 48KHz. 192KHz would be four times that. I wonder if the ESP32 can do that. wav is an uncompressed audio format. The RIFF header is at the beginning of every wav file. The RIFF header looks like this: image The RIFF header is read in the routine read_WAV_Header() in audio.cpp

schreibfaul1 avatar Nov 30 '22 09:11 schreibfaul1

Common sample rates are 44.1KHz or 48KHz. 192KHz would be four times that. I wonder if the ESP32 can do that. wav is an uncompressed audio format. The RIFF header is at the beginning of every wav file. The RIFF header looks like this: image The RIFF header is read in the routine read_WAV_Header() in audio.cpp

@schreibfaul1 Thanks, Do you mean, if I use the codec-PCM5102A, when I play the wav file(for example sample rates is 192kHz, PCM, 1 channel, 16bit ), the read_WAV_Header() can get all the wav info, change the default 16k sample rates to 192k, etc, and play the wav file correctly?

xfce avatar Dec 13 '22 02:12 xfce

The audio files contain information on how to handle them, regardless of whether they are a4a, mp3, wav or flac. The playback of raw data (PAM, PCM) is not intended. Why should the wav header contain incorrect information that has to be changed afterwards? What you can do is play an audio file and halve the sample rate. This is like playing a vinyl record at half speed.

schreibfaul1 avatar Dec 13 '22 08:12 schreibfaul1

This issue has been automatically marked as stale because it has not had recent activity. It will be closed if no further activity occurs. Thank you for your contributions.

stale[bot] avatar Apr 14 '23 00:04 stale[bot]