Closed microbit-carlos closed 1 year ago
The code here is correct, but the current implementation of StreamRecording
simply collects upto REC_MAX_BUFFERS
in an array, rather than dynamically tracking blocks until it hits a specific memory limit.
I'll be updating this shortly so that rather than a buffer limit, we use a soft memory limit.
As a note to myself:
REC_MAX_BUFFERS
should be replaced with a suitable CODAL_*
config varAh, thanks John! I mistakenly thought it allocated buffers until there wasn't more memory available.
Master now includes the changes to use a linked list of buffers, rather than a static array of buffers, so should be able to adjust to different packet sizes for different sample rates, fixing this issue.
Pending further testing, this should now be fixed.
I've tested this with the latest commit 02a85fa86a00ac204cbd2a4caacd5a964e1cf26e, and reducing the sampling rate in the example doesn't increase the recording time. Going from 11_000 to 1_100 decreases the sound quality but still has around 5 seconds of audio.
I wasn't using "dev": true
in the codal.json
file, so I wasn't using the latest commits from codal-core.
With the latest I can confirm this now works 🎉
Both these hex files record sound until the memory is full, one configured at 5.5K and the other at 11K, but the both only record less than 5 seconds of audio. 5500.hex.zip 11000.hex.zip
It's possible I'm not configuring the pipeline correctly, is this code correct?