Skip to content

audio.stop() and microphone.stop_recording() don't work #180

@microbit-carlos

Description

@microbit-carlos

Tested with v2.1.2 and the lates recording&playback branch.

audio.stop doesn't work in this example:

from microbit import *

while True:
    if button_a.is_pressed():
        audio.play(Sound.HAPPY, wait=False)
        # We can see here that the image is shown as soon as the sound starts playing
        display.show(Image.HAPPY)
        # But the sound plays to completion
        audio.stop()
        sleep(200)
    sleep(100)
    display.clear()

Simpler example in REPL (the next prompt >>> appears before the sound naturally ends playing):

>>> audio.play(Sound.HAPPY, wait=False); audio.stop()
>>> audio.play(Sound.HAPPY, wait=False); sleep(10); audio.stop()
>>> 

Replacing the play call with audio.play(audio.SoundEffect(duration=3000), wait=False) doesn't work either.

Metadata

Metadata

Assignees

Labels

bugSomething isn't working

Type

No type

Projects

No projects

Relationships

None yet

Development

No branches or pull requests

Issue actions