Closed iballs closed 6 years ago
No matter what I do it keeps saying that loadSound is undefined?
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.
I would've never have caught this, thank you.
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. :)
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.
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.
Yep - it is fixed now. Thanks to both of you!