p5.js | setPath() Function Last Updated : 15 Apr, 2020 Comments Improve Suggest changes Like Article Like Report The setPath() function is an inbuilt function in p5.js library. This function is used to reset the source for the SoundFile of new path. Syntax: setPath(path, callback) Note: All the sound-related functions only work when the sound library is included in the head section of the index.html file. Parameter: This function accept two parameters as mentioned above and described below: path: This parameter holds the path of the new file. callback: This parameter is the name of the function that will be called. Below example illustrates the p5.setPath() function in JavaScript: javascript var sound; function preload() { // Initialize sound sound = loadSound("pfivesound.mp3"); sounds = loadSound("pfivesounds.mp3") } function setup() { // Playing the preloaded sound sound.play(); //sound will play twice fast sound.setpath(sounds/pfivesound.mp3, gfg); } function gfg() { alert("setPath function called successfully") } Online editor: https://editor.p5js.org/ Environment Setup: https://www.geeksforgeeks.org/p5-js-soundfile-object-installation-and-methods/ Supported Browsers: The browsers supported by p5.js setPath() function are listed below: Google Chrome Internet Explorer Firefox Safari Opera Comment More infoAdvertise with us Next Article p5.js | setPath() Function S skyridetim Follow Improve Article Tags : JavaScript Web Technologies JavaScript-p5.js Similar Reads p5.js setup() Function The setup() function runs when the program starts. It is used to set the initial environment properties such as text-color, screen size, background-color and load the media file such as images and fonts. The program contains only one setup() function. The setup() function can not be called again aft 2 min read p5.js | setLoop() Function The setLoop() function is an inbuilt function in p5.js library. This function is used to play the audio on the web in a loop where you can change the value when the loaded sound is playing and that will affect when it reaches the end of the current playback. Syntax: setLoop( Boolean ) Note: All the 2 min read p5.js save() Function The save() function in p5.js is used to save to the file system by prompting a download to the computer. This function can be used to save text, images, JSON, CSV, wav, or HTML files. The default option is to save the current canvas as an image.The first parameter of the function can be specified va 3 min read p5.js point() Function The point() function is an inbuilt function in p5.js which is used to draw the point in a given coordinate position. Syntax: point( x, y, [z]) Parameters: This function accept three parameters which are described below x: It is used to set the x-coordinate of point. y: It is used to set the y-coordi 1 min read p5.js storeItem() Function The storeItem() function is used to store a given value under a key name in the local storage of the browser. The local storage persists between browsing sessions and can store values even after reloading the page. It can be used to save non-sensitive information, such as user preferences. Sensitive 2 min read Like