docs: Add microphone.sound_level_db() function.#803
docs: Add microphone.sound_level_db() function.#803microbit-carlos wants to merge 1 commit intobbcmicrobit:v2-docsfrom
microphone.sound_level_db() function.#803Conversation
docs/microphone.rst
Outdated
|
|
||
| .. py:function:: sound_level_db() | ||
|
|
||
| * **return**: a representation of the sound pressure level in decibels (dB). |
There was a problem hiding this comment.
Maybe it's worth specifying the range of dB values that will be returned? That could be useful to know how loud/quite sounds it can respond to, and also to perform some scaling on the number to make it suitable, eg, for plotting to the display.
There was a problem hiding this comment.
@JohnVidler do you know what the min and max value for LevelDetectorSPL are for dB?
There was a problem hiding this comment.
35-100dB, by default, although they are defined in LEVEL_DETECTOR_SPL_8BIT_000_POINT and LEVEL_DETECTOR_SPL_8BIT_255_POINT if you want to future proof against wider ranges on future devices
There was a problem hiding this comment.
I thought those were used only to calculate the 8-bit conversion. Are the min and max values from LevelDetectorSPL::getValue(LEVEL_DETECTOR_SPL_DB) also clamped to those?
There was a problem hiding this comment.
A quick test printing uBit.audio.levelSPL->getValue(LEVEL_DETECTOR_SPL_DB) shows we can get values over 100. @JohnVidler could you check what are the theoretical min and max?
There was a problem hiding this comment.
e0f97f6 to
9e9ea1c
Compare
62ea073 to
905577a
Compare
9e9ea1c to
7519134
Compare
7519134 to
477c214
Compare
https://microbit-micropython--803.org.readthedocs.build/en/803/microphone.html#microbit.microphone.sound_level_db