をオーディオサンプルを再生するには、私はNAudioを通じて抽出されたオーディオサンプルを持って、私はパラメータを知っている:純どのように直接
- チャンネル
- サンプルあたりのバイト数、再生するためにどのよう
- サンプルレート
を.Net api /その他の.Netライブラリを使用してサンプルします。
ここでコード:
openFileDialog1.ShowDialog();
using (var reader = new Mp3FileReader(openFileDialog1.FileName))
{
var pcmLength = (int)reader.Length;
var _leftBuffer = new byte[pcmLength/2];
var buffer = new byte[pcmLength];
var bytesRead = reader.Read(buffer, 0, pcmLength);
int index = 0;
for (int i = 0; i < bytesRead; i += 4)
{
//extracting only left channel
_leftBuffer[index] = buffer[i];
index++;
_leftBuffer[index] = buffer[i + 1];
index++;
}
// How to play _leftBuffer (Single channel, 2 bytes per sample, 44100 samples per secound)
}
のための私の答えhttp://stackoverflow.com/questions/1284322/playing-a-wav-file- in-net/20010577#20010577はNAudioを使ってファイルを再生します。 – Pat