Exportar áudio
Após importar uma onda sonora, você pode querer exportá-la para a memória ou para um arquivo. O plugin fornece funcionalidade para exportar áudio em vários formatos, com opções para substituir a taxa de amostragem (resampling) e o número de canais (mixagem).
Formatos de áudio suportados
O plugin suporta exportação para os seguintes formatos de áudio:
- WAV - Waveform Audio File Format
- OGG VORBIS - Contêiner Ogg com áudio Vorbis
- OGG OPUS - Contêiner Ogg com áudio Opus
- BINK - Bink Audio (Windows x64, Mac e Linux apenas em UE >= 5.0)
- RAW (PCM) - Dados de áudio Pulse-Code Modulation não comprimidos (Int8, UInt8, Int16, UInt16, Int32, UInt32, Float32)
Exemplos
- 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
}));