had a silly idea, why not make a spectrum analyzer that reads data sent to the pcm channel?
while it does work, it uses an unoptimized discrete fourier transform, which is very slow! watch the cpu meter almost die when it starts doing the calculations
i should have implemented a fast fourier transform, but i didn't because 1: i don't fully understand how it works, 2: it involves keeping track of and manipulating multiple lists of data points, and i don't know all of the nuances of tables in lua so while i could technically implement the algorithm while only half knowing how it works, i wouldn't be able to do so efficiently. maybe one of you kind souls can spare a gamer some advice? the idea is there and i do think this would make for some really cool effects in pcm music players
anyway if you dare to use this as-is, the drawspectrum(x, y, w, h, pos, len) function does as follows:
draws a spectrum at (x, y), computes w points of the dft, and draws the magnitude spectrum w pixels wide, and scales the plot by h. pos is the address where it should look for pcm data and len is the number of samples to use when computing the dft. again, it's very slow, it's like O(w * len) time or something
i tried using the tracker for the first time. the song is Porky's Porkies from Mother 3.
the sound organization is a bit of a mess so good luck trying to learn anything from it
I also added a music visualizer to keep it from being boring. The visualizer should work for any arbitrary song you shove into it.
edit: i made it prettier :3
tossed together in about an hour
made for tweet tweet jam 3
have fun and remember to play safe