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

**URL:** <https://discourse.processing.org/t/p5-sound-on-google-chrome-p5-sound-js-3191-uncaught-in-promise-typeerror-cannot-read-property-addmodule-of-undefined/29939>\
**Category:** Libraries\
**Created:** [May 7, 2021, 12:50pm UTC](https://discourse.processing.org/t/p5-sound-on-google-chrome-p5-sound-js-3191-uncaught-in-promise-typeerror-cannot-read-property-addmodule-of-undefined/29939 "2021-05-07T12:50:00Z")\
**Posts on this page:** 5\
**Page:** 1

<div class="post-metadata">

**Author:** ![Discordanian](https://yyz2.discourse-cdn.com/flex036/user_avatar/discourse.processing.org/discordanian/32/13087_2.png) [@Discordanian](https://discourse.processing.org/u/Discordanian)\
**Post date:** [May 7, 2021, 12:50pm UTC](https://discourse.processing.org/t/p5-sound-on-google-chrome-p5-sound-js-3191-uncaught-in-promise-typeerror-cannot-read-property-addmodule-of-undefined/29939/1 "2021-05-07T12:50:00Z")

</div>

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/](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**

```auto
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**

```auto
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**

```auto
<!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>

```

---

<div class="post-metadata">

**Author:** ![micuat](https://yyz2.discourse-cdn.com/flex036/user_avatar/discourse.processing.org/micuat/32/19407_2.png) [@micuat](https://discourse.processing.org/u/micuat)\
**Post date:** [May 7, 2021, 5:57pm UTC](https://discourse.processing.org/t/p5-sound-on-google-chrome-p5-sound-js-3191-uncaught-in-promise-typeerror-cannot-read-property-addmodule-of-undefined/29939/2 "2021-05-07T17:57:19Z")

</div>

it seems like this issue [Chrome issue: TypeError: Cannot read property 'addModule' of undefined · Issue #454 · processing/p5.js-sound · GitHub](https://github.com/processing/p5.js-sound/issues/454)

can you try with https?

---

<div class="post-metadata">

**Author:** ![Discordanian](https://yyz2.discourse-cdn.com/flex036/user_avatar/discourse.processing.org/discordanian/32/13087_2.png) [@Discordanian](https://discourse.processing.org/u/Discordanian)\
**Post date:** [May 7, 2021, 6:53pm UTC](https://discourse.processing.org/t/p5-sound-on-google-chrome-p5-sound-js-3191-uncaught-in-promise-typeerror-cannot-read-property-addmodule-of-undefined/29939/3 "2021-05-07T18:53:49Z")

</div>

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?

---

<div class="post-metadata">

**Author:** ![micuat](https://yyz2.discourse-cdn.com/flex036/user_avatar/discourse.processing.org/micuat/32/19407_2.png) [@micuat](https://discourse.processing.org/u/micuat)\
**Post date:** [May 7, 2021, 8:29pm UTC](https://discourse.processing.org/t/p5-sound-on-google-chrome-p5-sound-js-3191-uncaught-in-promise-typeerror-cannot-read-property-addmodule-of-undefined/29939/4 "2021-05-07T20:29:24Z")

</div>

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

---

<div class="post-metadata">

**Author:** ![KumuPaul](https://yyz2.discourse-cdn.com/flex036/user_avatar/discourse.processing.org/kumupaul/32/13072_2.png) [@KumuPaul](https://discourse.processing.org/u/KumuPaul)\
**Post date:** [May 16, 2021, 12:39am UTC](https://discourse.processing.org/t/p5-sound-on-google-chrome-p5-sound-js-3191-uncaught-in-promise-typeerror-cannot-read-property-addmodule-of-undefined/29939/5 "2021-05-16T00:39:01Z")

</div>

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](https://stackoverflow.com/questions/67549798/error-from-p5-sound-in-browser-when-it-is-hosted-via-http)
