MV (Music Visualizer) is a web-based application designed to transform music into visually engaging, real-time graphics. Built using the p5.js library and its sound module, the application allows users to upload music files and optional background images. It then visualizes the audio by animating particles and shapes that react to the music's frequency and amplitude.
Music Upload: Upload .mp3 audio files to generate visualizations.
.mp3
Custom Background Image: Upload custom background images (.jpg, .png).
.jpg
.png
Real-Time Audio Analysis: Uses FFT and amplitude analysis for dynamic visualization.
Interactive Canvas: Play/pause music by clicking on the canvas.
Responsive Layout: Adapts to browser dimensions.
A JavaScript library for creative coding.
Website: https://p5js.org
An add-on library that provides audio capabilities.
Documentation: https://p5js.org/reference/#/libraries/p5.sound
Handles DOM manipulation and integration with external platforms (e.g., OutSystems).
User Interface:
A container (HTML div) embeds the canvas.
div
Two file input elements allow users to upload audio and image files.
Initialization:
The sketch reads the provided container and inputs.
Canvas and audio context are created and configured.
Loading Assets:
loadSound() is used for the music file.
loadSound()
loadImage() for the background.
loadImage()
FFT Analysis:
An instance of p5.FFT() analyzes the audio signal.
p5.FFT()
Returns an array of frequencies used to animate visuals.
Drawing Loop:
draw() is called continuously to update the canvas.
draw()
Visual effects include radial shapes and particle systems that respond to audio.
Interaction:
Clicking toggles audio playback.
Canvas is auto-resized on window resize.
p5.js: https://cdnjs.cloudflare.com/ajax/libs/p5.js/1.4.0/p5.min.js
p5.sound: https://cdnjs.cloudflare.com/ajax/libs/p5.js/1.4.0/addons/p5.sound.min.js
Tutorials:
p5.js + Audio: https://p5js.org/learn/sound.html
YouTube Visualizer Tutorial: YT-Link
Define container ID and input element IDs.
Pass those IDs as parameters to the visualizer script.
Example:
const config = { containerId: "VisualizerContainer", uploadWidId: "MusicUpload", imageUploadWidId: "ImageUpload" }; new MVVisualizer(config);
📁 MusicVisualizer ├── index.html # HTML embedding and app entry point ├── mv-visualizer.js # Core visualizer logic ├── mv-logo.png # App icon/logo ├── assets/ │ ├── music.mp3 # Example music file │ └── background.jpg # Example image file
Microphone input for live visualization.
Visual customization (color, shape).
Multiple visualization modes.
Save visualization snapshots.
BSD-3 License.
Developed by Vasudevan Natesan
For questions or contributions, feel free to reach out or fork the project.