How to properly use py-webrtcvad?

marc nicole mk1853387 at gmail.com
Wed Jan 22 16:54:12 EST 2025


Hi,

I am getting audio from my mic using PyAudio as follows:

self.stream = audio.open(format=self.FORMAT,
>                                  channels=self.CHANNELS,
>                                  rate=self.RATE,
>                                  input=True,
>                                  frames_per_buffer=self.FRAMES_PER_BUFFER,
>                                  input_device_index=1)


then reading data as follows:

for i in range(0, int(self.RATE / self.FRAMES_PER_BUFFER *
> self.RECORD_SECONDS)):
>             data = self.stream.read(4800)


on the other hand I am using py-webrtcvad as follows:

self.vad = webrtcvad.Vad()


and want to use *is_speech*() using audio data from PyAudio.
But getting the error:

 return _webrtcvad.process(self._vad, sample_rate, buf, length)
> Error: Error while processing frame


no matter how I changed the input data format (wav: using
speech_recognition's *get_wav_data*(), using numpy...)

Any suggestions (using Python 2.x)?
Thanks.


More information about the Python-list mailing list