Skip to content

Conversation

@SleeeepyZhou
Copy link

Support multi-channel microphone input by downmixing to stereo

  • Enhanced the WASAPI audio driver to support microphones with any number of channels.
  • This modification ensures compatibility with a broader range of multi-channel microphones, allowing for more versatile input handling in Godot.
  • Regarding “WASAPI: unsupported channel count in microphone!” error.

I mistakenly modified the branch of the original PR #96947 , so I have recreated this PR.

Fix #82823
Fix #30313
Fix #99989
Issues #82823

I tried compiling and testing the four channel microphone on my laptop, and it turned out to be error free. This enables the successful use of multi-channel microphones in Godot.

I made the assumption that the microphone might have a potential configuration with odd channels (e.g., Left, Right, Center), although such configurations are uncommon (in some professional audio equipment). The goal was to ensure that the microphone is at least usable within Godot, regardless of the channel count. The WASAPI documentation itself doesn't explicitly specify how multi-channel microphones should be handled, so I aimed for a more general solution to accommodate various configurations.

I apologize for the inconvenience caused by the multiple review requests. Due to my unfamiliarity with the process, I made several revisions which have led to some wasted time. I have now reviewed and confirmed that everything is correct.
Thank you for your understanding and patience.

Thank you for reviewing !

@akien-mga
Copy link
Member

Superseded #99875, which was attempting to revive #96947 after it was first closed. If you're available to bring it to the finish line now, we can likely close #99875 and focus on this new PR. CC @fire

Copy link
Author

@SleeeepyZhou SleeeepyZhou left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

After my investigation, most microphones on the market are dual channel (left and right). Some microphones also have multiple microphone channels for noise reduction, recording environmental sounds and eliminating noise. Or a professional multi-channel microphone for better spatial audio. However, there is basically no specific channel correspondence (based solely on the information I obtained from my investigation). Therefore, the data can only be averaged to obtain relatively reasonable results.

Copy link
Member

@Calinou Calinou left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Looks good to me on principle, but I don't have a microphone with more than 2 channels to test this.

SleeeepyZhou and others added 2 commits February 7, 2025 11:38
Co-authored-by: Hugo Locurcio <[email protected]>
Co-authored-by: Hugo Locurcio <[email protected]>
@goatchurchprime
Copy link
Contributor

Looks good to me on principle, but I don't have a microphone with more than 2 channels to test this.

It's almost as if we need an input channel overriding version of #103655 to make it possible to test.

@fire
Copy link
Member

fire commented Apr 15, 2025

I'll try to ask on my mailing list if anyone knows the industry practices with non mono mics.

Edited:

I'll try to reply by the end of the week.

@JordanKlooster
Copy link

Found this after writing my own solution.

I built it on my device (where the 4 channel mic was making things not work at all) and it works.

@matbeedotcom
Copy link

Looks good to me on principle, but I don't have a microphone with more than 2 channels to test this.

It's almost as if we need an input channel overriding version of #103655 to make it possible to test.

Would you like me to make you a multi-channel virtual audio input device? Otherwise I can send you a small DIY 4-channel microphone array prototype to test with real hardware.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Projects

None yet

9 participants