LOVE2D - SoundEffect Spectrum Surge (pure Lua)
- darkmetalic
- Prole
- Posts: 17
- Joined: Tue Feb 07, 2017 4:09 pm
- Contact:
LOVE2D - SoundEffect Spectrum Surge (pure Lua)
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 317 times
-
- SpectrumSurge.love
- (2.07 MiB) Downloaded 347 times
Last edited by darkmetalic on Thu Feb 16, 2017 7:32 pm, edited 1 time in total.
- Positive07
- Party member
- Posts: 1014
- Joined: Sun Aug 12, 2012 4:34 pm
- Location: Argentina
Re: LOVE2D - SoundEffect Spectrum Surge (pure Lua)
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)
[tab]if not person.obey then person:setObey(true) end
end
love.system.openURL(github.com/pablomayobre)
Re: LOVE2D - SoundEffect Spectrum Surge (pure Lua)
Cool!
I tried with some other audio files too. Works great!
I tried with some other audio files too. Works great!
- darkmetalic
- Prole
- Posts: 17
- Joined: Tue Feb 07, 2017 4:09 pm
- Contact:
Re: LOVE2D - SoundEffect Spectrum Surge (pure Lua)
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
- zorg
- Party member
- Posts: 3470
- Joined: Thu Dec 13, 2012 2:55 pm
- Location: Absurdistan, Hungary
- Contact:
Re: LOVE2D - SoundEffect Spectrum Surge (pure Lua)
Oh, so it's a Spectrum Analyzer, nice work; i hate you for the initial fullscreen though.
That being said, if you're using a better FFT than what i found on github, i'll start to like you instead
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.
That being said, if you're using a better FFT than what i found on github, i'll start to like you instead
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 True 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.
Re: LOVE2D - SoundEffect Spectrum Surge (pure Lua)
Great!
Just wondering how frequency is related to spectrum:abs() value.
Just wondering how frequency is related to spectrum:abs() value.
- zorg
- Party member
- Posts: 3470
- Joined: Thu Dec 13, 2012 2:55 pm
- Location: Absurdistan, Hungary
- Contact:
Re: LOVE2D - SoundEffect Spectrum Surge (pure Lua)
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 True 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.
Re: LOVE2D - SoundEffect Spectrum Surge (pure Lua)
But isn't there some relationship between 'i' and 'frequency'?
Otherwise, what does the 'visualizer' show?
Otherwise, what does the 'visualizer' show?
- zorg
- Party member
- Posts: 3470
- Joined: Thu Dec 13, 2012 2:55 pm
- Location: Absurdistan, Hungary
- Contact:
Re: LOVE2D - SoundEffect Spectrum Surge (pure Lua)
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 True 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.
Who is online
Users browsing this forum: No registered users and 2 guests