を偏析複数チャネル管理\ Iは、単一のチャネルデータを計算する(チャネル1と4との間のオーディオ相互相関を計算するために)このコード:PyAudio -
その生を仮定import time
import numpy as np
import pyaudio
import scipy
from scipy import signal, fftpack
pyaud = pyaudio.PyAudio()
#open the stream
stream = pyaud.open(
format = pyaudio.paInt16,
channels = 4,
rate = 16000,
input_device_index = 4,
output = False,
input = True,
frames_per_buffer=2048,)
while True:
rawsamps = stream.read(2048)
samps = np.fromstring(rawsamps, dtype=np.int16)
frames_per_buffer_length = len(samps)/4 #(channels)
assert frames_per_buffer_length == int(frames_per_buffer_length)
samps = np.reshape(samps, (frames_per_buffer_length, 4)) #4 channels
データはインターリーブされます。
これは私が使用する必要がある関数です。
signal.correlate(n1, n2, mode='full')
は、どのように私は、相関関数を使用するために、各チャネルのデータの配列を作成することができますか?コードの最後の行は正しいですか?
あなたは
あなたは同じ質問をしているようです(http://stackoverflow.com/q/41922139/)再び/stackoverflow.com/q/42027487/)。私はNumPyについていくつかの基本を学びます(オンラインで利用できる良いチュートリアルがたくさんあります)。あなたは[this](http://nbviewer.jupyter.org/github/mgeier/python-audio/blob/master/simple-signals.ipynb)と[that](http:// nbviewer .jupyter.org/github/mgeier/python-audio/blob/master/audio-files/audio-files-with-wave.ipynb)。 – Matthias
これを済ませたら、前に見た[example](https://github.com/spatialaudio/python-sounddevice/blob/master/examples/plot_input.py)をもう一度見ることができます。 – Matthias