LOVE2D - SoundEffect Spectrum Surge (pure Lua)

Show off your games, demos and other (playable) creations.
User avatar
darkmetalic
Prole
Posts: 17
Joined: Tue Feb 07, 2017 4:09 pm
Contact:

LOVE2D - SoundEffect Spectrum Surge (pure Lua)

Post by darkmetalic »

Hello guys, I making avaliable a sequence of sound effects in spectral waveform with colors, only in Lua. I got it somewhere and I changed all the code and optimized, removed bugs and added more functions and effects.
Attachments
SpectrumSurge.zip
(2.07 MiB) Downloaded 288 times
SpectrumSurge.love
(2.07 MiB) Downloaded 317 times
Last edited by darkmetalic on Thu Feb 16, 2017 7:32 pm, edited 1 time in total.
User avatar
raidho36
Party member
Posts: 2063
Joined: Mon Jun 17, 2013 12:00 pm

Re: LOVE2D - SoundEffect Spectrum Surge (pure Lua)

Post by raidho36 »

OK, cool.
User avatar
Positive07
Party member
Posts: 1014
Joined: Sun Aug 12, 2012 4:34 pm
Location: Argentina

Re: LOVE2D - SoundEffect Spectrum Surge (pure Lua)

Post by Positive07 »

raidho36 wrote: Thu Feb 16, 2017 7:29 pmOK, cool.
I got nothing more to say than what raidho said... This looks great!
for i, person in ipairs(everybody) do
[tab]if not person.obey then person:setObey(true) end
end
love.system.openURL(github.com/pablomayobre)
User avatar
bgordebak
Party member
Posts: 130
Joined: Thu Jul 10, 2014 2:04 am
Location: Ankara, Turkey

Re: LOVE2D - SoundEffect Spectrum Surge (pure Lua)

Post by bgordebak »

Cool!

I tried with some other audio files too. Works great!
User avatar
darkmetalic
Prole
Posts: 17
Joined: Tue Feb 07, 2017 4:09 pm
Contact:

Re: LOVE2D - SoundEffect Spectrum Surge (pure Lua)

Post by darkmetalic »

bgordebak wrote: Fri Feb 17, 2017 1:32 am Cool!

I tried with some other audio files too. Works great!
This is the good side, you can put any kind of audio supported without rules being stereo or mono, the problem is there are stereo sounds that you can barely see good visual effects because the frequency rate is very high
User avatar
zorg
Party member
Posts: 3444
Joined: Thu Dec 13, 2012 2:55 pm
Location: Absurdistan, Hungary
Contact:

Re: LOVE2D - SoundEffect Spectrum Surge (pure Lua)

Post by zorg »

Oh, so it's a Spectrum Analyzer, nice work; i hate you for the initial fullscreen though. :3

That being said, if you're using a better FFT than what i found on github, i'll start to like you instead :D

Looks like you're using the same shitty lib i am, that doesn't support different sampling rates, and it has tons of issues... welp, too bad. :|
Me and my stuff :3True Neutral Aspirant. Why, yes, i do indeed enjoy sarcastically correcting others when they make the most blatant of spelling mistakes. No bullying or trolling the innocent tho.
User avatar
Ref
Party member
Posts: 702
Joined: Wed May 02, 2012 11:05 pm

Re: LOVE2D - SoundEffect Spectrum Surge (pure Lua)

Post by Ref »

Great!
Just wondering how frequency is related to spectrum:abs() value.
User avatar
zorg
Party member
Posts: 3444
Joined: Thu Dec 13, 2012 2:55 pm
Location: Absurdistan, Hungary
Contact:

Re: LOVE2D - SoundEffect Spectrum Surge (pure Lua)

Post by zorg »

Ref wrote: Sat Feb 18, 2017 4:03 pm Great!
Just wondering how frequency is related to spectrum[ i ]:abs() value.
The spectrum table holds the bins the FFT lib calculated; bins are complex numbers, and each real and imaginary part is signed, since it's not amplitude, but phase information; the abs method on those complex numbers does a "sqrt(re^2 + im^2)", so basically it returns the geometric distance, which probably corresponds to the amplitude of the signal for one component of the spectrum.

Then again, this might be wrong, since for the most part, he just copied the supplied example project from the github repo (which, again, is a horribad fft implementation for various reasons); whether or not that operation is correct is sadly something i don't know; one might just get the real part and show that instead; since this is a visualizer, it doesn't have that much effect on anything but the visuals.
Me and my stuff :3True Neutral Aspirant. Why, yes, i do indeed enjoy sarcastically correcting others when they make the most blatant of spelling mistakes. No bullying or trolling the innocent tho.
User avatar
Ref
Party member
Posts: 702
Joined: Wed May 02, 2012 11:05 pm

Re: LOVE2D - SoundEffect Spectrum Surge (pure Lua)

Post by Ref »

But isn't there some relationship between 'i' and 'frequency'?
Otherwise, what does the 'visualizer' show?
User avatar
zorg
Party member
Posts: 3444
Joined: Thu Dec 13, 2012 2:55 pm
Location: Absurdistan, Hungary
Contact:

Re: LOVE2D - SoundEffect Spectrum Surge (pure Lua)

Post by zorg »

Ref wrote: Sat Feb 18, 2017 5:34 pm But isn't there some relationship between 'i' and 'frequency'?
Otherwise, what does the 'visualizer' show?
Ah, but there is! Or at least, it would be if the fft implementation wouldn't suck.
The way i'd imagine it, is that you give the fourier transform a maximum frequency (a sampling rate of 44.1 kHz, for example), and the number of bins you want to get out of the signal you pass into it... (First one should be the DC component in all cases though, basically the main offset of the signal, which also has a constant 0 imaginary part)

The library used here has one input, a table of samplepoints.
...
If you pass it 1024 smp-s, you get back 1024 bins. (Half of it mirrored on the nyquist frequency (samplingrate / 2), of course, so totally useless from a visualization standpoint)
...
If your sampling rate is anything but 44.1 kHz, then the relationship is messed up, but otherwise, for that exact rate, it works, somehow.
Also, the equation is this: frequency (Hz) = i / (#spectrum (number of bins) / 44100)
At least, iirc that was in the original code example.
Also sorry for my overall tone, it's not the OP whose code i'm mad about, to be clear, but the person who made the lua port of the fft lib, that he uses.

In any case, the fft does give back a table with values relating to frequency ranges, but the partition sizes, count, and the frequency limit is what's inflexible; It's still in the Frequency Domain.

Worth noting that while i do dabble in music, both from a coding and a composing perspective, i don't claim that i understand everything regarding fourier transforms and related stuff; i might be wrong.

Also some disclosure: I use the same p.o.c. lua fft lib in my visualizers as well.
Me and my stuff :3True Neutral Aspirant. Why, yes, i do indeed enjoy sarcastically correcting others when they make the most blatant of spelling mistakes. No bullying or trolling the innocent tho.
Post Reply

Who is online

Users browsing this forum: No registered users and 171 guests