[FEATURE REQUEST] Node to convert a stereo sound to mono please.

Required to turn stereo weapon sounds into mono for the purpose of distance and direction.

I’m not really sure what the purpose of such a node would be when converting a sound to mono takes all of a few seconds in any halfway reasonable DAW or audio editor.

Unless you’re talking about folding a stereo sound down to mono once it hits a certain distance threshold, in which case you’re probably better using separate sounds for your player-character’s weapon and a pre-processed mono version for all NPCs - folding a sound to mono without due care can cause phasing issues, volume discrepancies etc and will likely alter the character of a given sound. Eitherway, what you suggest is a pretty hacky way to achieve directionality in regards to SFX, will likely sound bad and will waste CPU cycles on unnecessary DSP.

Sorry if that sounds overly dismissive, but I had to do a lot of work converting stereo effects to mono on a previous project and it’s a lot more fiddly and in-depth than it initially appears.

Stereo sound attenuation works now, no need for mono files

So one can now do “directional” sound using stereo audio clips?

I am pretty sure you can, but test it first.

You can’t, it doesn’t make sense for a stereo sound to be spatialized, in real life sources of sound are mono, the spatialization effect comes from the difference in volume in each ear, since stereo already has a channel for each ear, it can’t work.
I could be wrong on this, but I would imagine most sound in games should be mono apart from music, UI sounds, ambient sounds, and cutscene specific sounds. (edit: at least for a 3D game)

There is something that could work. Although Im not sure if this would work in “real time”.
It is possible to encode spatial information in the difference between the stereo channels.
A company named DOLBY invented it and called it “Dolby Sourround” (and a later improvement “Dolby Sourround Pro Logic”).

The problem would be modifying the stereo signal on the fly to encode the desired spatial effect. :wink:

OK just tested and UE4.14 now takes into consideration both direction and distance using a stereo sample.

bool FSoundConverter::ConvertPcmToMono(const TArray<uint8>& InPcmData, const FCustomSoundInfo& InSoundInfo, TArray<uint8>& OutMonoPcmData)
{
	if ( !InSoundInfo.IsValid() )
	{
		UE_LOG(LogSoundCL, Error, TEXT("%s -- InSoundInfo isn't Valid!"), *FString(__FUNCTION__));
		return false;
	}

	const SIZE_T SampleSize = InSoundInfo.NumChannels * (InSoundInfo.BitsPerSample / 8) ;
	const SIZE_T MonoSampleSize = SampleSize / InSoundInfo.NumChannels;
	
	for (SIZE_T i = 0; i < InSoundInfo.SamplesDataSize; i += SampleSize)
	{
		OutMonoPcmData.Append( TArray( &(InPcmData[i + SampleSize - MonoSampleSize] ), MonoSampleSize ));
	}

	return (OutMonoPcmData.Num() > 0);