Simple threaded STFT (FFT) module for LOVE 11.0+

Showcase your libraries, tools and other projects that help your fellow love users.
Post Reply
Kunologist
Prole
Posts: 6
Joined: Fri Mar 20, 2020 9:21 am

Simple threaded STFT (FFT) module for LOVE 11.0+

Post by Kunologist »

Hello community!

As a rhythm game player, I've always been fascinated with audio processing. Using SoundData and threading features that LOVE provide, it is possible to create (almost-)real-time yet non-blocking FFT module that may be useful if you'd like t create audio visualizer or any kind of spectrum analysis.

The repository is at https://github.com/Gennadiyev/lovefft.

I hope you enjoyed making games with love2d just as I do!

Image
User avatar
zorg
Party member
Posts: 3465
Joined: Thu Dec 13, 2012 2:55 pm
Location: Absurdistan, Hungary
Contact:

Re: Simple threaded STFT (FFT) module for LOVE 11.0+

Post by zorg »

Awesome library!

I do have a few things to note though:

- not sure if this library works with streaming sources or not.
- tell is not an accurate way to tell position, but i guess for an fft that just needs to look nice, it will work.
- since your library uses multiple files, you really should use the relative require trick so that you don't need to force a specific location for the library to exist and/or make the user edit your files at all; i use it in my fft library as well:

Code: Select all

-- put this near the top of files that require other files, outside any function.
local current_folder = (...):match("(.-)[^%.]+$")
That said, if someone wants to use the c FFTW library with löve, that's also a possibility that has been tested.
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.
Kunologist
Prole
Posts: 6
Joined: Fri Mar 20, 2020 9:21 am

Re: Simple threaded STFT (FFT) module for LOVE 11.0+

Post by Kunologist »

zorg wrote: Sun Jul 17, 2022 5:38 am Awesome library!

I do have a few things to note though:

- not sure if this library works with streaming sources or not.
- tell is not an accurate way to tell position, but i guess for an fft that just needs to look nice, it will work.
- since your library uses multiple files, you really should use the relative require trick so that you don't need to force a specific location for the library to exist and/or make the user edit your files at all; i use it in my fft library as well:

Code: Select all

-- put this near the top of files that require other files, outside any function.
local current_folder = (...):match("(.-)[^%.]+$")
That said, if someone wants to use the c FFTW library with löve, that's also a possibility that has been tested.
- Yes, it actually uses SoundData and does not matter whether the audio source is streaming or not.
- True, I noticed that tell only has precision of around 1/100 second. A good workaround should be an

Code: Select all

loveFFT:update(dt)
call. I guess I may fix that and update the library soon as I'm working on my game as well! Thanks a lot for the advice!
- Oh I love the trick a lot! I personally use it in my projects! But I skipped that in the making of the library so as to make the project better structured... I think it might should be the developer's work to take care of the requires :)

I've gone through your fft library! It's awesome with a sharp focus on performance! I'm not so familiar with FFI so I fallback to a rather slow Lua-ly implementation... I'll add your repository to lovefft's readme on its next update!
Post Reply

Who is online

Users browsing this forum: No registered users and 1 guest