Open bmustill-rose opened 1 month ago
This is somewhat a known-issue for which I have made an upstream fix to MicroPython, but it wont take effect in downstream code until the next MicroPython point release: https://github.com/micropython/micropython/pull/15585
It's somewhat possible to workaround this by using a try / catch / finally
block around the i2s audio to explicitly call deinit
but it shouldn't be necessary.
In the short term I think this should work:
from audio import WavPlayer
sound = WavPlayer(0, 10, 11, 9, amp_enable=22)
sound.play_wav("beepboop.wav", False)
try:
while sound.is_playing():
pass
finally:
sound.__stop_i2s()
Will treat this issue as a bug, however, and leave it open until this is actually fixed.
That appears to be working well and will do for now as you say. Thanks.
Tested with "MicroPython v1.23.0, cosmic_unicorn v1.23.0-1 on 2024-06-06; Raspberry Pi Pico W" - unfortunately I don't have any other appropriate boards to test with.
Steps: