我有一系列 44 kHz 16 位双通道未压缩波形文件(从资源中读取),并希望应用淡出和淡入效果来从所有WAV文件的序列中创建一个流。
资源读取和获取 16 位波流发生正确。目标格式也显示正确,但我acmnotpossible
在下面的波形覆盖步骤中一直出现异常。我究竟做错了什么?
String ResToPlay2 = NameSpaceString + ".Resources." + inWave2 + ".wav";
Stream _audioStream2;
int wavdur2 = 0;
Double fadeDurDbl2 = 0;
int fadeDur2 = 0;
if (!resA.GetManifestResourceStream (ResToPlay2).Equals (Stream.Null))
{
_audioStream2 = resA.GetManifestResourceStream (ResToPlay2);
WaveStream wavePCMStream2 = WaveFormatConversionStream.CreatePcmStream (new WaveFileReader (_audioStream2));
WaveFormat targetFmt2 = new WaveFormat (44100, 32, 2);
WaveStream waveStream2 = new WaveFormatConversionStream(targetFmt2,wavePCMStream2);
using (waveStream2)
{
wavdur2 = (int) waveStream2.TotalTime.Milliseconds;
var fader2 = new FadeInOutSampleProvider(new WaveToSampleProvider(waveStream2));
fadeDurDbl2 = (wavdur2*OverlapPCT) / 100;
fadeDur2 = (int) Math.Round(fadeDurDbl2, 0);
fader2.BeginFadeIn (fadeDur2);
var stwp2 = new NAudio.Wave.SampleProviders.SampleToWaveProvider (fader2);
WaveFileWriter.CreateWaveFile (Application.StartupPath + "\\" + "fadedIn_?.wav", stwp2);
}
}