Skip to content
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

Draft
wants to merge 1 commit into
base: v2-docs
Choose a base branch
from

Conversation

@@ -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).
Copy link
Member

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.

Copy link
Collaborator Author

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?

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

Copy link
Collaborator Author

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?

Copy link
Collaborator Author

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?

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

None yet

3 participants