Skip to content

[Core] [FMOD] Neutral panning when source is close to listener#559

Open
Schroedingers-Cat wants to merge 2 commits intoValveSoftware:masterfrom
Schroedingers-Cat:improve/neutral-panning-when-source-is-close
Open

[Core] [FMOD] Neutral panning when source is close to listener#559
Schroedingers-Cat wants to merge 2 commits intoValveSoftware:masterfrom
Schroedingers-Cat:improve/neutral-panning-when-source-is-close

Conversation

@Schroedingers-Cat
Copy link
Copy Markdown
Contributor

This PR fixes #557.

The calculateRelativeDirection() function returns kYAxis when the distance between source and listener is smaller than 0.00001 which causes Steam Audio to render the sound from the left on a speaker array. While there is no right answer to the situation that source and listener are at exactly the same position, generally returning Steam Audio's front vector will lead to more neutral results. One such example is previewing sound events in a middleware like FMOD Studio where the listener defaults to the source's location.

As an additional safety measure, the Steam Audio Spatializer (FMOD) now checks if the source and listener are at exactly the same position and nudges the source 0.0001 to the listener's front. That nudging though is a magic number depending on another magic number from the core library, so should someone change the threshold in the core library to something like 0.01, it won't be effective anymore.

When source and listener are close, api_geometry::calculateRelativeDirection would return Vector3f::kYAxis, which results in a sound panned fully left. This is a common situation, for example in the editor context of FMOD Studio. A better default value therefore is the forward direction of a right-handed coordinate system, resulting in sounds panned to the center (front) which is more neutral when no positional context has been established yet.
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.

[FMOD/Core] Sound comes from left side when listener and source are roughly at the same position

1 participant