Skip to content

micro:bit freezes when playing music.play([None]) #139

Closed
@microbit-carlos

Description

@microbit-carlos
Contributor

Duplicating the issue here as it affect V2 as well:

The program

from microbit import *
import music

music.play([None])

hangs the microbit

Activity

added this to the 2.1.1 milestone on Oct 24, 2022
dpgeorge

dpgeorge commented on Oct 24, 2022

@dpgeorge
Collaborator

Using None in a tune was intended to be a "rest", ie no sound for a period. But this was never documented and instead "r" and "R" are supported and documented characters for inserting a "rest".

Using None as a rest is actually broken, as seen by the above example (you can still use ctrl-C to stop it, but the rest goes for a very long time).

I suggest we just completely remove support for None in tunes. It never worked and was never documented. That will then fix this issue.

microbit-carlos

microbit-carlos commented on Oct 25, 2022

@microbit-carlos
ContributorAuthor

Thanks Damien! I wasn't aware of the None rest either, sounds good 👍
Just for curiosity, do we know that it was always broken, or has it been broken from a specific point in time?

dpgeorge

dpgeorge commented on Oct 28, 2022

@dpgeorge
Collaborator

Just for curiosity, do we know that it was always broken, or has it been broken from a specific point in time?

As far as I can tell, this "rest" feature was broken since commit (on micro:bit v1) 0189136af557bc2c8514935f7351bcaafe32c47f done in Nov 2015, which first allowed music to be played in the background. So I think it's safe to assume this feature was never used.

dpgeorge

dpgeorge commented on Oct 28, 2022

@dpgeorge
Collaborator

Fixed by d2130d8 (support for None as a rest is removed).

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

No one assigned

    Labels

    bugSomething isn't working

    Type

    No type

    Projects

    No projects

    Relationships

    None yet

      Development

      No branches or pull requests

        Participants

        @dpgeorge@microbit-carlos

        Issue actions

          micro:bit freezes when playing `music.play([None])` · Issue #139 · microbit-foundation/micropython-microbit-v2