EncodedAudioStream, WAVEncoder and setting a sampling rate #2188
-
Hi @pschatzmann. I was using EncodedAudioStream to write samples directly to WAV file and this worked fine, generating WAV files at 22.050KHz. A few days ago I refactor my project and now I´m using SD_MMC mode to SD access in order to use FLAC playing too. I noticed that now EncodedAudioStream not transfer sampling rate information to WAVEncoder and always WAV files (that I need to record at 22.05KHz) are recording to 44.1KHz (the default sampling of EncodedAudioStream constructor) Part of the skecth that worked fine was so below
Thanks in advance. |
Beta Was this translation helpful? Give feedback.
Replies: 8 comments 6 replies
-
I committed a correction! Setting the AudioInfo with setAudioInfo() was working as expected, only when calling begin(AudioInfo), the encoder was not set up correctly. This correction should correct the begin(AudioInfo). |
Beta Was this translation helpful? Give feedback.
-
Ok. I'm going to try again. |
Beta Was this translation helpful? Give feedback.
-
Hi @pschatzmann. I ensured that EncodedAudio.h was updated. Now, begin is as below.
I try again but not was success. This apply in my code at time to set the encoder. The file recorded at 44.1KHz. On the other hand a I read the setting after applied and, encoderOutWAV return me, 44100Hz (see below) my custom log.
the result
in the sketch I coded this.
Any idea? |
Beta Was this translation helpful? Give feedback.
-
Could you pass me the commit of this correction please? |
Beta Was this translation helpful? Give feedback.
-
No, I trying to use in my project, later I playing the WAV file with ESP32 and Windows audio player with the same result, accelerated audio and WAv file properties says me that WAV audio is a 44100Hz, stereo at 16 bits. I'm going to test with your sketch only in my AudioKit. |
Beta Was this translation helpful? Give feedback.
-
Hi. it seems that VSCode not updated correctly AudioTools. After full clean, recloning and compiled again all works fine. |
Beta Was this translation helpful? Give feedback.
-
About AudioSourceIdxSDMMC. Is possible to implement a function to forze regeneration of the index file without to have to remove index files? I write a funcion using your code is as below, included in SDIndex.h
|
Beta Was this translation helpful? Give feedback.
-
After update the FLAC playing is bad again. I achieved to play very fluid without breaks and I see that again the FLAC playing is not fine. |
Beta Was this translation helpful? Give feedback.
I tried to call audioInfo on the WAVEncoder but I was getting an compile error, which I corrected as well.
However, I can't reproduce your issue:
gives