【发布时间】:2015-04-10 20:38:55
【问题描述】:
我正在尝试将 WasapiLoopbackCapture 的输出从我的声卡 44100Hz, 16bit, 2 channel 波形重新采样为 16000Hz, 16bit, 1 channel 格式,以便以后在 System.Net.Sockets.NetworkStream 中使用(我想将转换后的字节写入网络流)
但我什至不知道如何开始! 我对信号处理真的很陌生,我已经尝试过搜索教程,但我无法理解如何做到这一点。
这是我目前得到的:
void StartRecording()
{
capture = new WasapiLoopbackCapture(device); // device is an audiodevice picked from the user. speaker, headphones etc
capture.ShareMode = NAudio.CoreAudioApi.AudioClientShareMode.Shared;
capture.DataAvailable += capture_DataAvailable;
capture.RecordingStopped += capture_RecordingStopped;
capture.StartRecording();
}
void capture_DataAvailable(object sender, WaveInEventArgs e)
{
outputStream.Write(e.Buffer, 0, e.BytesRecorded); // here I want to output audio to the NetworkStream.
// But I have to resample it first, which brings me to my question.
}
我基本上想知道的是如何获得一个经过重新采样并准备好运送到网络流另一端的字节数组! 任何建议都非常感谢!提前谢谢你。
【问题讨论】:
-
@HansPassant 我需要什么方法才能输入一个字节数组并重新采样?
标签: c# signal-processing naudio resampling