Code Monkey home page Code Monkey logo

staccato's Introduction

Staccato

alt text

A WebGL music visualizer demo

About

A music visualizer experiment simply powered by shaders–which are programs that tell the GPU how to render the material its applied to–and audio Fourier transform data that can easily be accessed by the Web Audio API.

Staccato simply takes data from a playing song, updates uniforms–which are variables that are passed into shaders for them to use–and now shapes in the scene using these shaders have tastefully modified vertices/color.

The two most important uniforms currently used include time and frequency, which is the elapsed time and a 32-bit float array for audio volume data, respectively. These two variables are alone enough to make powerful scenes, the beauty comes from simply how they're used in the shaders.

Making your own visualizations

Staccato exists as an easily modifiable object, which handles setting up the audio stream, loading songs, shaders, and adding shapes to the scene.

Some attributes/methods to modify:

  1. shaders : list of shaders that Staccato will load when you call addShape, make sure to have elements in index.html for your vertex ([shaderName]-vertex) and fragment ([shaderName]-fragment)shader.

  2. uniforms : object literal containing all uniform variables that each added shape receives

  3. addShape() : this is the function which adds a mesh to the scene with a specified geometry, shader, and vector position

  4. update() : should be called every frame to update uniforms, objects, etc

  5. There are several functions for setting up the audio which can be modified and used in plenty of other ways

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.