A low poly terrain generator that allows the user to select an audio file to act as a seed. The user should be able to move around to experience the environment generated and adjust the colours of the environment.
An audio visualizer that reads in .csv files and outputs points (3D coordinates) rendered with OpenGL in clip space. The .csv files that are read in contain time, frequency and amplitude data abstracted from audio files.
If you are viewing this project on GitHub you will not find a build of the project. If you wish to obtain an exe you will have to follow these steps.
- Download this repository & unzip the folder.
- Open the solution (Coursework2.sln) in visual studio.
- In the Solution Explorer right click the solution.
- Select Build Solution.
- You can now close visual studio.
- In the project folder you will find another folder called media. Copy this.
- Navigate to the build by entering the x64 folder and then the Debug folder.
- Paste the media folder here.
- You now have an executable project folder. You can move Debug anywhere you like and rename it.
Once you have your executable project folder you can run the project by clicking Coursework2.exe.
In the top right corner you have the visualizer. This is where you can view the audio data as points. When you load in you will be able to example data displayed in full. If you reach the end of the song text will display indicating this.
The settings are located in the bottom left. This is where your main interaction will take place.
Here you have 3 buttons. When you click each one the program will load the data for the corresponding song. Due to the volume of data being loaded this may take some time so please be patient. You will know that the data has loaded when it appears in the visualizer.
Here you have 4 options: white, green, blue and red. By selecting each option you will be able to change the colour of the visualizer. You don't need to wait until the end of the song, the changes are instant.
This displays the name of the song being displayed. It is located underneath the visualizer.
When you load data it will originally be paused. Clicking play will scroll through the data.
If you want to have a look at the data at a certain point you can click pause to stop scrolling through the data.
Once you reach the end of the song you can go back to the begining by clicking restart. You can also click at any point in the song. The data will always start in the visualizer paused.
My program relies on .csv files that contain audio data taken from audio files. An audio file contains a lot of data but to be able to access that data you must first decode it. As I want to find the individual frequencies and amplitudes of each sample after decoding the audio I had to run the data through a fourier transform. As I struggled to this in C++ I created a python script so that I could focus on processing the obtained data.
We have multiple songs that we can choose from. When a song is picked it will load the .csv data into the program. As we will be rendering in clip space we requires the values to be between -1 and 1 so we have to normalise our data using the equation below. This is done seperately for each value of frequency, amplitude and time as each group requires their own min and max value. Only normalised data of the current song is stored.
X' = (X - Xmin) / (Xmax - Xmin)
Once everything has been normalised we need to put that data into a vector as coordinates. We will be plotting time on the x axis, amplitude on the y axis and frequency on the z axis. These coordinates are loaded into the buffer then rendered as GL_Points using vertex and fragment shaders.
To allow user interaction we have buttons. These are multiple triangles rendered into clip space. Input is processed using glfw. To determine which button has been clicked the program takes the current mouse position. The mouse position outputs as the pixel position.
When playing the data at the very end the values do not move towards the left to leave space on the right. Instead the gap between each time increases resulting in an expanding appearance. This can be easily seen by clicking play on the test data.
A lot of people order personalised soundwave prints to hang on their walls, engrave into rings or make soundwave keyrings. I thought that I could take this facination with soundwaves into the virtual world and create a completely personal enviroment for people to enjoy.
At the start of the project I was supplied with a C++ & OpenGL project that displayed a 3D cube. This code contained everything needed to load and use shaders & textures. As I wanted to fully understand how shaders worked I deleted everything that was provided to me. All my shaders are written at the top of the of Project.cpp as a result.
Besides drawText(), the libraries and the assets used I everything was coded from scratch.
- Song 1 - slow motion from bensound
- Song 2 - energy from bensound
- Song 3 - dubstep from bensound
- drawText() - Ramazan Bellek
- freeglut
- glfw