0
我按照在不同的線程如何錄製和播放MP3,但我還是總能得到這個例外試圖播放,我已經錄製的MP3文件:錄音和播放MP3音頻
mp3filereader does not support sample rate changes
因此,這裏是我的代碼記錄:
waveInStream = new WaveIn();
waveInStream.WaveFormat = new WaveFormat(8000, 16, 1);
writer = new WaveFileWriter(outputfileName, waveInStream.WaveFormat);
waveInStream.DataAvailable += new EventHandler<WaveInEventArgs>(waveInStream_DataAvailable);
waveInStream.StartRecording();
的waveInStream_DataAvailable是:
void waveInStream_DataAvailable(object sender, WaveInEventArgs e)
{
writer.Write(e.Buffer, 0, e.BytesRecorded);
}
此時將R生態文件應該是PCM無壓縮的權利?
在播放它之前是否需要將其轉碼爲MP3?
我的演奏代碼:
WaveChannel32 inputStream;
WaveStream mp3Reader = new Mp3FileReader(fileName); var pStream = NAudio.Wave.WaveFormatConversionStream.CreatePcmStream(mp3Reader);
inputStream = new WaveChannel32(mp3Reader);
volumeStream = inputStream;
return volumeStream;
發生異常時,每次在Mp3FileReader
電話,說是這樣的:
Got a frame at sample rate 44100, in a MP3 sample rate 32000
Mp3FileReader does not support sample rate change
是的謝謝馬克。我實際上切換到了16K,16b,Mono並使用Lame進行編碼。它完美的作品。 – blop 2013-02-25 09:12:41