P5.js & P5.sound error | Sololearn: Learn to code for FREE!
New course! Every coder should learn Generative AI!
Try a free lesson
+ 3

P5.js & P5.sound error

i have the code, function setup(){ createCanvas(800, 800, WEBGL); song = loadSound('assets/lucky_dragons_-_power_melody.mp3'); } function draw(){ let mouse = { locX: mouseX - height % 2, locY: mouseY - width % 2 }; ambientLight(80); directionalLight(255, 56, 67, 0.25, 123.25, 1); pointLight(33, 15, 255, mouse.locX / Math.PI, mouse.locY * Math.PI, 250); push(); rotateX(mouse.locX); rotateY(mouse.locY); box(10, 50, 50); pop(); song.play(); } mouseClicked = function(){ createCanvas(mouseX, mouseY); // keep clicking to claim you're gift! }; mouseDragged = function(){ background(132, 250, 250); //or dragging... }; and it says this in the console, p5 had problems creating the global function "_initializeInstanceVariables", possibly because your code is already using that name as a variable. You may want to rename your variable to something else. p5 had problems creating the global function "registerPreloadMethod", possibly because your code is already using that name as a variable. You may want to rename your variable to something else. p5 had problems creating the global function "registerMethod", possibly because your code is already using that name as a variable. You may want to rename your variable to something else. p5 had problems creating the global function "_createFriendlyGlobalFunctionBinder", possibly because your code is already using that name as a variable. You may want to rename your variable to something else. p5 had problems creating the global function "cursor", possibly because your code is already using that name as a variable. You may want to rename your variable to something else. p5 had problems creating the global function "frameRate", possibly because your code is already using that name as a variable. You may want to rename your variable to something else. p5 had problems creating the global function "getFrameRate", possibly because your code is already using that name as a variable. You may want to

29th Dec 2018, 1:18 AM
Potato Hacker
Potato Hacker - avatar
7 Answers
29th Dec 2018, 1:38 AM
Potato Hacker
Potato Hacker - avatar
+ 2
Can you post the head of your HTML? So that we can check whether you have included the right prerequisite library.
29th Dec 2018, 1:33 AM
Gordon
Gordon - avatar
+ 2
ok
29th Dec 2018, 2:43 AM
Potato Hacker
Potato Hacker - avatar
29th Dec 2018, 2:00 AM
Gordon
Gordon - avatar
+ 1
I think the error occurs because you imported p5 core library twice, which in turn is because you copy the inclusion scripts from two different source. If the above doesn't work, change to use this set of library: https://github.com/processing/p5.js-sound/tree/master/lib
29th Dec 2018, 2:06 AM
Gordon
Gordon - avatar
+ 1
hacker.c a t(😺💻); Is your problem solved?
31st Dec 2018, 3:37 AM
Gordon
Gordon - avatar
0
Is your problem solved?
29th Dec 2018, 12:28 PM
Gordon
Gordon - avatar