Exportar audio
Después de importar una onda de sonido, es posible que desees exportarla a la memoria o a un archivo. El complemento proporciona funcionalidad para exportar audio en varios formatos, con opciones para sobrescribir la frecuencia de muestreo (remuestreo) y el número de canales (mezcla).
Formatos de audio compatibles
El complemento admite la exportación a los siguientes formatos de audio:
- WAV - Waveform Audio File Format
- OGG VORBIS - Contenedor Ogg con audio Vorbis
- OGG OPUS - Contenedor Ogg con audio Opus
- BINK - Bink Audio (solo en Windows x64, Mac y Linux en UE >= 5.0)
- RAW (PCM) - Datos de audio sin comprimir con modulación por impulsos codificados (Int8, UInt8, Int16, UInt16, Int32, UInt32, Float32)
Ejemplos
- 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
}));