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

Under some conditions, an audio MP3 source feeding a mixer does not return from loop() till the track ends. #717

Open
EternityForest opened this issue Oct 15, 2024 · 0 comments

Comments

@EternityForest
Copy link

This could be user error as it is showing up in a rather large and complicated codebase, but I thought I would write it up anyway in case it's useful.

it seems that loop() can get stuck for the duration of a track under high CPU load, with a LittleFS>mp3>mixer>I2S chain.

I notice that the stub calls the mixers loop() for every sample, which may have something do do with it. With that extra call, the amount of data processed per loop depends on the relative speeds of the generator and the sink, making it a bit less predictable.

I don't really see why this would be an actual problem, it seems like it should still return pretty fast on each call, but perhaps there is some subtle blocking effect in the final i2s API, even though it's supposed to be non-blocking?

Right now I'm working around it by using a modified copy of the library omitting that extra loop() call, and increasing the DMA buffer in the I2S driver, along with adding an ignoreStop option to stubs, so I can reuse them between generators to get sample perfect loops.

https://github.com/EternityForest/ArduinoCogs/blob/main/src/esp8266audio_vendored/AudioOutputMixer.cpp

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

1 participant