Giter VIP home page Giter VIP logo

led-music-visualizer's Introduction

LED Music Visualizer ๐Ÿ’ก๐ŸŽต๐Ÿ’ก

I created this project as part of my Humanities & Arts Practicum at Worcester Polytechnic Institute. The practicum was called "Light Art" and was directed by Prof. Joshua Rosenstock.

The goal behind the project was to try to find a way to map the sounds we hear and the feelings evoked in us by music to light. I wanted to try to use light to convey the same emotions that I was feeling from listening to a song.

How It Works

First, the program loads the given audio file and does some pre-processing on it. The pre-processing involves creating a spectrogram of the audio using the Discrete Fourier Transform and applying a Mel Filter. Using this high-level information about the component frequencies of the audio, the program generates an animation. The animation is drawn for each frame on a canvas in memory, mapping different frequencies to different properties of the "blips" that are drawn. Then each frame is converted into RGB pixel data that is sent to a FadeCandy LED controller, which controls an LED matrix that displays the animation. The animation is partly reactive to the spectrogram, and partly hand-choreographed. The audio file is also played along with the animation to make sure that the two are perfectly synchronized.

Demo

Demo video

Blog post

Try It Out

Hardware

I used all the same materials from Adafruit's excellent tutorial on how to use their FadeCandy LED controller board. Simply follow this tutorial and you'll have the same electronics set-up I used. The only other material I used was the translucent white acrylic from Delvie's Plastics, which I cut to make an enclosure around the LED matrix. This allows the piercing, direct light of the LEDs to be diffused and softend a bit, which creates a more pleasing display.

Software

At the moment, the visualization is specifically coreographed to the song "Such Great Heights" by The Postal Service, so you'll need an MP3 file of that song.

You'll need to install the following software in order to run the code:

Make sure Python and ffmpeg are in your system path. Then, clone this repo or download and unzip the code. In the top directory, use the following command to install the required Python libraries with pip:

python -m pip install -r requirements.txt

You may want to do this in a Virtual Environment to avoid library version conflicts.

Usage

First, launch the FadeCandy server by running the appriopriate fcserver executable for your platform in the bin folder of the FadeCandy download. Once the server is running, connect the FadeCandy board by USB to your computer. You should see a message on the server saying it has connected to a board. If it's your first time connecting a FadeCandy board, you may have wait a minute for your OS to install the drivers.

Next, open config.py and make sure that the values there match your setup. DISPLAY_SHAPE should be a tuple of the number of columns and rows in your LED matrix (probably just 8 by 8), CHANNELS_PER_PIXEL should be 3 for the RGB pixels, and FADECANDY_HOST and FADECANDY_PORT should match the values shown when the FadeCandy server was launched.

Next, run the main script from the repo's top level directory to get help on its usage:

python main.py -h

At the moment, the visualization is specifically coreographed to the song "Such Great Heights" by The Postal Service, so if you own an MP3 of that song, supply a path to it for the --audio-path argument.

led-music-visualizer's People

Contributors

dbeckwith avatar

Stargazers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

Watchers

 avatar  avatar

Forkers

warren2232

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    ๐Ÿ–– Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. ๐Ÿ“Š๐Ÿ“ˆ๐ŸŽ‰

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google โค๏ธ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.