Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

There is noise after playing music #476

Open
gianglongtbe opened this issue Jan 3, 2022 · 3 comments
Open

There is noise after playing music #476

gianglongtbe opened this issue Jan 3, 2022 · 3 comments

Comments

@gianglongtbe
Copy link

gianglongtbe commented Jan 3, 2022

I used the example but got noise after finishing can you tell me how to fix it?

I use esp8266 esp-12f.

`#include <Arduino.h>

#include "AudioFileSourcePROGMEM.h"
#include "AudioGeneratorWAV.h"
#include "AudioOutputI2SNoDAC.h"

// VIOLA sample taken from https://ccrma.stanford.edu/~jos/pasp/Sound_Examples.html
#include "viola.h"

AudioGeneratorWAV *wav;
AudioFileSourcePROGMEM *file;
AudioOutputI2SNoDAC *out;

void setup()
{
Serial.begin(115200);
delay(1000);
Serial.printf("WAV start\n");

audioLogger = &Serial;
file = new AudioFileSourcePROGMEM( viola, sizeof(viola) );
out = new AudioOutputI2SNoDAC();
wav = new AudioGeneratorWAV();
wav->begin(file, out);
}

void loop()
{
if (wav->isRunning()) {
if (!wav->loop()) wav->stop();
} else {
Serial.printf("WAV done\n");
delay(1000);
}
}`

music.mp4
@gianglongtbe
Copy link
Author

E67BB34F-01A7-4AA3-BDFB-B5085BEA72E5

Why does noise appear after every music playback ends

@gianglongtbe
Copy link
Author

I have looked at the entries but there is no improvement. Could it be the software causing the noise?

@softhack007
Copy link
Contributor

softhack007 commented Jan 7, 2022

Hmmm 🤔 reminds me of this discussion : #271

Maybe a call to output->flush() should be added in the audioGenerator class, just before output->stop(). As a quick test, you could try this in your scetch:

  if (!wav->loop()) {
     out->flush();
     wav->stop();
  }
} else {

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants