-
Notifications
You must be signed in to change notification settings - Fork 25
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
AudioFrame playback chunk and the simulator #195
Comments
@dpgeorge are you able to provide some guidance here? |
@dpgeorge this is currently the only thing blocking putting audio/record in the simulator for beta so we'd appreciate a view on this - especially if it needs a design change as we iterate the audio stuff anyway to make sure it works. (I'm thinking about our conversation about how a contiguous memoryview is more natural and efficient compared to a generator of smaller buffers) |
I think I have a way forward here to allow for a minimum |
I have pushed some commits to the #define AUDIO_OUTPUT_BUFFER_SIZE (256) // this can be any value, defaults to 32 bytes That will be the number of bytes that are sent at a time down to the lower layers of the audio pipeline (eg to the simulator). @microbit-matt-hillsdon see if that works! |
Thank you, this is way better for playback of recordings and improves the situation for traditional audio frame use. Updated here: Needs some testing on slower hardware but I think this is more an asyncify/event loop tick resolution issue than a performance one so I'm optimistic. I used the smallest viable buffer (64) because of an issue with wait=True. As I understand it, we stop waiting when we've finished sending the audio to play not when it's finished playing. Initially we had a sim-only issue where we'd overlap audio if there was a subsequent play after a wait=True play but we've fixed that. So the remaining issue is that control is arguably returned to the user program early. These issues are somewhat noticeable in the "Audio" sample on the sim demo page. It might still be possible to overlap different types of audio by the two buffers time - e.g. I think we could start playing speech while still processing the last two raw audio buffers. I'm not sure these issues have a straightforward fix and they might be acceptable. There's one more thing I wanted to check: If you ever play an AudioFrame then we now seem to play silence after it indefinitely. Is that an intentional change? We don't think this happened before the MicroPython update and maybe happened in this latest change. I'm dropping the silent frames in the C-side of the HAL at the moment. |
Great! I'm glad it works.
Oops, that's a mistake on my side. Now fixed, see the most recent commit on the
This is a bug on the MicroPython side that we will try to resolve. See #182 (comment), and related #206 |
Looks good now that I've updated the sim to 17aaa11 (same demo links as above). Thanks. |
Looks good now that I've updated the sim to ... Very good! Thanks for confirming. I think we can probably close this issue now. |
From @microbit-matt-hillsdon in #163 (comment), broken out here to be able to keep discussions on their own thread:
The text was updated successfully, but these errors were encountered: