coqui-ai / STT-examples

🐸STT integration examples
https://github.com/coqui-ai/STT
Mozilla Public License 2.0
117 stars 45 forks source link

mic_vad_streaming.py freezes when trying to record 4 channels and convert to 1 channel. #47

Open Varuzhan97 opened 1 year ago

Varuzhan97 commented 1 year ago

`
def four_to_one(self, frame):

[ch1,ch2,ch3,ch4||ch1,ch2,ch3,ch4||ch1,ch2,ch3,ch4||ch1,ch2,ch3,ch4]

    frame = np.frombuffer(frame, np.int16)
    data = frame.reshape((self.CHANNELS,-1), order='F')
    b = 1/self.CHANNELS
    x = np.int16(0)
    for c in data:
        x+=c*b
    frame = (x.astype(np.int16)).tobytes()
    return frame 

` The above code is part of converting 4 channels frame to 1 channel. mic_vad_streaming.py file freezes when running on Raspberry and trying to record 4 channels. The function mentioned above is called inside the vad_collector function when length of the frame is larger than 2560.