オーディオのエクスポート
サウンドウェーブをインポートした後、メモリやファイルにエクスポートしたい場合は、サポートされているフォーマットのいずれかにすることができます: OGG VORBIS, OGG OPUS WAV, BINK, RAW (PCM)。必要に応じて、サンプルレートをオーバーライド(つまりリサンプル)したり、チャネル数を変更(つまりミックス)することもできます。
BINKフォーマットへのエクスポートは、UE >= 5.0 の Windows x64、Mac、Linux でのみサポートされています。
- 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
}));