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

The value of LEVEL_DETECTOR_SPL_8BIT_000_POINT (32) will never be reached #449

Open
microbit-carlos opened this issue Sep 17, 2024 · 2 comments · May be fixed by lancaster-university/codal-core#174
Assignees
Milestone

Comments

@microbit-carlos
Copy link
Collaborator

microbit-carlos commented Sep 17, 2024

Because the LevelDetectorSPL minVal is set to 52:

levelSPL = new LevelDetectorSPL(*rawSplitter->createChannel(), 85.0, 65.0, 16.0, 52.0, DEVICE_ID_SYSTEM_LEVEL_DETECTOR, false);

And LevelDetectorSPL will clamp the lower end of the level value to minVal:
https://github.com/lancaster-university/codal-core/blob/509086cc8590465041b15493ab52b56e7071c110/source/streams/LevelDetectorSPL.cpp#L142-L147

@microbit-carlos
Copy link
Collaborator Author

@microbit-carlos
Copy link
Collaborator Author

microbit-carlos commented Sep 17, 2024

Previous discussion:

When LEVEL_DETECTOR_SPL_8BIT_000_POINT was introduced it was set to 35.0, but the default value for LevelDetectorSPL.minVal was already set to 52.0, so with the default values LevelDetectorSPL.getLevel() would have never return a value below 52 dB:

However, at that time, the uBit.audio.levelSPL constructor in codal-microbit-v2 was setting minVal to 0, it was only changed to 52.0 a year later, so until then uBit.audio.levelSPL->getValue() could return values lower than 52.0, and that explains why earlier measurements could detect 35-40ish dB:
02a85fa

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 a pull request may close this issue.

2 participants