-
Notifications
You must be signed in to change notification settings - Fork 52
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
Feature: Turn microphone off when not in use #97
Comments
I have also experienced this issue with MakeCode. |
This is something I have experienced. I've got a program that uses the microphone in one case, but the user can move to other functions that don't use it and the microphone LED stays on all the time. It actually defeats the purpose of the LED if it comes on when people are not being recorded. |
People are likely going to want to log sound levels as part of data logging and the mic LED being permanently on will be a drain on battery power. @finneyj This seems like a good feature to fold into the next round of work on the sound APIs if it will benefit data logging too. |
Fully agree. We just need a policy for what "not in use" means. We need to remember that the only way to turn off the LED is to turn off the microphone entirely - at which point it will likely take a little while to turn back on again and produce an accurate result. Choosing that period of time is therefore important. Also, for applications using streamed data, the microphone should stay enabled until they disconnect from the input stream. So as a start point, a policy might look a bit like
|
Is it possible to have a way to manually turn off the microphone? For me the issue was that querying the volume automatically powered the mic but there was then no way for me to turn it off. |
For sure - manual API is totally fine. You can do this in CODAL simply via:
I don't think that's surfaced in the higher level languages though. For kids it's probably a good idea to auto disable after the microphone goes unused for a period of time though - just to lower their barrier to entry. I don't these things are mutually exclusive though - we can do both. Would that cause a problem for you if you also had the manual function @ukBaz? |
I think that is the root of my problem.
I don't think it would be a problem. My only concern would be as you said "it will likely take a little while to turn back on again and produce an accurate result" so if it turns off too quickly...
I would have thought the current setup is the lowest barrier to entry. If you care about turning off then you are probably at a level to be able to use a manual off. So if I was to express a preference, my vote would be that the auto-off is unnecessary but I can see the pros and cons of both approaches. Thanks for your discussion on this matter. Very much appreciated. |
Yes, we'll need to measure and account for any power on delay... that should be abstracted out in a call to read the current volume I think. (i.e. if that call resulted in the device being powered on, it should wait until it's ready before returning a result). Just having an explicit call to disable the microphone could be an option - one for us to discuss with the MakeCode and micropython teams I think. Also @JoshuaAHill has been kindly looking to clean up the audio input pipeline and standardize it's use a bit across platforms. Perhaps we could squeeze this feature request into his upcoming PR. |
@JohnVidler has this been implemented already in the upcoming release? |
Released with v0.2.37 🎉 |
When the microphone is used as part of a program, the LED is lit to signify that it is listening and it remains on for that program.
It may be the case that someone wants to only use the microphone in part of a script. In this Python example, I am only using the microphone functionality when button A is pressed. When it is not pressed, I would expect the microphone to be disabled and as such the LED to turn off.
The text was updated successfully, but these errors were encountered: