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:

Starting With Chords

A lot of people play fiddle. Basically nobody starts by learning chords before learning melodies. But that's actually how I learned. I started with chords. One of the nice things about learning to play violin this way is that you can go busking even…

via Anna Wise's Blog Posts November 15, 2024

Stuffies

I have some stuffies and I just have a bunny. Bunny is a rabbit. Woof is a seal. My favorite stuffie is bun bun. I play with my stuffies. Sometimes I jump up with them and I roll them. I can just throw them in the air when I want to play bthululubp wi…

via Nora Wise's Blog Posts November 15, 2024

You Can Buy A Malaria Net

2024 election takes

via Thing of Things November 6, 2024

more     (via openring)