0
私は、2つのストリーミングオーディオ信号間のタイムシフトを検出するプロジェクトを進めています。私はpython3、Pyaudioで作業し、ステレオ入力をとるNeumann KU-100マイク付きのMotux828サウンドカードを使用しています。だから、私がinput_device_index
をチェックすると、私はMOTUサウンドカードに接続されている4番目の正しいものです。私は記録するときサウンドカードを使ったPayaudio録音wavファイルに空の録音があります
しかし:
import time
import pyaudio
import wave
CHUNK = 1024 * 3 # Chunk is the bytes which are currently processed
FORMAT = pyaudio.paInt16
RATE = 44100
RECORD_SECONDS = 2
WAVE_OUTPUT = "temp.wav"
p = pyaudio.PyAudio()
stream = p.open(format=FORMAT,channels=2,rate=RATE,input=True,frames_per_buffer=CHUNK,input_device_index=4)
frames = [] # np array storing all the data
for i in range(0, int(RATE/CHUNK * RECORD_SECONDS)):
data = stream1.read(CHUNK)
frames.append(data1)
stream.stop_stream()
stream.close()
p.terminate()
wavef = wave.open(WAVE_OUTPUT, 'wb') # opening the file
wavef.setnchannels(1)
wavef.setsampwidth(p.get_sample_size(FORMAT))
wavef.setframerate(RATE)
wavef.writeframes(b''.join(frames1)) # writing the data to be saved
wavef.close()
私は(自然に)ほとんどノイズで、無音で
をwaveファイルを記録また、私は特定して、サードパーティのソフトウェアを記録することができますマイクロフォン。 完全にうまく動作します。
注: サウンドカードは、24ビットの深さは、通常、私はまた、純粋なノイズの波ファイルを記録paInt24
を試している
間違った入力デバイス、一部欠落している 'サブindex'、入力channellどこにリダイレクト?使用する前に入力デバイスを管理する必要があります.linuxで 'ALSA'にリダイレクトする必要があります。 – dsgdfg
[plot_input.py](https://github.com/spatialaudio/python-sounddevice/blob/master/examples/plot_input.py)を使用して、実際に入力デバイスに信号があるかどうかを確認できます。 – Matthias