I am using the Microsoft Azure Kinect DK sensor for a university research project. I am trying to access the microphone data (in dB) heard from each channel. I need this data to further write a delay-and-sum algorithm with it.
I currently have tried many things. Here is the basics of what I have:
FORMAT = pyaudio.paInt16 # We use 16bit format per sample
CHANNELS =7
RATE =16000
CHUNK = 1024 # 1024bytes of data red from a buffer
RECORD_SECONDS = 0.1
WAVE_OUTPUT_FILENAME = "output.wav"
p = pyaudio.PyAudio()
stream = p.open(
format=FORMAT,
channels=CHANNELS,
rate=RATE,
input=True)
frames = []
for i in range(0, int(RATE / CHUNK * RECORD_SECONDS)):
data = stream.read(CHUNK)
a0 = np.fromstring(data,dtype=np.int16)[0::7]
a = a0.tostring()
frames.append(a)
This would theoretically grab the data from the first channel but I keep getting the error "invalid number of channels".
Any help would be appreciated,
Thanks!