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

Set LEVEL_DETECTOR_SPL_8BIT_000_POINT to 52.0 dB. #174

Open
wants to merge 1 commit into
base: master
Choose a base branch
from

Conversation

microbit-carlos
Copy link
Contributor

@microbit-carlos microbit-carlos commented Sep 17, 2024

This is the value currently used by MakeCode:
https://github.com/microsoft/pxt-microbit/blob/v7.1.3/libs/microphone/microphone.cpp#L8

And MicroPython:
https://github.com/microbit-foundation/micropython-microbit-v2/blob/v2.1.2/src/codal_app/codal.json#L16

The reason to change it is that the LevelDetectorSPL() minValue default parameter is already 52:

LevelDetectorSPL(DataSource &source, float highThreshold, float lowThreshold, float gain,
float minValue = 52,
uint16_t id = DEVICE_ID_SYSTEM_LEVEL_DETECTOR_SPL,
bool activateImmediately = true);

MicroBitAudio also sets it to the same value 52.0:
https://github.com/lancaster-university/codal-microbit-v2/blob/v0.2.68/source/MicroBitAudio.cpp#L82

And LevelDetectorSPL will clamp as that being the min.

if (conv < minValue)
level = minValue;
else if (isfinite(conv))
level = conv;
else
level = minValue;

Fixes lancaster-university/codal-microbit-v2#449.

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.

The value of LEVEL_DETECTOR_SPL_8BIT_000_POINT (32) will never be reached
1 participant