-
Notifications
You must be signed in to change notification settings - Fork 287
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
docs: Add microphone.sound_level_db()
function.
#803
base: v2-docs
Are you sure you want to change the base?
docs: Add microphone.sound_level_db()
function.
#803
Conversation
docs/microphone.rst
Outdated
@@ -70,6 +70,9 @@ Functions | |||
* **return**: a representation of the sound pressure level in the range 0 to | |||
255. | |||
|
|||
.. py:function:: sound_level_db() | |||
|
|||
* **return**: a representation of the sound pressure level in decibels (dB). |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
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.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
@JohnVidler do you know what the min and max value for LevelDetectorSPL are for dB?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
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.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
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.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
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.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
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