Xuất Âm Thanh
Sau khi nhập một sóng âm thanh, bạn có thể muốn xuất nó ra bộ nhớ hoặc một tệp tin. Plugin cung cấp chức năng xuất âm thanh ở nhiều định dạng khác nhau, với các tùy chọn để ghi đè tốc độ lấy mẫu (resampling) và số lượng kênh (mixing).
Các định dạng âm thanh được hỗ trợ
Plugin hỗ trợ xuất ra các định dạng âm thanh sau:
- WAV - Định dạng tệp âm thanh dạng sóng
- OGG VORBIS - Vùng chứa Ogg với âm thanh Vorbis
- OGG OPUS - Vùng chứa Ogg với âm thanh Opus
- BINK - Âm thanh Bink (Windows x64, Mac và Linux trong UE >= 5.0)
- RAW (PCM) - Dữ liệu âm thanh Điều chế Xung Mã không nén (Int8, UInt8, Int16, UInt16, Int32, UInt32, Float32)
Ví dụ
- 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
}));