Slow audio? mp3/wav.
-
I finally got wav files to play in my code. However im running into a problem. The wav file is played ok but there is stuttering(kinda like when a computer freezes) the audio is really slowed down, and there is static. Has anyone had this problem?
-
I know this is a year old, but I've found the issue and it might be helpful for others with this issue.
If you're using the ESP8266Audio libraries with M5Core2 v0.1.4 or v0.1.5, and you're running "M5.begin()", you need to comment out "Spk.begin();" in "M5Core2.cpp" in your libraries. ie:
// Spk.begin();
And add this to your code:
M5.Axp.SetSpkEnable(true);
I don't really understand why this is causing the issue but I noticed v0.1.3 (which works fine) had the speaker initialisation function commented out.
A year late in my reply, but better late than never! -
Hello!
The cause of the problem is probably that the I2S configuration in the "Audio.h" directory is overwritten.
When the object is created, the constructor function is executed, which sets up the I2S peripheral:
////////////////////////////// AUDIO ////////////// // // /////////////////////
Audio audio;
////////////////////////////////////////////////// ///////////////////////////////////Then the "Setup" function of the Arduino environment is run, in which the following is called:
////////////////////////////////////////////////// /// //////////////////////////
void setup() {
M5.begin();
..............
////////////////////////////////////////////////// ///////////////////////////////////Which again performs an I2S configuration that overwrites the previous settings.
The solution is to prevent this override by defining the function parameters and disabling the speaker:
////////////////////////////////////////////////// /// //////////////////////////
void setup() {
M5.begin(true, true, true, true, kMBusModeOutput, false);
..............
////////////////////////////////////////////////// ///////////////////////////////////The last parameter is the speaker, which is thus disabled.