Closed microbit-carlos closed 5 months ago
Tested with v2.1.2 and the latest version (at the time of writing) of the recording & playback branch: https://github.com/microbit-foundation/micropython-microbit-v2/commit/0b06914c71c18533da90df85230ac198578669bf
>>> 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?
@dpgeorge based on our conversation this is a bug that should be fixable without any (or minimal) effect on the current AudioFrame implementation.
Now fixed.
Tested with v2.1.2 and the latest version (at the time of writing) of the recording & playback branch: https://github.com/microbit-foundation/micropython-microbit-v2/commit/0b06914c71c18533da90df85230ac198578669bf
Compared with a bytes or bytearray object, where memory view values are 8-bit unsigned:
Does AudioFrame change the values from unsigned to signed as a CODAL requirement?