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).

Comment via: facebook, lesswrong

Recent posts on blogs I like:

Book Review: The Myth of Sex Addiction

I. David Ley’s The Myth of Sex Addiction is a stupid, wrong book saved only by the fact that the people it’s arguing with are stupider and wronger. II. “Sex addiction” is a proposed mental health condition, not recognized by the DSM or the ICD, where a pe…

via Thing of Things March 7, 2024

Your wedding doesn’t have to be that great

Your future happiness does not depend on how gorgeous this one day is. The post Your wedding doesn’t have to be that great appeared first on Otherwise.

via Otherwise March 4, 2024

When Nurses Lie to You

When the nurse comes to give you the flu shot, they say it won't hurt at all, right? And you trust them. Then they give you the shot, and it hurts! They lied to you. A lot of nurses lie to children about shots and blood draws. Part of it is they probabl…

via Lily Wise's Blog Posts February 28, 2024

more     (via openring)