Skip to content

Recording with a low rate doesn't work #201

Open
@microbit-carlos

Description

@microbit-carlos

Tested with the latest version of the recording & playback branch: c91ae4e

When the recording rate is set below 143 the recording function returns immediately without filling the AudioFrame.

>>> af = audio.AudioFrame()
>>> bytes(af)    # Default value is 0x80
b'\x80\x80\x80\x80\x80\x80\x80\x80\x80\x80\x80\x80\x80\x80\x80\x80\x80\x80\x80\x80\x80\x80\x80\x80\x80\x80\x80\x80\x80\x80\x80\x80'
>>> # Timing how long it takes to record at 142 samples per second
>>> t = running_time(); microphone.record_into(af, rate=142); running_time() - t
1
>>> bytes(af)    # AudioFrame data untouched
b'\x80\x80\x80\x80\x80\x80\x80\x80\x80\x80\x80\x80\x80\x80\x80\x80\x80\x80\x80\x80\x80\x80\x80\x80\x80\x80\x80\x80\x80\x80\x80\x80'
>>> t = running_time(); microphone.record_into(af, rate=143); running_time() - t
181
>>> bytes(af)
b'\x80\x81\x80\x7f\x80\x80\x80\x80\x80\x80\x81}~\x82}\x7f{\x81\x7f\x80\x81|\x81\x80\x7f|\x80\x84n\x8ey\x8a'
>>> 
>>> t = running_time(); af = microphone.record(100, 142); running_time() - t
1
>>> bytes(af)
b'\x80\x80\x80\x80\x80\x80\x80\x80\x80\x80\x80\x80\x80\x80\x80\x80\x80\x80\x80\x80\x80\x80\x80\x80\x80\x80\x80\x80\x80\x80\x80\x80'
>>> t = running_time(); af = microphone.record(100, 143); running_time() - t
178
>>> bytes(af)
b'\x80\x81\x86}\x7f\x80|\x7f~\x81|||~\x82\x7f\x7f\x80\x7fz\x80\x82\x82|\x80\x80{\x80}}\x81\x82'
>>> 

I guess this could be an issue in the CODAL layer, if that's the case let me know and I'll raise it in the codal-microbit-v2 repository.

Metadata

Metadata

Labels

CODALbugSomething isn't working

Type

No type

Projects

No projects

Relationships

None yet

Development

No branches or pull requests

Issue actions