Skip to main content

Import audio

The process of importing audio at runtime can be broken down into several steps:

  1. Create a Runtime Audio Importer.
  2. Bind to the needed delegates (OnProgress and OnResult).
  3. Import audio from a file or buffer.
  4. Play the imported sound wave obtained from the OnResult delegate (more info is here).

Ensure that both Runtime Audio Importer and Sound Wave instances are not prematurely garbage collected by maintaining a hard reference to them, which can be done by assigning them to separate variables using UPROPERTY(), TStrongObjectPtr, or any other method that prevents the object from being destroyed.

Blueprints example

First, you need to create a Runtime Audio Importer object. You should ensure it is treated as a strong reference by the garbage collector, which can be achieved by placing it as a separate variable in Blueprints. This prevents premature destruction of the object.

Create Runtime Audio Importer node


To track the progress of importing audio data, you can bind to the OnProgress (Blueprints) / OnProgressNative (C++) delegate. This will allow you to monitor the progress and, for example, implement a loading screen. To bind to this delegate, you can simply pull the event pin from the bind event node.

An example of binding to the On Progress delegate


To be notified when the audio data import process is complete and to access the reference of the resulting sound wave, you must bind to the OnResult (Blueprints) / OnResultNative (C++) delegate. Also, make sure the imported sound wave is treated as a strong reference by the garbage collector to prevent unwanted premature garbage collection. This can be done by placing it as a separate variable in Blueprints.

An example of binding to the On Result delegate


Begin the audio import process by calling the relevant function, which can handle both compressed and uncompressed audio data formats.

Import Audio nodes examples


Once the import process is complete, the resulting imported sound wave can be obtained through the OnResult delegate.

Full example

Full example