So I have an ESP32 set up with i2s audio and a Max98357 I2S 3W Class D Amplifier. When I try to play audio from it, sometimes it works, sometimes it doesn’t.
Sometimes I have to run the audio 3 to 4 times before it works, then if I run audio one after another seems to be stable.
However the issue seems to be when time goes by. I might run it once or twice before it works. If I continue to play something it tends to keep working, but if I stop sending audio for 5 to 10 minutes, then I have to send 2 to 3 audios before it starts working again. Almost as if it falls asleep.
Any ideas on how to fix?
Would probably get more appropriate eyeballs if you move this to the ESPHome category (I’m assuming that’s what you used to flash the ESP).
Sounds like a connection issue with your ESP? Logs for the device while this happens would help folks (including yourself) troubleshoot and narrow things down.
That being said, I used an ESPHome device as a media player in the past. While it ‘worked’ for my needs at the time, it was always a bit wonky. Some audio files wouldn’t play and it wasn’t uncommon for it to either garble audio or simply cut out.
Thank you, I did also ask on the ESPHome discord.
logs don’t really show much. It is part of an automation, when I run just that part of the automation manually I always get the “action ran successfully” but I don’t always get the audio. It is Text to speech with google translate.
I never get garble nor does it cut out. It either plays as it should or it doesn’t play at all. Even looked at the ESP logs, and same thing, it shows as everything ran fine even if it didn’t.
The ESP also runs mmWave sensor. Did some testing, and took out the mmwave and still got it to skip a couple of times. I then took out the captive portal, and I haven’t seen it skip an audio yet. At the moment I have the mmwave running again alongside the i2s without the captive portal, and seems to be working
Yeah, that’s resource intensive and was probably your issue.
Thanks for the feedback, although it is counterintuitive. I would have assumed that captive portal would only use up resources if it couldn’t connect to a wifi network, but it seems that is not the case