Skip to content

Microphone level maxes out at ~191 on hardware #4381

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

Open
microbit-mark opened this issue Sep 23, 2021 · 5 comments · May be fixed by #6194
Open

Microphone level maxes out at ~191 on hardware #4381

microbit-mark opened this issue Sep 23, 2021 · 5 comments · May be fixed by #6194

Comments

@microbit-mark
Copy link
Contributor

Writing the value of sound level to serial, the loudest sound level returned seems to be between 191-195. The returned level should be up to 255

image

https://makecode.microbit.org/_LMvK17UKMaeA

Does not reproduce in MicroPython, so I assume this is MakeCode related, not CODAL.

@microbit-mark
Copy link
Contributor Author

@abchatra can you take a look at this one and try and reproduce?

@abchatra
Copy link
Collaborator

abchatra commented Dec 5, 2021

Does this not reproduce in python when writing to serial? Does this reproduce if we don't write to serial but just displayed on the screen?

I will take a look.

@jaustin
Copy link
Collaborator

jaustin commented Jan 30, 2024

@microbit-carlos do you think this is still an issue?

@microbit-carlos
Copy link
Collaborator

This was fixed in CODAL in:

As part of that MakeCode should have been updated to use uBit.audio.levelSPL->setUnit(LEVEL_DETECTOR_SPL_8BIT) as described in lancaster-university/codal-microbit-v2#225 (comment), which I think it might not have been implemented yet:
https://github.com/microsoft/pxt-microbit/blob/v6.1.8/libs/microphone/microphone.cpp

@microbit-carlos
Copy link
Collaborator

@riknoll updating microphone to use the uBit object was already partially done in b3a0130 and the only thing left would be to :

  • On init, set the sound level output type via uBit.audio.levelSPL->setUnit(LEVEL_DETECTOR_SPL_8BIT)
  • setSoundThreshold() would call uBit.audio.levelSPL->setLowThreshold() or setHighThreshold() directly with the user input value
  • soundLevel() would just return uBit.audio.levelSPL->getValue()

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment