3
的陣列我很新的n音訊,我需要輸入樣本的緩衝器從輸入裝置轉換爲double數組,範圍從-1到1n音訊輸入字節數組轉換爲雙打
我創建輸入設備如下:
WaveIn inputDevice = new WaveIn();
//change the input device to the one i want to receive audio from
inputDevice.DeviceNumber = 1;
//change the wave format to what i want it to be.
inputDevice.WaveFormat = new WaveFormat(24000, 16, 2);
//set up the event handlers
inputDevice.DataAvailable +=
new EventHandler<WaveInEventArgs>(inputDevice_DataAvailable);
inputDevice.RecordingStopped +=
new EventHandler(inputDevice_RecordingStopped);
//start the device recording
inputDevice.StartRecording();
現在,當「inputDevice_DataAvailable」回調函數被調用,我得到的音頻數據的緩衝區。我需要將這些數據轉換爲表示音量級別爲-1和1的雙打數組。如果任何人都可以幫我解決這個問題,那就太棒了。
謝謝你的工作。 – Rob 2010-10-15 04:21:54
max short = 32767,32767/32768f = 0.999969482421875。應該是:if(sample> 0)sample32 = sample/32767f;如果(sample <0)sample32 = sample/32768f; – zgnilec 2012-09-17 07:27:04