microsoft / pxt-microbit

A Blocks / JavaScript code editor for the micro:bit built on Microsoft MakeCode
https://makecode.microbit.org
Other
721 stars 593 forks source link

recording extension: on loud/quiet events not triggering #5133

Closed microbit-carlos closed 1 year ago

microbit-carlos commented 1 year ago

Describe the bug It looks like the extension deactivates the microphone and the loud/quiet events are not triggered when the micro:bit is idle and there is a loud sound.

To Reproduce Steps to reproduce the behavior:

  1. https://makecode.microbit.org/beta
  2. Load the recording extension
  3. Add the following programme
  4. Download the programme to the micro:bit and make a loud noise
image
input.onButtonPressed(Button.A, function () {
    record.startRecording()
})
input.onSound(DetectedSound.Loud, function () {
    basic.showIcon(IconNames.Heart)
})
input.onButtonPressed(Button.B, function () {
    record.playAudio()
})
input.onSound(DetectedSound.Quiet, function () {
    basic.showIcon(IconNames.SmallHeart)
})

Expected behavior To make a loud noise and see the large heart on the display.

Screenshots Already added

micro:bit version (please complete the following information):

V2.00

Desktop (please complete the following information): N/A

Smartphone (please complete the following information): N/A

Additional context

makecode.microbit.org version: 5.1.26 Microsoft MakeCode version: 8.6.33 microbit runtime version: v2.2.0-rc6 codal-microbit-v2 runtime version: v0.2.50

srietkerk commented 1 year ago

This is not because of the extension, but rather the recent CODAL updates in general. If you do a simple program like the following in beta, you will have the same problem that you describe.

image

This seems to be a duplicate of this issue: https://github.com/microsoft/pxt-microbit/issues/5048

microbit-carlos commented 1 year ago

I think that's a different issue. That one can be triggered/untriggered by resetting the micro:bit a few times.

Doing this quick test also shows it's unrelated. If I add this block it restores the loud/quite events.

image

At this point, as soon a B is pressed, which executes [play audio clip], it stops the loud/quiet events from being triggered.

image