Arduino library to play MOD, WAV, FLAC, MIDI, RTTTL, MP3, and AAC files on I2S DACs or with a software emulated delta-sigma DAC on the ESP8266 and ESP32
GNU General Public License v3.0
1.99k
stars
433
forks
source link
There is always a noise from the speakers at the end of the sound #580
I did a simple loop playback test, including the startup in setup(), a total of 6 times, each time when the sound ends, there is always an electromagnetic noise from the speaker, and when the 6th playback ends, it also There will be. Not sure how to get rid of it.
I did a simple loop playback test, including the startup in setup(), a total of 6 times, each time when the sound ends, there is always an electromagnetic noise from the speaker, and when the 6th playback ends, it also There will be. Not sure how to get rid of it.
include
include "SPIFFS.h"
include "AudioFileSourceSPIFFS.h"
include "AudioOutputI2S.h"
include "AudioOutputMixer.h"
include "AudioGeneratorWAV.h"
AudioGeneratorWAV wav[2]; AudioFileSourceSPIFFS file[2]; AudioOutputI2S out; AudioOutputMixer mixer; AudioOutputMixerStub *stub[2]; static int looptime;
void setup() { Serial.begin(115200); SPIFFS.begin(); delay(500); file[0] = new AudioFileSourceSPIFFS("/soundn.wav"); out = new AudioOutputI2S(); out->SetOutputModeMono(true); out->SetPinout(15, 13, 2); out->stop(); mixer = new AudioOutputMixer(32, out); stub[0] = mixer->NewInput(); stub[0]->SetGain(0.4); wav[0] = new AudioGeneratorWAV(); wav[0]->begin(file[0], stub[0]); Serial.printf("starting 1\n"); looptime =0; }
void loop() { static bool wav1end = true; if (wav[0]->isRunning()) { if (!wav[0]->loop()) { if (wav1end) { wav[0]->stop(); stub[0]->stop(); // delete wav[0]; // delete stub[0]; // delay(50); file[0] = new AudioFileSourceSPIFFS("/E233_CP_in.wav"); // stub[0] = mixer->NewInput(); // stub[0]->SetGain(0.4); wav[0] = new AudioGeneratorWAV(); wav[0]->begin(file[0], stub[0]); Serial.printf("continue 1\n"); looptime++; if (looptime>=5){ wav1end = false; looptime = 0; }
}
} }