Skip to content

Playing a 50 ms AudioFrame takes less time than expected #182

@microbit-carlos

Description

@microbit-carlos

Using the latest version (at the time of writing) of the recording & playback branch: 0b06914
Hex: https://github.com/microbit-foundation/micropython-microbit-v2/actions/runs/8416237764?pr=163

Playing a 50 ms AudioFrame takes less time than expected:

>>> audioframe_50_ms = audio.AudioFrame(duration=50)
>>> audioframe_50_ms[-1] = 255
>>> ms_start = microbit.running_time(); audio.play(audioframe_50_ms); ms_end = microbit.running_time();
>>> ms_end - ms_start
42
>>> # Should be more than 50ms
>>> len(audioframe_50_ms) * 1000 / 7812
53.25141

Using time.ticks_ms() instead:

>>> from time import ticks_ms
>>> ms_start = ticks_ms(); audio.play(audioframe_50_ms); ms_end = ticks_ms()
>>> ms_end - ms_start
44

Metadata

Metadata

Labels

bugSomething isn't working

Type

No type

Projects

No projects

Relationships

None yet

Development

No branches or pull requests

Issue actions