pxt-microbit
pxt-microbit copied to clipboard
Recommendation: Use `uBit.audio` internally instead of instantiating own microphone and sound level
Specifically in the libs/microphone/microphonehw.cpp and libs/microphone/microphone.cpp files, an instance of microphone and LevelDetector is created and completely managed by MakeCode.
While this might have been needed early during development, uBit.audio was introduced before the V2 release and it provides control over the full audio pipeline.
Specifically with extensions like the recording and playback, that do use uBit.audio, it is not recommended at all to have separate instances of microphone and ADC, which can lead to conflicts and unexpected behaviour.
This is specially important as we update and add bug fixes in CODAL that might not work on MakeCode or might need updates in both places.