Skip to content

Playing an empty AudioFrame never returns #223

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

Open
microbit-carlos opened this issue Sep 16, 2024 · 3 comments
Open

Playing an empty AudioFrame never returns #223

microbit-carlos opened this issue Sep 16, 2024 · 3 comments
Assignees
Labels
blocked bug Something isn't working CODAL
Milestone

Comments

@microbit-carlos
Copy link
Contributor

This in the REPL never returns until Ctrl+C is sent:

>>> audio.play(audio.AudioFrame())

But as soon as something else larger is played (like Sound.HAPPY) it does work until the next power cycle.

Might be related to increasing AUDIO_OUTPUT_BUFFER_SIZE to 64, as audio.play(audio.AudioTrack(bytearray(63))) doesn't return either, but audio.play(audio.AudioTrack(bytearray(64))) does.

@microbit-carlos microbit-carlos added this to the 2.2.0-beta.1 milestone Sep 16, 2024
@microbit-carlos microbit-carlos added the bug Something isn't working label Sep 16, 2024
@dpgeorge
Copy link
Collaborator

I can reproduce the problem. It looks like a CODAL issue and related to the recently fixed #182 which used uBit.audio.isPlaying() to check if audio is playing or not.

It seems that upon startup, CODAL reports that audio is playing:

int main() {
    uBit.init();
    uBit.audio.isPlaying(); // returns true!
    return 0;
}

I can work around this, but it should probably be fixed in CODAL.

@dpgeorge
Copy link
Collaborator

It seems that upon startup, CODAL reports that audio is playing

And this is reflected in MicroPython by doing audio.is_playing() after a reset, it returns True.

@dpgeorge
Copy link
Collaborator

On the audio-recording branch, I have fixed the issue with short audio not returning, by fixing a related issue where the last part of audio may not have been sent out the pipeline if it was shorter than 64 bytes.

But, the issue with audio.is_playing() returning True after a reset still remains.

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

No branches or pull requests

2 participants