Thursday, September 22, 2022

🪲 Interface to the Web Audio API (beep, sound)

 A strange bug I noticed tonight, which started I don't know when.

In trying to figure out what recent change to BASIC Anywhere Machine caused the problem, I dug out an older version of BASIC Anywhere Machine that had no issues with audio, and I discovered the problem there, too.

The strange problem: the first sound played in a program via either BEEP or sound does not happen.

And subsequent sounds will only happen if the first failed sound played for at least half a second, the BEEP/SOUND statement immediately followed by a _DELAY of at least half a second to seemingly give Web Audio a chance to kick in.

Something like that.

This may only be an issue on my Chromebook and a recent update to either Chrome or Chrome OS.

As a workaround to the problem, I've setup the interpreter to not run any BASIC program until after a half-second delay, during which the interpreter "initialises" web audio.

Something like that.  Not easy to coherently explain what is going on when I can't make heads of tails of it.


So audio in BAM fixed for my device.  Now I have to find a way to see if other devices are fine.

No comments:

Post a Comment

🖥 Fan Dance

This is a port and mod of a SpecBAS program by ZXDunny. Run the program View the source code And, a "less is more?" version: Run t...