Now I assume that you have installed all the requirements needed for the visualizer.
If not read Part 1.
We are using the graph from OpenGL Programming/Scientific OpenGL Tutorial 02 for plotting the spectrum. Full source code for the graph is available here.
Lets create a file
draw.cpp and add a
main function. We pass
.wav file as an argument.
To play the music we are using SFML. So lets write code for that.
Before that we need to create an object
sf::Music music;. Add it to the global part.
Initializing the OpenGL. See this tutorial for better understanding the graph used here.
Now we need to get the points to plot.
getData() is the function we fetch to get N/2
points in to the array.
music.play() plays the music been loaded.
Now lets call some OpenGL function to plot the spectrum.
Create a file
visualizer.hpp and add the following codes.
This completes the
main function. Here is the complete code for the function.
» Part 3
Full Source Code.
comments powered by