Audio Metadata
This page provides utilities for analyzing audio files without fully importing them, which is more efficient for retrieving basic information.
Audio header information
To obtain basic audio header information (metadata) from audio data, consider using the following functions as they are more cost-effective than the full process of importing the audio into a sound wave.
- Blueprint
- C++
// From file
URuntimeAudioUtilities::GetAudioHeaderInfoFromFile(TEXT("C:/Folder/Audio.ogg"),
FOnGetAudioHeaderInfoResultNative::CreateWeakLambda(this, [this](bool bSucceeded, const FRuntimeAudioHeaderInfo& HeaderInfo)
{
// Handle the result
}));
// From buffer
// Assuming AudioData is an array of audio data (such as MP3)
TArray64<uint8> AudioData;
URuntimeAudioUtilities::GetAudioHeaderInfoFromBuffer(AudioData,
FOnGetAudioHeaderInfoResultNative::CreateWeakLambda(this, [this](bool bSucceeded, const FRuntimeAudioHeaderInfo& HeaderInfo)
{
// Handle the result
}));
Audio format detection
To manually determine the audio data format, you have two options. The first is based on file extension recognition, while the second method involves analyzing the audio data, which is more accurate but requires loading the audio data into memory. Note that the process is automatically performed during the import stage, so manual intervention is not necessary.
- Blueprint
- C++
// From file
const TArray<ERuntimeAudioFormat> AudioFormats = URuntimeAudioUtilities::GetAudioFormats(TEXT("C:/Folder/Audio.ogg"));
// From buffer
// Assuming AudioData is an array of audio data (such as OGG)
TArray64<uint8> AudioData;
const TArray<ERuntimeAudioFormat> AudioFormats = URuntimeAudioUtilities::GetAudioFormatsAdvanced(AudioData);