Waveform

Showcase your libraries, tools and other projects that help your fellow love users.
Post Reply
User avatar
XCaptain
Prole
Posts: 23
Joined: Tue Apr 09, 2013 11:18 am

Waveform

Post by XCaptain »

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 :crazy:.
Image
Attachments
Waveform.love
Fixed Height and Width variables; Fixed the first point not appearing were it should.
(725 Bytes) Downloaded 288 times
Last edited by XCaptain on Sun Feb 02, 2014 8:03 pm, edited 3 times in total.
User avatar
iPoisonxL
Party member
Posts: 227
Joined: Wed Feb 06, 2013 3:53 am
Location: Australia
Contact:

Re: Waveform

Post by iPoisonxL »

This makes a cool song. I like it.

Code: Select all

      L
    L Ö
    Ö V
L Ö V E
Ö B E
V E
E Y
Website
Germanunkol
Party member
Posts: 712
Joined: Fri Jun 22, 2012 4:54 pm
Contact:

Re: Waveform

Post by Germanunkol »

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...
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
User avatar
XCaptain
Prole
Posts: 23
Joined: Tue Apr 09, 2013 11:18 am

Re: Waveform

Post by XCaptain »

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...
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.

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...
Germanunkol
Party member
Posts: 712
Joined: Fri Jun 22, 2012 4:54 pm
Contact:

Re: Waveform

Post by Germanunkol »

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
Post Reply

Who is online

Users browsing this forum: No registered users and 2 guests