# P5 Sound Issues

**URL:** https://discourse.processing.org/t/p5-sound-issues/15573
**Category:** Libraries
**Created:** [November 17, 2019, 12:34pm UTC](https://discourse.processing.org/t/p5-sound-issues/15573 "2019-11-17T12:34:43Z")
**Posts on this page:** 5
**Page:** 1

<div class="post-metadata">

### Author: ![seanzshow](https://avatars.discourse-cdn.com/v4/letter/s/85f322/32.png) [@seanzshow](https://discourse.processing.org/u/seanzshow)
#### Post date: [November 17, 2019, 12:34pm UTC](https://discourse.processing.org/t/p5-sound-issues/15573/1 "2019-11-17T12:34:44Z")

</div>

Hi can anyone tell me where I am going wrong here? It appears that the p5 sound library is not being read - hence it doesn’t understand things like loop. However it is linked to in the HTML as a default and Ive not changed that. Ive also loaded a version of it into the folder as a local file and linked to that as well… Im using the online p5 editor. Any help would be greatly appreciated

Code: [https://editor.p5js.org/seanzshow/sketches/j-\_VtQpD5](https://editor.p5js.org/seanzshow/sketches/j-_VtQpD5)

 ![P5Sound](https://canada1.discourse-cdn.com/flex036/uploads/processingfoundation1/original/2X/a/a7ee59ab04343ac4df117e855c0443d99668677c.jpeg)

---

<div class="post-metadata">

### Author: ![GoToLoop](https://yyz2.discourse-cdn.com/flex036/user_avatar/discourse.processing.org/gotoloop/32/86_2.png) [@GoToLoop](https://discourse.processing.org/u/GoToLoop)
#### Post date: [November 17, 2019, 12:39pm UTC](https://discourse.processing.org/t/p5-sound-issues/15573/2 "2019-11-17T12:39:32Z")

</div>

[p5js.org/reference/#/p5/preload](http://p5js.org/reference/#/p5/preload)

---

<div class="post-metadata">

### Author: ![seanzshow](https://avatars.discourse-cdn.com/v4/letter/s/85f322/32.png) [@seanzshow](https://discourse.processing.org/u/seanzshow)
#### Post date: [November 17, 2019, 1:00pm UTC](https://discourse.processing.org/t/p5-sound-issues/15573/3 "2019-11-17T13:00:02Z")

</div>

Hi thanks for the reply.

I presume you are suggesting to move the loadSound bit into a preload function?

The issues above still remain in that addPhrase and loop functions are undefined.

I am quite new to coding but I can find reference to both of these in the p5 sound js file so it seems that what is happening is the sketch cant find the library…however I may be wrong.

Cheers

---

<div class="post-metadata">

### Author: ![GoToLoop](https://yyz2.discourse-cdn.com/flex036/user_avatar/discourse.processing.org/gotoloop/32/86_2.png) [@GoToLoop](https://discourse.processing.org/u/GoToLoop)
#### Post date: [November 17, 2019, 1:09pm UTC](https://discourse.processing.org/t/p5-sound-issues/15573/4 "2019-11-17T13:09:16Z")

</div>

> [@seanzshow](#):
>
> The issues above still remain in that **addPhrase()** and **loop()** functions are `undefined`.

- It’s not the methods which are `undefined`, but the variable _drums_ itself!
- You only declare it globally: `let drums;`
- But you had never initialized it anywhere!

---

<div class="post-metadata">

### Author: ![seanzshow](https://avatars.discourse-cdn.com/v4/letter/s/85f322/32.png) [@seanzshow](https://discourse.processing.org/u/seanzshow)
#### Post date: [November 17, 2019, 1:13pm UTC](https://discourse.processing.org/t/p5-sound-issues/15573/5 "2019-11-17T13:13:40Z")

</div>

Ahh Ok that makes sense.

Ive added drums = new p5.Part(); into the setup and that works fine now.

Thanks for the help 🙂
