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

Cosmic Unicorn: White noise when playing audio and accessing the REPL #1002

Open
bmustill-rose opened this issue Sep 24, 2024 · 3 comments
Open
Labels
bug Something isn't working

Comments

@bmustill-rose
Copy link

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:

  1. Flash this https://github.com/pimoroni/pimoroni-pico/blob/main/micropython/examples/cosmic_unicorn/audio/simple_playback.py example and supporting files.
  2. Reboot the device.
  3. Audio plays as expected.
  4. Access the REPL.
  5. Control + c if required.
  6. Control + d to reboot the device.
  7. White noise is played and the board freezes / REPL becomes unresponsive.
@Gadgetoid
Copy link
Member

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: micropython/micropython#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.

@Gadgetoid
Copy link
Member

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.

@Gadgetoid Gadgetoid added the bug Something isn't working label Sep 24, 2024
@bmustill-rose
Copy link
Author

That appears to be working well and will do for now as you say. Thanks.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug Something isn't working
Projects
None yet
Development

No branches or pull requests

2 participants