Eksportuj dźwięk
Po zaimportowaniu fali dźwiękowej możesz chcieć wyeksportować ją do pamięci lub do pliku. Plugin zapewnia funkcjonalność eksportowania dźwięku w różnych formatach, z opcjami nadpisania częstotliwości próbkowania (próbkowanie ponowne) i liczby kanałów (miksowanie).
Obsługiwane formaty dźwięku
Plugin obsługuje eksport do następujących formatów dźwięku:
- WAV - Waveform Audio File Format
- OGG VORBIS - Kontener Ogg z dźwiękiem Vorbis
- OGG OPUS - Kontener Ogg z dźwiękiem Opus
- BINK - Bink Audio (tylko Windows x64, Mac i Linux w UE >= 5.0)
- RAW (PCM) - Nieskompresowane dane dźwiękowe modulacji kodowo-impulsowej (Int8, UInt8, Int16, UInt16, Int32, UInt32, Float32)
Przykłady
- 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
}));