microbit-foundation / micropython-microbit-v2

Temporary home for MicroPython for micro:bit v2 as we stablise it before pushing upstream
MIT License
44 stars 25 forks source link

Add option to get Sound Level in decibels (dB) #170

Closed microbit-carlos closed 2 weeks ago

microbit-carlos commented 6 months ago

CODAL has the option choose between 8-bit and dB for the LevelDetector. We had a couple of requests and it's already built in CODAL, so it'd be good to have it in the next beta.

API Options:

dpgeorge commented 6 months ago

My preference would be microphone.sound_level_db(). It's simple. And it makes it very clear what the units are.

microbit-carlos commented 6 months ago

Agreed:

dpgeorge commented 3 weeks ago

See #221 for an implementation.

dpgeorge commented 2 weeks ago

Implemented in e876dcac96d597fb35f7541f752c2ea34dcae854