microsoft / pxt-microbit

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

onSound triggers constantly if playing melody on the speaker #3777

Closed microbit-mark closed 1 year ago

microbit-mark commented 4 years ago

Describe the bug A clear and concise description of what the bug is.

This program triggers the sound playback constantly

image

Setting a higher threshold resolves this

image

But set threshold is not a kid-friendly block for a first time user of the microphone and it's hidden away in Input > more

Could we change the default threshold so it does not trigger so easily.

Some sub-optimal possibilities:

...or we could have a mic on/off block ... or lower the volume of the melody when using the mic blocks ... or move the set threshold block into the main V2 blocks

pelikhan commented 4 years ago

We should auto turn off the microphone when I paging a sound


From: Mark notifications@github.com Sent: Friday, November 27, 2020 4:53:45 PM To: microsoft/pxt-microbit pxt-microbit@noreply.github.com Cc: Subscribed subscribed@noreply.github.com Subject: [microsoft/pxt-microbit] onSound triggers constantly if playing melody on the spseaker (#3777)

Describe the bug A clear and concise description of what the bug is.

This program triggers the sound playback constantly

[image]https://nam06.safelinks.protection.outlook.com/?url=https%3A%2F%2Fuser-images.githubusercontent.com%2F31242877%2F100466052-34102d80-30c8-11eb-85b9-f0bba1c2c64e.png&data=04%7C01%7Cjhalleux%40microsoft.com%7C1043f4b13b5b413dc74208d892ec9fe2%7C72f988bf86f141af91ab2d7cd011db47%7C1%7C0%7C637420892331142767%7CUnknown%7CTWFpbGZsb3d8eyJWIjoiMC4wLjAwMDAiLCJQIjoiV2luMzIiLCJBTiI6Ik1haWwiLCJXVCI6Mn0%3D%7C1000&sdata=L2lE9lOcXAI6JvwnJ2QvDv7GoP6s0whl%2BYI%2FC%2Br3QpY%3D&reserved=0

Setting a higher threshold resolves this [image]https://nam06.safelinks.protection.outlook.com/?url=https%3A%2F%2Fuser-images.githubusercontent.com%2F31242877%2F100466130-543fec80-30c8-11eb-8849-73fa02864563.png&data=04%7C01%7Cjhalleux%40microsoft.com%7C1043f4b13b5b413dc74208d892ec9fe2%7C72f988bf86f141af91ab2d7cd011db47%7C1%7C0%7C637420892331142767%7CUnknown%7CTWFpbGZsb3d8eyJWIjoiMC4wLjAwMDAiLCJQIjoiV2luMzIiLCJBTiI6Ik1haWwiLCJXVCI6Mn0%3D%7C1000&sdata=HMe6uRcXti4d2ovlMMcWwR9CG3lg6Ga4%2BuPUQAdtn7A%3D&reserved=0

But set threshold is not a kid-friendly block for first using the microphone and it's hidden away in Input > more

Could we change the default threshold so it does not trigger so easily.

...or we could have a mic on/off block ... or lower the volume of the melody

— You are receiving this because you are subscribed to this thread. Reply to this email directly, view it on GitHubhttps://nam06.safelinks.protection.outlook.com/?url=https%3A%2F%2Fgithub.com%2Fmicrosoft%2Fpxt-microbit%2Fissues%2F3777&data=04%7C01%7Cjhalleux%40microsoft.com%7C1043f4b13b5b413dc74208d892ec9fe2%7C72f988bf86f141af91ab2d7cd011db47%7C1%7C0%7C637420892331152720%7CUnknown%7CTWFpbGZsb3d8eyJWIjoiMC4wLjAwMDAiLCJQIjoiV2luMzIiLCJBTiI6Ik1haWwiLCJXVCI6Mn0%3D%7C1000&sdata=%2B9laMTCZdSO1m5rDRN0Hg1%2BWCnnu2MB0vT1g%2Fqag5Qg%3D&reserved=0, or unsubscribehttps://nam06.safelinks.protection.outlook.com/?url=https%3A%2F%2Fgithub.com%2Fnotifications%2Funsubscribe-auth%2FAA73QKO67UE6ZAD35BMTY3LSR7DQTANCNFSM4UFB7INA&data=04%7C01%7Cjhalleux%40microsoft.com%7C1043f4b13b5b413dc74208d892ec9fe2%7C72f988bf86f141af91ab2d7cd011db47%7C1%7C0%7C637420892331152720%7CUnknown%7CTWFpbGZsb3d8eyJWIjoiMC4wLjAwMDAiLCJQIjoiV2luMzIiLCJBTiI6Ik1haWwiLCJXVCI6Mn0%3D%7C1000&sdata=7NdxgGJA4Bv40c4uBtbZsuuq5vwhebNNL9RGYN489p8%3D&reserved=0.

jaustin commented 4 years ago

@finneyj is there an easy way just to ignore mic events during sound playing? I would rather not actually turn off the microphone

finneyj commented 4 years ago

Sounds like a "learning opportunity" about feedback loops.. :)

We could suppress the generation of events, for sure... but I think there's a problem here around making too many assumptions... Kids won't expect the microphone to be enabled/disabled without them knowing.

There could be use cases where disabling the mic events could break kids code. e.g. clap to stop sound? Music playing in a game, and a clap to activate a game activity? etc...

Alternative options:

pelikhan commented 4 years ago

A microphone mute block would match perfectly what they already use in Zoom/Teams/… every day.

From: Joe Finney notifications@github.com Reply-To: microsoft/pxt-microbit reply@reply.github.com Date: Friday, November 27, 2020 at 5:54 PM To: microsoft/pxt-microbit pxt-microbit@noreply.github.com Cc: Peli de Halleux jhalleux@microsoft.com, Comment comment@noreply.github.com Subject: Re: [microsoft/pxt-microbit] onSound triggers constantly if playing melody on the speaker (#3777)

Sounds like a "learning opportunity" about feedback loops.. :)

We could suppress the generation of events, for sure... but I think there's a problem here around making too many assumptions... Kids won't expect the microphone to be enabled/disabled without them knowing.

There could be use cases where disabling the mic events could break kids code. e.g. clap to stop sound? Music playing in a game, and a clap to activate a game activity? etc...

Alternative options:

— You are receiving this because you commented. Reply to this email directly, view it on GitHubhttps://nam06.safelinks.protection.outlook.com/?url=https%3A%2F%2Fgithub.com%2Fmicrosoft%2Fpxt-microbit%2Fissues%2F3777%23issuecomment-734919818&data=04%7C01%7Cjhalleux%40microsoft.com%7Cc10d6e1546d043daf71908d892f51b96%7C72f988bf86f141af91ab2d7cd011db47%7C1%7C0%7C637420928707118522%7CUnknown%7CTWFpbGZsb3d8eyJWIjoiMC4wLjAwMDAiLCJQIjoiV2luMzIiLCJBTiI6Ik1haWwiLCJXVCI6Mn0%3D%7C1000&sdata=RJwpfXLpKVurVGU1ZZ5FgUYuh55l5PbcXt3YGHiLpSg%3D&reserved=0, or unsubscribehttps://nam06.safelinks.protection.outlook.com/?url=https%3A%2F%2Fgithub.com%2Fnotifications%2Funsubscribe-auth%2FAA73QKOYIJBMBCFKU66CPTTSR7KULANCNFSM4UFB7INA&data=04%7C01%7Cjhalleux%40microsoft.com%7Cc10d6e1546d043daf71908d892f51b96%7C72f988bf86f141af91ab2d7cd011db47%7C1%7C0%7C637420928707118522%7CUnknown%7CTWFpbGZsb3d8eyJWIjoiMC4wLjAwMDAiLCJQIjoiV2luMzIiLCJBTiI6Ik1haWwiLCJXVCI6Mn0%3D%7C1000&sdata=pt43YLVdUJJZk%2FbRatHrPrdsblaPjCyl1Wle7yL6DZk%3D&reserved=0.

finneyj commented 4 years ago

yep - mute would work.

jaustin commented 1 year ago

Right, Joe and John implemented a function in CODAL to enable this. CODAL now has an 'is sound playing'

https://github.com/lancaster-university/codal-microbit-v2/commit/cc02e7a54b9332cccca2a2af98eb10621c52e693

This is very specifically to allow users to mute the mic/ignore the mic when sound is playing from the micro:bit.

We should expose this as a block to users!

So then the question is should we still have a 'microphone mute' block as well or should we add a new sensitivity level to the microphone (set microphone sensitivity should be coming to 'input as part of #4493

@finneyj there were also events for 'sound started' and 'silence started' - did you think we'd expose these too?

jaustin commented 1 year ago

@abchatra this one is still a good issue and we now have the stuff we need in CODAL to address it. It becomes more relevant/prevalent with the audio record/playback stuff

abchatra commented 1 year ago

Request is to add a block "sound playing" so users don't trigger additional things.

jaustin commented 1 year ago

@abchatra any more thoughts on adding this?

abchatra commented 1 year ago

I had already marked it for release. Someone will pick it up during bug fixing phase.

jaustin commented 1 year ago

Great, and sorry, was looking for a 'next release' label, not the milestones. Oops. (looks like that was what we used last year!)

abchatra commented 1 year ago

@srietkerk can you take this up? Basically we need to expose a new block "sound is playing" in Music category under Volume subcategory. Whenever a sound is playing this should return 1 other wise 0.

srietkerk commented 1 year ago

Yep, sounds good!