Skip to content

Conversation

@Joseph-DiGiovanni
Copy link
Contributor

@Joseph-DiGiovanni Joseph-DiGiovanni commented May 11, 2025

This PR replaces the limiting mix_target options of AudioStreamPlayer with more granular output_channels. For example, it is currently not possible to output to only the rear speakers, or only one side. This change allows audio to be output to any combination of speakers, or even just a single one.

In addition, I've added a downmix option which will take the desired output channels and use a standard downmixing equation to best preserve positional audio when using an output device with fewer channels. This is enabled by default, but can be disabled to only play audio when the desired channel is available. A good use case for disabling it would be a speaker test.

Screenshot From 2025-05-10 23-22-01

While a majority of the work is done, I need some assistance properly removing mix_target in favor of output_channels to not break existing projects. The conversion should be straightforward, but I'm not familiar with that process at all unfortunately.

@Joseph-DiGiovanni Joseph-DiGiovanni requested review from a team as code owners May 11, 2025 04:57
@Joseph-DiGiovanni Joseph-DiGiovanni force-pushed the audio-stream-player-output-channels branch 2 times, most recently from ae568dc to cb52adb Compare May 11, 2025 05:10
@AThousandShips AThousandShips added this to the 4.x milestone May 11, 2025
@Joseph-DiGiovanni Joseph-DiGiovanni force-pushed the audio-stream-player-output-channels branch from cb52adb to 7dde803 Compare May 11, 2025 14:41
@Joseph-DiGiovanni
Copy link
Contributor Author

It seems documentation translations also need to be removed/updated. Any advice for that would be appreciated as well as I'm also unfamiliar with that process.

@AThousandShips
Copy link
Member

Translations aren't handled here, but the way this breaks compatibility by removing properties is probably incorrect, and some comaptibility code should be added instead

@fkeyzuwu
Copy link
Contributor

Other than breaking compatibility, I feel like this is displaying too much info for the average user. The solution that first came to mind is adding a "Custom" Mix target, which would only then expose those inspector parameters.

@Joseph-DiGiovanni
Copy link
Contributor Author

Sorry, I fat fingered the close button 🙃

Can't say I'm opposed to the idea, but I'll have to look into how to implement conditional options.

@Mickeon
Copy link
Member

Mickeon commented May 11, 2025

Is there a corresponding proposal for this? If not, I would seriously recommend making one proper. This sounds like it has a very niche use-case.

@Joseph-DiGiovanni
Copy link
Contributor Author

It may be a niche use case, but to me its more questionable why stereo, center+LFE, and all speakers are the only options. It seems reasonable to expect a way to output to any audio channel and not have arbitrary groups.

@DaGiHu
Copy link

DaGiHu commented Aug 25, 2025

Considering the nature and philosophy of Godot I believe this is a must. As someone into audio and Godot I have for a long time longed for this . Please make it happen.

@DaGiHu
Copy link

DaGiHu commented Aug 26, 2025

I just had the chance to test this thanks to @Joseph-DiGiovanni. This is truly useful not just for games but for other applications made with Godot where multiple channel audio requires a total control. It is so simple to use and works solid and flawless out of the box that sincerely, I could not understand not having this in Godot, it opens a new world of possibilities.

In order to avoid breaking compatibility issues I propose this arrangement in the interface for the proposal controls (marked by the red bracket in the image) not removing any of the original AudioStreamPlayer node options. The new Mix Channel Override section, if used, would override the spared Mix Target option enabling sound redirection to specific channels and thus preventing breaking applications created in former releases.

image

@Joseph-DiGiovanni Joseph-DiGiovanni force-pushed the audio-stream-player-output-channels branch from 7dde803 to b058065 Compare August 27, 2025 03:59
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Projects

None yet

Development

Successfully merging this pull request may close these issues.

5 participants