Avoiding unwanted merging effect when played at the same time in 3D mode

Why does playing the same sound with different positions at the same time result in only one sound in the middle position?

The code below correctly plays the same sound in two separate positions.
But if I remove the sleep line, FMOD plays just one sound as I commented.

FMOD_Sound_Set3DMinMaxDistance(g_Sound, 5000.0f, 10000.0f);

{
	FMOD_VECTOR pos = { -5000.0f, 0.0f, 0.0f };
	FMOD_CHANNEL* channel;

	FMOD_System_PlaySound(g_System, g_Sound, NULL, TRUE, &channel);
	FMOD_Channel_Set3DAttributes(channel, &pos, NULL);
	FMOD_Channel_SetPaused(channel, FALSE);
}
{
	// Without this line, two sounds are merged into a single one at the center.
	std::this_thread::sleep_for(std::chrono::microseconds(1));

	FMOD_VECTOR pos = { +5000.0f, 0.0f, 0.0f };
	FMOD_CHANNEL* channel;

	FMOD_System_PlaySound(g_System, g_Sound, NULL, TRUE, &channel);
	FMOD_Channel_Set3DAttributes(channel, &pos, NULL);
	FMOD_Channel_SetPaused(channel, FALSE);
}

I don’t know if this is the expected result mathematically, or acoustically, or if FMOD is designed that way for efficiency.
And, yes, this won’t happen most of the time in most games, because most sounds will be triggered by user input at runtime.
But in some special cases, this can be a problem.

Let’s imagine a music game that allows users to write their songs.
Let’s say it can also load MIDI files and play the notes with user sound files.
Then there may be high chances of playing multiple sounds at the exact same time.
In this case, if a user tries to play the same sound in different positions at the same time, it won’t work as the user expected.

Also, I recently came up with some interesting ideas but it’s only possible when the same sound in different multiple positions can travel around me (listener).

Is there a way to avoid this unwanted merging effect other than the above sleep trick?

This is the expected result acoustically. If you are exactly between two speakers and the same sound is played at the same time, those two sounds will be perceived as a single mono sound. In this case, your thread sleep is delaying the start time of your second sound, causing it to be out of phase with your first sound and creating a more noticeable difference.
Further modifying the symmetry of either channel in any way will prevent this merging effect from occurring. Perhaps randomizing the pitch ever so slightly with Channel::setPitch would be a good way to ensure some audible distinction between each playing sound. Otherwise, if the player was moving in 3D space while both sounds were playing then each sound would still be perceived as distinct, even if they crossed over the nexus between these two sounds at some point in time.

1 Like