Bass Whistle in the Browser

April 19th, 2020
music, tech, whistling
Last summer I wrote some code that would let you control a bass synthesizer by whistling (details). I wrote it in a low-level language so I could minimize latency, but the downside is that it's a bit of a pain to install and try out. After playing around with the Web Audio API yesterday, however, I realized I could make a demo in JavaScript. Here it is: bass-whistle-js.

Currently this only works in Chrome, because Firefox and Safari haven't implemented AudioWorklet yet. It has enough latency to be painful, even though the AudioContext is running with minimum latency settings. I suspect this is Chrome layering several buffers, and comes from optimizing for something other than what I want (cross-platform, simplicity, minimizing dropouts, power consumption). Still, it's neat that this works at all!

Debugging my AudioWorklet port was painful, as browser debugging goes. Devtools doesn't understand the worklet very well, and so several syntax errors in the worklet were reported as syntax errors in the UI thread code (crbug.com/1073300). The devtools "disable cache" setting also doesn't seem to apply to worklet modules (crbug.com/1073297), and they don't even show up in the Network tab (crbug.com/1073295), so I put in a cachebuster during development. I also managed to make the browser unresponsive by logging too much (crbug.com/1073301).

Referenced in: Better Whistle Synth

Comment via: facebook, lesswrong

Recent posts on blogs I like:

Jealousy In Polyamory Isn't A Big Problem And I'm Tired Of Being Gaslit By Big Self-Help

The nuance is in the post, guys

via Thing of Things July 18, 2024

Trust as a bottleneck to growing teams quickly

non-trust is reasonable • trust lets collaboration scale • symptoms of trust deficit • how to proactively build trust

via benkuhn.net July 13, 2024

Coaching kids as they learn to climb

Helping kids learn to climb things that are at the edge of their ability The post Coaching kids as they learn to climb appeared first on Otherwise.

via Otherwise July 10, 2024

more     (via openring)