p5.js | frames() Function Last Updated : 17 Jan, 2020 Summarize Comments Improve Suggest changes Share Like Article Like Report The frames() function is an inbuilt function in p5.js library. This function is used to return the no of frames. There was a simple equation between samplesRate, duration, and frames. The equation is frames = samplesRate*duration. Syntax: frames() Note: All the sound-related functions only work when the sound library is included in the head section of the index.html file. Parameters: This function does not accept any parameter. Return Values: This function return an integer that holds the no of frames. Below example illustrates the p5.frames() function in JavaScript: Example: javascript var sound; var frm; function preload() { // Initialize sound sound = loadSound("pfivesound.mp3"); } function setup() { // Playing the preloaded sound sound.play(); // will return no of frames frm = sound.frames(); console.log(frm); } Output: 10201860 // no of frames of the played audio 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 frames() function are listed below: Google Chrome Internet Explorer Firefox Safari Opera Comment More infoAdvertise with us Next Article p5.js | frames() Function S skyridetim Follow Improve Article Tags : JavaScript Web Technologies JavaScript-p5.js Similar Reads p5.js frameRate() Function The frameRate() function in p5.js is used to specify the number of frames to be displayed every second. Calling frameRate() with no arguments returns the current framerate. The draw function must run at least once before it will return a value. This function is same as getFrameRate() function. Synta 1 min read p5.js fract() Function The fract() function in p5.js is used to find the fractional part of a number. It can be mathematically represented as {x} where 'x' is the number. Syntax: fract( num ) Parameters: This function accepts single parameter as mentioned above and described below. num: This is a number of which the fract 1 min read p5.js draw() Function The draw() function is called after setup() function. The draw() function is used to executes the code inside the block until the program is stopped or noLoop() is called. If the program does not contain noLoop() function within setup() function then draw() function will still be executed once befor 1 min read p5.js | createA() Function The createA() function in p5.js is used to create an anchor element in the DOM (Document Object Model) for creating a hyperlink. This function includes the p5.dom library. Add the following syntax in the head section.  html <script src= "https://cdnjs.cloudflare.com/ajax/libs/p5.js/0.5.11/addons 1 min read p5.js filter() Function The filter() function is used to apply filters to the canvas. p5.js has several presets that can be used with different levels of intensity to get the desired effect.Syntax:  filter( filterType, filterParam) Parameters: This function accept two parameters as mentioned above and described below:  f 3 min read Like