【发布时间】:2022-12-07 19:12:58
【问题描述】:
如何提高或降低音频文件的播放速度(音调应该改变)。我应该使用什么方法和库?现在我正在尝试NAudio,但据我所知,这个库没有我需要的功能。我也试过soundtouch,但我不明白它是如何工作的。
【问题讨论】:
如何提高或降低音频文件的播放速度(音调应该改变)。我应该使用什么方法和库?现在我正在尝试NAudio,但据我所知,这个库没有我需要的功能。我也试过soundtouch,但我不明白它是如何工作的。
【问题讨论】:
也许这样的事情适用于soundtouch。
// Open the audio file
var reader = new AudioFileReader("AudioFile.mp3");
// Create a new SoundTouch instance
var soundTouch = new SoundTouch();
// Set the playback speed
soundTouch.Rate = 1.5; // Play at 1.5x speed
// Set the input of the SoundTouch instance to the audio file reader
soundTouch.SetInput(reader);
// Create a new wave out to play the audio
var waveOut = new WaveOut();
// Use the SoundTouch instance as the wave out's source
waveOut.Init(soundTouch);
// Play the audio
waveOut.Play();
或者这个NAudio。
// Open the audio file
var reader = new AudioFileReader("AudioFile.mp3");
// Change the playback speed
reader.PlaybackRate = 1.5; // Play at 1.5x speed
// Create a new wave out to play the audio
var waveOut = new WaveOut();
// Use the audio file reader as the wave out's source
waveOut.Init(reader);
// Play the audio
waveOut.Play();
【讨论】:
reader.PlaybackRate。 “AudioFileReader”没有“PlaybackRate”的定义。我错过了一些using吗?