Closed microbit-carlos closed 1 year ago
Thank you for finding this! I will work on getting the simulator to reflect the correct hardware behavior.
I want to follow-up with a possible hardware bug that I found. As I was experimenting to better understand this issue, I ran into some weirdness on the micro:bit. If you have a program like the following, the bar graph for the sound level without the recording doesn't behave correctly if you fire the A button pressed
program first.
Steps
For control
It looks like the recording extension continues to have control over the microphone. I figured this might be a problem with how the extension explicitly asks to enable and disable the mic currently: https://github.com/microsoft/pxt-microbit/blob/db3677a9319fbff9bfc81d6141cc36acf6b99015/libs/audio-recording/recording.cpp#L75. However, I deleted the enableMic
and disableMic
code in my testing and rebuilt the target, and nothing changed. I otherwise don't see an obvious spot within the recording extension itself that could be causing this problem. I suspect this problem is arising because the sound level
blocks aren't using the ubit object that was pointed out here https://github.com/microsoft/pxt-microbit/issues/5002. Are there any other places I should look to help solve this problem?
Is this problem replicable in C++ code using the uBit
object?
If it's not and it's caused by MakeCode instantiating its own level detector, then this might be a good opportunity to update that code to use the uBit
object, as that is the recommended way to use that feature. Even if we find an easy workaround now for having a separate levelSPL, other future changes to the sound pipeline could still conflict with having that external instance.
@JohnVidler do you have any other pointers?
Simulator still shows microphone recording if the you press B after couple of seconds in the following program
The microphone LED might is only meant to be ON while the device is recording.
✅ In the simulator this works correctly with a programme like this. When the audio recording is finished the microphone light turns off:
❌ However, when using the
[plot bar graph]
block the microphone LED stays turned on after the recording is done. This screenshot was taken after the recording finished, as the[clear screen]
block has taken place and display is clear:Maybe this is because the simulator widget to change the light level stays loaded on the simulator, but this is a deviation from the real behaviour on the device, as on the micro:bit the microphone LED goes off as expected.