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

Implement microphone.sound_level_db() method. #221

Merged
merged 2 commits into from
Sep 16, 2024

Conversation

dpgeorge
Copy link
Collaborator

@dpgeorge dpgeorge commented Sep 9, 2024

This returns a floating-point number in dB.

Addresses issue #170.

@dpgeorge
Copy link
Collaborator Author

dpgeorge commented Sep 9, 2024

Note that microphone.sound_level() returns an integer, whereas I think a float is more appropriate for the return value of microphone.sound_level_db().

Also, do we maybe need to add microphone.set_threshold_db()?

@microbit-carlos
Copy link
Contributor

Thanks Damien!

Note that microphone.sound_level() returns an integer, whereas I think a float is more appropriate for the return value of microphone.sound_level_db().

Sounds good 👍

Also, do we maybe need to add microphone.set_threshold_db()?

Probably not at this stage, so far when people have asked for this feature they haven't mentioned the high/low thresholds.
We can wait until users ask set_threshold_db() and implement it at that point.

Copy link
Contributor

@microbit-carlos microbit-carlos left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Tested and works great, thanks Damien!

@dpgeorge dpgeorge merged commit e876dca into master Sep 16, 2024
6 checks passed
@dpgeorge dpgeorge deleted the microphone-sound-level-db branch September 16, 2024 00:48
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.

2 participants