It’s possible to get an audio worklet running nicely in Observable, but it takes a few workarounds. Here’s how I did it:
This might be a little nicer if the Observable editor somehow supported cells containing an embedded script, instead of a bare string.
Also, the trick of returning a Promise that never resolves to prevent downstream cells from running early seems a bit obscure. Maybe there’s a more elegant way to do it?
Edit: republished after I found a better way to convert a string to a URL.