Python中分别读取左右声卡通道
我希望用 python 开发一个应用程序,它能够从声卡读取数据(想想工程波形分析)。我需要能够分别读取左通道和右通道。
使用 pyAudio,我们可以选择单声道或立体声:
pa = pyaudio.PyAudio()
_stream = pa.open(format=pyaudio.paInt16, channels=1, rate=SAMPLING_RATE,
input=True, frames_per_buffer=NUM_SAMPLES)
有人知道单独访问每个通道的方法吗?
谢谢
I wish to develop an application in python which is able to read in data from a soundcard (think engineering waveform analysis). I need to be able to read in the left channel and right channel in separately.
Using pyAudio, we are able to either select mono or stereo:
pa = pyaudio.PyAudio()
_stream = pa.open(format=pyaudio.paInt16, channels=1, rate=SAMPLING_RATE,
input=True, frames_per_buffer=NUM_SAMPLES)
Is anyone aware of a way to reach each channel individually?
Thanks
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。
绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(1)
我只见过这样的情况:两个通道作为交错流一起读取,然后分开。这是一种常见的方法,而且很容易做到,而且我也无法想象有什么好的理由以其他方式做到这一点。
I've only ever seen this done where both channels are read together as an interleaved stream, and then split. This is a common approach and easy to do, and I also can't quite imagine a good reason to do it any other way.