Confused about new Audio Capture Component usage in 4.19

I’m playing around with some of the new audio goodness in 4.19 preview 2 and exploring avenues for microphone processing. Specifically, I’m wanting PCM data from a microphone to be used in a custom VOIP solution. It doesn’t interact with UE4’s built-in VOIP system in any way.

There are two routes I’ve tried: using a Media Sound Component, and an Audio Capture Component.

The Media Sound component requires a bit more work to enumerate and Open the audio capture stream for the microphone, but it seems to work. I’m printing the envelope value and it behaves as it should.

Similar story with the Audio Capture Component – the envelope reacts as expected.

The next step would be to write a custom Source Effect to add to the chain which would receive and process the captured audio.

The problem is that in both cases I can hear the captured audio out of my speakers. I assume all this audio is being consumed by the new audio mixer and output as a normal sound. This is not my intended behavior – I want to capture this audio for processing only, and not output it to the final mix.

I’ve tried muting the sound but anything that quiets the sound also affects the detected envelope. If I’m understanding correctly, this makes sense – anything connected to the source effect chain needs real audio to ‘hear’, but I basically want to kill the sound immediately after the source effect chain is processed and before it enters the rest of the sound system to be processed (spatialized, etc) and output.

Am I barking up the wrong tree completely? I can’t help but think that even if I zeroed out the audio in the source effect, there is a considerable amount of unnecessary processing happening for what could be a simple capture straight to memory. It may be that since I only want to capture (and not play back) audio, avoiding a synth component and going straight for platform-dependent capture is the cleanest route.

I looked briefly at Audio Recording Manager, but it seems steeped in Sequencer and intended for output to a file, which is not what I’m after.

I’m very new to audio in UE4 in general, let alone the new audio mixer, so I may have a gross misunderstanding of what is going on. Any wisdom is appreciated!

… snip …

You’ll want 0-out the audio on the source effect if you don’t any audio to go to the output for the audio capture component, that will effectively mute it after your source effect is processed.

Edit, something like this in the ProcessAudio callback:

for (int32 Sample = 0; Sample < InData.AudioFrame.Num(); ++Sample)
{
    OutData.AudioFrame[Sample] = 0.0f;
}

That said, if you’d prefer a direct C+±only route to get mic audio and bypass the audio engine entirely, you can use the FAudioCaptureSynth class, which is the thing the MicCapture component uses. This is a very basic wrapper around RtAudio currently, but we will be implementing other backends as Mic-capture is needed.

Why does UAudioCaptureComponent basically make its publicly-available parent methods (particularly ::OnGenerateAudio, ::OnBeginGenerate, and ::OnEndGenerate) all private? UAudioCaptureComponent isn’t a huge class or anything, just curious why that choice was made.

I got this working thru blueprint in 4.21 but my question is i want to be able to record without hearing my voice in the speakers while i record. Can someone assist me on this please?
Much Appreciated

I know your doing it in C++ but if you want to take a look at what i did here are a few snippets:

  1. Activate the New Audio Sound Mixer by going to D:\Program Files\Unreal Engine\UE_4.21\Engine\Config\Windows (Where ever your instal is located) look for WindowsEngine.ini

Uncomment AudioDeviceModuleName=AudioMixerXAudio2 & Comment ;AudioDeviceModuleName=XAudio2 as stated in the highlighted area. Not sure if it’s the same procedure for IOS, Anfroid Etc. But works for Windows.

  1. Add AudioCaptureCompnent to which ever actor or Logic your making
  2. Add NewSoundSubMix ( Right click in content browser : Sound > SoundSubmix Open and set to your liking
  3. Add Created SoundSubMix in AudioCaptureCompnent settings. Effects section as show.

  1. In the Finish Recording SubMix Output Name= Whatever name you want to give your file (file to save eg., Wav File) Path= The absolute Location where file will be saved (Considering Content folder being Root) and Exisiting Sound Wave to Overwrite= You can set this to the wav file you wish to overwrite otherwise leave blank.

I hope it helps. As this was my first attempt at it and it works. I just cant figure out how to record without hearing myself on the speakers.

I had the same problem and just now figured it out.
When you select your Audio Capture Component, check in the Details window under Effects is a checkbox “Output To Bus Only”.
Description: “Whether or not to only send this audio’s output to a bus. If true, this sound won’t be audible except through bus sends.”

Hope it helps.

Hi, I’m trying to solve the problem of hearing myself on the speakers. I tried to check that “Output to Bus Only”, but with that parameter checked the output file results empty.
May you help me?

How did you get this to work without hearing your own voice, it doesnt want to work no matter what i try, any ideas.?

I ended up using ffmpeg (externally, holy ffmpeg!) to record my voice…

How can i request at least a how to on this feature from the developer, i mean obviously im missing something and there isnt any documentation anywhere. does anyone know? or who to contact?

I would be curious how you did this :smiley: I can’t for the life of me figure out how to do this in C++ or in Blueprint. FWIW I’ve been using Blueprints this entire time, so I have no clue how the C++ stuff even works :frowning:

This thread keeps showing up in searches! Here’s a way to record mic silently using only blueprints: Audio Record from mic in Unreal Package - #8 by ArthurBarthur - Audio - Unreal Engine Forums

If im not mistaken you untick the Enable Base Submix in the Audio Capture Component in the details