YoYoGames / GameMaker-Bugs

Public tracking for GameMaker bugs
21 stars 8 forks source link

Fast Fourier Transform function #3014

Open c023-DeV opened 1 year ago

c023-DeV commented 1 year ago

Is your feature request related to a problem?

I've been wanting to make visualizers for music with gamemaker for a while and can't wrap my head around how to implement a Fast Fourier Transform ( FFT ) in GML that would also work in HTML5.

I'd love to see a built-in function in GameMaker for getting values from sound frequency bands (via FFT?) and manipulate variables relative to the volume in that specified frequency range.

This would allow me to make some nice visualizers for my music with GameMaker and also allow users to make other funky neat things like animating background images or particles on beat. If it can also take a live audio stream I could also build live VJ tools or even control games with audio signals (pitch singing).

This would be AWESOME!

Describe the solution you'd like

A function that returns a float value (0-1) of the average volume activity within a defined frequency range (for example: 40Hz - 120Hz) of an audio playback. (Music)

Additionaly an option to specify accuracy (for performance and rounding to average values to reduce jitter).

The function could also return an array of values at a defined resolution.

So that i can use this function call to manipulate variables. Great bonus if this can also work on a streaming input (microphone or line in) then it could be used for live shows or even to control games with audio signal pitch and more...

Describe alternatives you've considered

I've been faking it.

There is an extension on the marketplace but that doesn't work with html5. Unity has a built in FFT function and I've seen it in a few other frameworks like javaScript *p5. Also some of the newer audio features in GM:S (debug) seem to use FFT so it should be available.

Additional context

Pretty please!

DragoniteSpam commented 1 year ago

I know fmod can do this so whenever the official gamemaker-fmod extension gets made I expect this would be a part of it, (This may or may not be the extension you're talking about: mstop/fmodgms)

Would be pretty neat to have a cross-platform solution available built into GameMaker itself though.