【发布时间】:2021-03-01 23:03:07
【问题描述】:
我在我的项目中使用 Naudio 库,并且我已经使用它来组合 MP3 文件并使用它们。 我使用 Mp3FileReader(Stream) 将它们组合在一起,因此可以使用此对象从流中读取,但是当我尝试更改音频音高并按照他们的教程进行操作时,情况如下:
using (var reader = new MediaFoundationReader(inPath)) //only reads from file
{
var pitch = new SmbPitchShiftingSampleProvider(reader.ToSampleProvider());
using(var device = new WaveOutEvent())
{
pitch.PitchFactor = (float)upOneTone; // or downOneTone
// just playing the first 10 seconds of the file
device.Init(pitch.Take(TimeSpan.FromSeconds(10)));
device.Play();
while(device.PlaybackState == PlaybackState.Playing)
{
Thread.Sleep(500);
}
}
}
现在我的问题是 MediaFoundationReader 仅从文件中读取,是否有另一种方法可以从流中加载并更改音高/频率。
我们将不胜感激。
【问题讨论】:
标签: c# asp.net-core naudio