P5.sound on google chrome - p5.sound.js:3191 Uncaught (in promise) TypeError: Cannot read property 'addModule' of undefined

What I’m seeing is that I’m getting an error using p5.sound w/Chrome (seems to work fine in FireFox, haven’t tried it elsewhere). I’ve stubbed out a very small/simple example almost cribbed verbatim from the reference example. Perhaps more oddly is that I get no error if I run it locally even in Chrome.

URL: http://dev.tangentialcold.com/tangentialcold/p5audio/

p5js version 1.3.1
p5.sound version 0.3.12
Browser: Chrome
My desktop OS: OSX 11.3.1

Error Message

p5.sound.js:3191 Uncaught (in promise) TypeError: Cannot read property 'addModule' of undefined
    at p5.sound.js:3191
    at Array.map (<anonymous>)
    at loadAudioWorkletModules (p5.sound.js:3186)
    at _.<anonymous> (p5.sound.js:3211)
    at _.<anonymous> (p5.min.js:3)
    at Array.forEach (<anonymous>)
    at new _ (p5.min.js:3)
    at p5.min.js:3

Hitting the URL above you can see the code, but I’ll put it inline here for convenience as well.

main.js

function preload() {
    console.log("preload()")
    sound = loadSound('assets/Particulates.mp3');
    bins = 64;
    maxamp = 0.2;
}

function setup() {
    sound.pause();
    console.log("setup()")
    let cnv = createCanvas(500, 500);
    cnv.mouseClicked(togglePlay);
    fft = new p5.FFT(0.8, bins);
    sound.amp(maxamp);
}

function draw() {
    background(220);

    if (sound.isPlaying()) {
    } // isPlaying
    else {
        text('tap to play', 20, 20);
    }
}

function togglePlay() {
    console.log("togglePlay");
    if (sound.isPlaying()) {
        sound.pause();
    } else {
        sound.play();
    }
}

index.html

<!DOCTYPE html>
<html lang="en">

<head>
    <meta charset="UTF-8">
    <title>Audio Test</title>
</head>

<body>
    <script src="vendor/p5.min.js"></script>
    <script src="vendor/p5.sound.js"></script>
    <script src="./main.js"></script>
</body>

</html>

it seems like this issue Chrome issue: TypeError: Cannot read property 'addModule' of undefined · Issue #454 · processing/p5.js-sound · GitHub

can you try with https?

Works with https. My dev server doesn’t have https, so this is kind of a bummer. Does this need to be noted in the reference docs?

I haven’t checked if anyone made a PR but if you can make a pull request that would be great!

FYI there are a couple of workarounds, I’ve outlined them here: javascript - Error from p5.sound in browser when it is hosted via HTTP? - Stack Overflow