Skip to content

memoryview of an AudioFrame returns signed 8-bit values #187

Closed
@microbit-carlos

Description

@microbit-carlos

Tested with v2.1.2 and the latest version (at the time of writing) of the recording & playback branch: 0b06914

>>> a = audio.AudioFrame()
>>> m = memoryview(a)
>>> a[0], m[0]
(128, -128)
>>> a[0] = 255
>>> a[0], m[0]
(255, -1)
>>> 

Compared with a bytes or bytearray object, where memory view values are 8-bit unsigned:

>>> b = bytes([128, 255])
>>> ba = bytearray([128, 255])
>>> m1 = memoryview(b)
>>> m2 = memoryview(ba)
>>> (b[1], m1[1]), (ba[1], m2[1])
((255, 255), (255, 255))
>>> 

Does AudioFrame change the values from unsigned to signed as a CODAL requirement?

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