Skip to content

AudioFrame.copyfrom() should move the internal used_size marker #190

@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

>>> a = microphone.record(100)
>>> b = audio.AudioFrame(100)
>>> b.copyfrom(a)
>>> # This plays a short audio
>>> audio.play(a)
>>> # This does not
>>> audio.play(b)
>>> # And the  sound data is there
>>> for i in range(len(a)):
...     assert a[i] == b[i]
... 
>>> 

If we manually edit the last byte in b it then does play a short clip:

>>> b[len(b) - 1] = 255
>>> audio.play(b)
>>> 

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