Audio Capture, Mono wav File?

Hello guys, I’m using the new Audio Capture component to record user voice and save it as a .wav file with the following blueprint setup.

The resulting wav file is a Stereo wav file with 48000Hz Sampling Rate and 16 bit however I need it to be a Mono wav file with just one channel instead of 2. I have been looking for any options in the Submix, Attenuation and Audio Capture but no hope to make the recorded wav a Mono. Can anyone help with this ?

1 Like

I managed to convert the recorded wav file from Stereo to Mono. I had to learn about how a .wav file is stored in bytes and change the file header values. I also ignored the right stereo channel and just wrote the left channel in my new .wav file. I implemented a c++ function to handle this

void :StereoToMono(TArray<uint8> stereoWavBytes, TArray<uint8>& monoWavBytes)
{
	//Change wav headers
	for (int i = 0; i < 44; i++)
	{
		//NumChannels starts from 22 to 24
		if (i == 22)
		{
			short NumChannels = (*(short*)&stereoWavBytes[i]) / 2;
			monoWavBytes.Append((uint8*)&NumChannels, sizeof(NumChannels));
			i++;
		}
		//ByteRate starts from 28 to 32
		else if (i == 28)
		{
			int ByteRate = (*(int*)&stereoWavBytes[i]) / 2;
			monoWavBytes.Append((uint8*)&ByteRate, sizeof(ByteRate));
			i += 3;
		}
		//BlockAlign starts from 32 to 34
		else if (i == 32)
		{
			short BlockAlign = (*(short*)&stereoWavBytes[i]) / 2;
			monoWavBytes.Append((uint8*)&BlockAlign, sizeof(BlockAlign));
			i++;
		}
		//SubChunkSize starts from 40 to 44
		else if (i == 40)
		{
			int SubChunkSize = (*(int*)&stereoWavBytes[i]) / 2;
			monoWavBytes.Append((uint8*)&SubChunkSize, sizeof(SubChunkSize));
			i += 3;
		}
		else
		{
			monoWavBytes.Add(stereoWavBytes[i]);
		}
	}

	//Copies only the left channel and ignores the right channel
	for (int i = 44; i < stereoWavBytes.Num(); i += 4)
	{
	     monoWavBytes.Add(stereoWavBytes[i]);
         monoWavBytes.Add(stereoWavBytes[i+1]);
	}
}
1 Like

Excuse me Zexus: Submix Effect Preset and Submix to Record, how do you get the two variables

290311-2.png

They are basic classes that I created from the ‘New’ in the Content Browser so just create them and reference them in your Blueprints as far as I remember

Thanks ,u help me a lot!