-
Notifications
You must be signed in to change notification settings - Fork 591
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
Play Sound block not reliably playing on hardware #4720
Comments
@JohnVidler this looks similar to the issue we saw on support that @microbit-pauline couldn't get to reproduce in /beta. @Jaqster I think this sample program gets munged because the link doesn't open in /beta - can I modify the URL to load it in /beta or can you please share the TypeScript? Does this need specific parameters in play sound? I've been using it a lot in programs and haven't seen this. However we did notice some interesting timing issues earlier this week that could be related. CC @microbit-carlos |
Can't you just go to https://makecode.microbit.org/beta then click the Import button to copy/paste this URL? |
Yes, thanks. Didn't know that route. I wonder if the issue here is the combo of 'old' music blocks and new, which I think gives us multiple mixer channels. |
@Jaqster querying the P2 label on this - seems more like a P1 or P0 to me. Is there a mitigation for this or does it only happen in a subset of situations? |
I've boiled this down to a minimal program with just a play sound block in a button event: It appears that if I set anything else, it works fine, but setting the interpolation to log results in the behaviour described here, so there's definitely something funky with the synth log generator. Will investigate further. |
Additional note - playing both audio routes (melody and sound) works just fine, provided that the sound generator isn't using log interpolation. |
So if this is limited to log interpolation, I'm happy with the P2 label too. |
After further investigation, it seems that the log effect generator results in extreme values at both ends of the scale. Super high values from an effect result in the board locking up, and negative values result in unpleasent clicks from the speaker. For now, as time is short for the 2022 Makecode release, I've implemented some hard stops for just this effect ( see https://github.com/lancaster-university/codal-microbit-v2/blob/master/source/SoundSynthesizerEffects.cpp#L102 ) which anyone wanting to test this can pull in right now, but ultimately this probably means we need to check the edge cases for each generator just in case. This does avoid the hard stop that @Jaqster originally reported, and works for testing on the next tag. I'm going to leave this open for now, however, but please demote its priority back down to P3 so we can track testing the other generators. |
@JohnVidler can you try the program attached here? #4733 It should stress out the sound generation. @jaustin . It locks almost instantly on hardware. It works without logarithmic. |
@pelikhan I'm unable to test this until we push the next tag and generate the beta PR, but I'll put that on my todo immediately after that happens. |
Pushed |
Fixed. |
Repro - I have a bunch of music sounds in a Button pressed event
When I download (through Web USB) to the micro:bit and press button A, I don't hear the second Play Sound block. Then when I press button A again, nothing plays.
I am on Windows, Edge, with a micro:bit V2.2
test project - https://makecode.microbit.org/_FA8hVFe49e9u
The text was updated successfully, but these errors were encountered: