Skip to main content

Capturable sound wave

Overview

A capturable sound wave is derived from the streaming sound wave. It supports capturing audio data from input devices like a microphone and playing it back, with the same capabilities as an imported sound wave (including rewinding, usage in SoundCues, etc). You can even capture and play audio simultaneously without any limitations.

tip

For Voice Activity Detection (VAD), refer to this page.

note

The capturable sound wave automatically requests microphone permissions on iOS and Android once the capture is started.

Basic Usage

Creating a Capturable Sound Wave

First you should create a capturable sound wave.

Create Capturable Sound Wave node

warning

You should treat the capturable sound wave as a strong reference to prevent premature destruction (e.g. by assigning it to a separate variable in Blueprints or using UPROPERTY() in C++).

Getting Available Input Devices

To use this feature, you need to first get all available audio input devices that can be used for capturing.

Get Available Audio Input Devices node

Starting and Stopping Capture

After getting the available devices, you can start capturing audio data from the input device and stop it when needed.

Start and Stop capture nodes

info

DeviceId is the index of the device in the array of available devices obtained from the previous step.

Advanced Features

Muting and Unmuting Capture

You can choose to mute or unmute sound capture to prevent the accumulation of audio data without interrupting the capturing process.

Toggle Mute nodes

Performance Optimization

This is useful when switching capturing frequently since starting recording through StartCapture may cause minor hitches on the engine's side. You should first start the capture itself, and only then mute/unmute it.

If your aim is to eliminate a slight freeze, you could consider starting the capture during a time when this freeze might be negligible. For example, you could start the capture during the loading screen of your game, mute the capturable sound wave right after that, and then unmute the capturable sound wave when needed for capturing audio data without any hitches.

Complete Example

Here's a complete implementation example of using a capturable sound wave:

An example of using a capturable sound wave