Экспорт аудио
После импорта звуковой волны может потребоваться экспортировать её в память или файл. Плагин предоставляет функциональность для экспорта аудио в различных форматах, с возможностью переопределения частоты дискретизации (ресемплинг) и количества каналов (миксинг).
Поддерживаемые аудиоформаты
Плагин поддерживает экспорт в следующие аудиоформаты:
- WAV - Waveform Audio File Format
- OGG VORBIS - Контейнер Ogg с аудио Vorbis
- OGG OPUS - Контейнер Ogg с аудио Opus
- BINK - Bink Audio (только Windows x64, Mac и Linux в UE >= 5.0)
- RAW (PCM) - Несжатые аудиоданные в формате Pulse-Code Modulation (Int8, UInt8, Int16, UInt16, Int32, UInt32, Float32)
Примеры
- Blueprint
- C++
// Assuming ImportedSoundWave is a UE reference to a UImportedSoundWave object (or its derived type, such as UStreamingSoundWave, UCapturableSoundWave, etc.)
// Export the sound wave to a file
URuntimeAudioExporter::ExportSoundWaveToFile(ImportedSoundWave, TEXT("C:/ExportedAudio.ogg"), ERuntimeAudioFormat::OggVorbis, 100,
FRuntimeAudioExportOverrideOptions(),
FOnAudioExportToFileResultNative::CreateWeakLambda(this, [this](bool bSucceeded)
{
// Handle the result
}));
// Export the sound wave to a RAW file
URuntimeAudioExporter::ExportSoundWaveToRAWFile(ImportedSoundWave, TEXT("C:/ExportedAudio.raw"), ERuntimeRAWAudioFormat::UInt16,
FRuntimeAudioExportOverrideOptions(),
FOnAudioExportToFileResultNative::CreateWeakLambda(this, [this](bool bSucceeded)
{
// Handle the result
}));
// Export the sound wave to a buffer
URuntimeAudioExporter::ExportSoundWaveToBuffer(ImportedSoundWave, ERuntimeAudioFormat::Wav, 100,
FRuntimeAudioExportOverrideOptions(),
FOnAudioExportToBufferResultNative::CreateWeakLambda(this, [this](bool bSucceeded, const TArray64<uint8>& AudioData)
{
// Handle the result
}));
// Export the sound wave to a RAW buffer
URuntimeAudioExporter::ExportSoundWaveToRAWBuffer(ImportedSoundWave, ERuntimeRAWAudioFormat::Float32,
FRuntimeAudioExportOverrideOptions(),
FOnAudioExportToBufferResultNative::CreateWeakLambda(this, [this](bool bSucceeded, const TArray64<uint8>& AudioData)
{
// Handle the result
}));