title: Use WebRTC Voice Activity Detector (VAD) on live audio coming from VOIP streamed by Websockets
body: <p>I'm trying to set up WebRTC Voice Activity Detector (VAD) for a VOIP call that is streaming through a websocket, to detect when the caller has stopped talking.</p>
  <p>Most of the tutorials and questions around WebRTC VAD were based on recorded audio files, and not on a live stream. I would like to know how to implement it on a websocket streaming a VOIP call in real time.</p>
  <p>According to the py-webrtcvad documentation (<a href="https://pypi.org/project/webrtcvad/" rel="nofollow noreferrer">https://pypi.org/project/webrtcvad/</a>):</p>
  <blockquote>
  <p>Give it a short segment (“frame”) of audio. The WebRTC VAD only accepts 16-bit mono PCM audio, sampled at 8000, 16000, or 32000 Hz. A frame must be either 10, 20, or 30 ms in duration</p>
  </blockquote>
  <p>How would one go about converting a raw audio stream coming from the websocket to the requirements needed above by the WebRTC VAD to work?</p>