Code Monkey home page Code Monkey logo

music_visualizer's Introduction

About

Welcome to the project page for my music visualizer :)

Here is a comparison between what my app looks like and what other music visualizers might look like when visualizing the same sound.

Examples

Usage

The program is meant to feel like using shadertoy. What this means is that the user writes a .frag file that renders to a fullscreen quad (actually a window sized quad). If the user wants multipass buffers, then multiple .frag files should be written. The name of a buffer is the file name of the frag file without the .frag extension. The contents of a buffer are available in all buffer shaders as i[buffer name here]. So if the buffers A.frag and a B.frag exist, then B can access the contents of A by doing texture(iA, pos);.

Every shader must contain an image.frag file, just like shadertoy.

Code for a shader should be located in a folder named shaders that is in the same directory as the executable. Subdirectories of shaders/ can also contain code but that code will not be considered a part of the currently rendered shader.

A shadertoy like shader might have the following folder layout

shader_viewer.exe
shaders/
	image.frag
	buffA.frag
	buffB.frag

See here for details on how to configure the rendering process.

Here is a list of uniforms available in all buffers

vec2 iMouse;
bool iMouseDown;     // whether left mouse button is down, in range [0, iRes]
vec2 iMouseDownPos;  // position of mouse when left mouse button was pressed down
vec2 iRes;           // resolution of window
vec2 iBuffRes;       // resolution of currently rendering buffer
float iTime;
int iFrame;
float iNumGeomIters; // how many times the geometry shader executed, useful for advanced mode rendering
sampler1D iSoundR;   // audio data, each element is in the range [-1, 1]
sampler1D iSoundL;
sampler1D iFreqR;    // each element is >= zero for frequency data, you many need to scale this in shader
sampler1D iFreqL;

// Samplers for your buffers, for example
sampler2D iMyBuff;
// Constant uniforms specified in shader.json, for example
uniform vec4 color_set_by_script;

Building

First get the sources:

git clone --recursive https://github.com/xdaimon/music_visualizer.git

Then to build on Ubuntu with gcc version >= 5.5:

sudo apt install cmake libglfw3-dev libglew-dev libpulse-dev
cd music_visualizer
mkdir build
mkdir build_result
cd build
cmake ..
&& make -j4
&& mv main ../build_result/music_visualizer
&& cp -r ../src/shaders ../build_result/shaders

and on Windows 10 with Visual Studio 2017:

build the x64 Release configuration

Contact

Feel free to use the issues page as a general communication channel.

You can also message me on reddit at /u/xdaimon

Thanks To

ffts Fast fft library
cava Pulseaudio setup code
Oscilloscope Shader code for drawing smooth lines
SimpleFileWatcher Asyncronous recursive file watcher
RapidJson Fast json file reader
Catch2 Convenient testing framework

music_visualizer's People

Contributors

bradleybauer avatar hannesha avatar

Watchers

 avatar  avatar

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.