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

Support multiple channels #11

Open
wants to merge 1 commit into
base: master
Choose a base branch
from
Open

Conversation

invis-z
Copy link

@invis-z invis-z commented Sep 4, 2023

This is an amateur's attempt to support multiple channels. I implemented it by taking an average of FFT results across all channels since blindly adding raw samples might cause phase issues.

Tested on Windows after built in WSL, seems to be working.

I don't know if this should count as bugfix since it is technically a new feature. But this does make audio files with only the right channel work with this program, although they are and should be very rare.

Thanks!

Preliminary support of multiple channels by taking an average of FFT
results across all channels to avoid potential phase issues.
@invis-z invis-z marked this pull request as draft September 4, 2023 05:05
@invis-z invis-z marked this pull request as ready for review September 4, 2023 05:06
@rexim
Copy link
Member

rexim commented Sep 4, 2023

How did you come up with this approach? Is this how it is usually done in frequency visualizers?

@invis-z
Copy link
Author

invis-z commented Sep 4, 2023

To be honest, I don't actually know about anything regarding what is the right way to deal with this problem.

The other day I watched a video mentioning playing music in mono resulting in degraded audio quality caused by the phase difference between the channels cancelling part of the sound and amplifying other part of it. Although this usually only happens in very old audio mixings, that video makes me think that just blindly averaging all the channel together can be a bad idea, so I tried to go to the next logical option, which is deal with it after FFT.

To me, this approach makes sense logically. It seems to be closer to what the listening experience would be in real life with a multi-speaker setup, and all the sound "adds" together. But it also might just be my imagination. Also, this is the only approach that falls within my programming ability. So I tried it with a song in both channels and stereo and visually it seems to be ok.

TL; DR, I pulled it out from thin air and have no idea if it is any good. So please just take this as an idea, perhaps a bad one.

@rexim
Copy link
Member

rexim commented Sep 4, 2023

I see, I see. I also don't know how it should be done properly. I need to do a bit more research on that.

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

Successfully merging this pull request may close these issues.

2 participants