There was no school to day and to kill some time, I made a waveform visualizer (it also plays the corresponding tone). It uses lines and a table of y positions. I was going to try and make one out of GLSL, but GLSL confuses me deeply .
Waveform
Re: Waveform
This makes a cool song. I like it.
Code: Select all
L
L Ö
Ö V
L Ö V E
Ö B E
V E
E Y
-
- Party member
- Posts: 712
- Joined: Fri Jun 22, 2012 4:54 pm
- Contact:
Re: Waveform
Neat little demo!
I noticed you draw all the lines individually, in a for loop. It works well and doesn't really matter much, but you might want to know that love.graphics.line can take a table as arguments as well. So if you'd save the y AND the x values into the wave table, you could simply call:
love.graphics.line(wave).
But it doesn't really matter...
I noticed you draw all the lines individually, in a for loop. It works well and doesn't really matter much, but you might want to know that love.graphics.line can take a table as arguments as well. So if you'd save the y AND the x values into the wave table, you could simply call:
love.graphics.line(wave).
But it doesn't really matter...
trAInsported - Write AI to control your trains
Bandana (Dev blog) - Platformer featuring an awesome little ninja by Micha and me
GridCars - Our jam entry for LD31
Germanunkol.de
Bandana (Dev blog) - Platformer featuring an awesome little ninja by Micha and me
GridCars - Our jam entry for LD31
Germanunkol.de
Re: Waveform
The problem with using a table of both x and y values is the x value will always stay the same relative to the y value. The for loop uses the iterator for the x while removing the first Y value. When the 1st Y value is removed, all the remaining values shift down one (removed<-1st <- 2nd <- 3rd...). By doing this, the wave looks like it is moving.Germanunkol wrote:Neat little demo!
I noticed you draw all the lines individually, in a for loop. It works well and doesn't really matter much, but you might want to know that love.graphics.line can take a table as arguments as well. So if you'd save the y AND the x values into the wave table, you could simply call:
love.graphics.line(wave).
But it doesn't really matter...
I did fix two things though. The first point is know drawn in the right position and the height and width are corrected. need to stop coding things at 2 a.m...
-
- Party member
- Posts: 712
- Joined: Fri Jun 22, 2012 4:54 pm
- Contact:
Re: Waveform
Uh, you're right. My bad, sorry, I didn't think it through...
trAInsported - Write AI to control your trains
Bandana (Dev blog) - Platformer featuring an awesome little ninja by Micha and me
GridCars - Our jam entry for LD31
Germanunkol.de
Bandana (Dev blog) - Platformer featuring an awesome little ninja by Micha and me
GridCars - Our jam entry for LD31
Germanunkol.de
Who is online
Users browsing this forum: No registered users and 2 guests