Question
Make an audio visualizer that looks like paint on an audio speaker in Javascript using the p5 Library. It is supposed to look as though
Make an audio visualizer that looks like paint on an audio speaker in Javascript using the p5 Library.
It is supposed to look as though it is pulsing along the music
Be sure to use the audio class to include a sound into the program that starts playing when clicked on, then stops if you click again.
Below is a snippet of code that may help:
ar song;
function setup() { song = loadSound('assets/lucky_dragons_-_power_melody.mp3'); createCanvas(720, 200); background(255,0,0); }
function mousePressed() { if ( song.isPlaying() ) { // .isPlaying() returns a boolean song.stop(); background(255,0,0); } else { song.play(); background(0,255,0); } }
To use the Audio Classes, you will need the p5.sound library a sound file, and a running local server. The easiest way to do so is with a PHP local web Server.
Step by Step Solution
There are 3 Steps involved in it
Step: 1
Get Instant Access to Expert-Tailored Solutions
See step-by-step solutions with expert insights and AI powered tools for academic success
Step: 2
Step: 3
Ace Your Homework with AI
Get the answers you need in no time with our AI-driven, step-by-step assistance
Get Started