Montana-Media-Arts / 120_CreativeCoding

Main Code Repo for MART 120. This contains lecture code examples, the HW Wiki, and HW Code Examples.
https://montana-media-arts.github.io/creative-coding-1/
MIT License
131 stars 13 forks source link

Is anyone else working with sound and having this issue? #104

Closed iballs closed 6 years ago

iballs commented 6 years ago
screen shot 2018-05-02 at 3 34 13 pm
iballs commented 6 years ago

No matter what I do it keeps saying that loadSound is undefined?

michaelmusick commented 6 years ago

Did you uncomment the p5.sound.min.js line within your HTML document?

-- Michael Musick

michaelmusick.comhttp://michaelmusick.com

On May 2, 2018, at 3:36 PM, Ian Baldessari notifications@github.com<mailto:notifications@github.com> wrote:

No matter what I do it keeps saying that loadSound is undefined?

— You are receiving this because you are subscribed to this thread. Reply to this email directly, view it on GitHubhttps://github.com/Montana-Media-Arts/120_CreativeCoding/issues/104#issuecomment-386129283, or mute the threadhttps://github.com/notifications/unsubscribe-auth/ADe36O5mzcbbd_zVhqZjyQfikGuIFwskks5tuib3gaJpZM4TwMqL.

iballs commented 6 years ago

I would've never have caught this, thank you.

MarkLannen commented 6 years ago

I'm having an issue with a sound file. I've taken a screenshot of the code below where I declare the variable 'song,' define it in the preLoad function, and then in setup call it - song.play();

However, the song does not play, and when I inspect the element in Firefox, I get - TypeError: song is undefined which I don't understand as I think I have done that in the code.

Any suggestions welcome!

And yes, I have uncommented the p5 sound line in the html. :)

screen shot 2018-05-06 at 8 08 25 pm

michaelmusick commented 6 years ago

As with the setup and draw functions. You can only define preLoad a single time. I imagine that when you define a second time, the song variable is getting collected by garbage. Therefore, combine your two preLoad functions into a single preLoad functions definition. I think that will fix it?

— You are receiving this because you commented. Reply to this email directly, view it on GitHub, or mute the thread.

egriffin2 commented 6 years ago

I'm pretty sure that's exactly what it was, I just looked at this in another thread in the forum and it sounds like it's working now.

MarkLannen commented 6 years ago

Yep - it is fixed now. Thanks to both of you!