Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Map generation: bandpass filters or fourier analysis #8

Open
Sogolumbo opened this issue Apr 16, 2021 · 3 comments
Open

Map generation: bandpass filters or fourier analysis #8

Sogolumbo opened this issue Apr 16, 2021 · 3 comments

Comments

@Sogolumbo
Copy link
Contributor

Some songs are heavily compressed. Hence the volume is a bad metric to get interesting maps.
Instead the volume of specific (randomly chosen?) frequency bands might be better at representing the rhythm.

@bydariogamer
Copy link
Owner

I am not sure about that... I am using sndarray to get the array of the song samples... And it is in the format I gave in the mixer module initializer (I leave it defaut so I guess it will be 22KHz but who knows). All formats of the same sound will return the exact same array. The only variation would be the number of channels (mono or stereo sound) but it doesn't change the intensity. I am not an expert in pygame however so maybe I am wrong...
I am not sure about how to implement the FFT needed, although I could just 'translate' the algorithm from beat-feet I guess. The problem is FFT is more expensive that this intensities algorithm, although you can try to implement it and compare pros and cons.

@Sogolumbo
Copy link
Contributor Author

What I've seen in the array is just a normal stereo audio signal. You can mathematically treat it just like any other function.

We can use a bandpass filter to get the signal in a specific frequency range. If we change the filter during the song the player might e.g. need to jump over the rhythm of the melody first and the rhythm of the drums after that.

I am sure there are suitable implementations of fft in python out there, only a quick search away.

@bydariogamer
Copy link
Owner

Seems fair to me. We can implement the new algorithm then. I will merge the current state of development to main (I will review your PR first and if they don't introduce any bug they will become the 1.4.2 release) and start adding new things to main...

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants