Answers.Body: <p>Your problem is an old one. There are many methods, referred to as Voice Activity Detection (VAD) methods, which detect speech from an audio signal. </p>
  
  <p>The typical design of a VAD algorithm follows one of more of these 3 approaches:</p>
  
  <ol>
  <li><p>A noise reduction stage, e.g. via spectral subtraction.</p></li>
  <li><p>Some features or quantities are calculated from a section of the input signal.</p></li>
  <li><p>A classification rule is applied to classify the section as speech or non-speech – often this classification rule finds when a value exceeds a threshold.</p></li>
  </ol>
  
  <p>There may be some feedback in this sequence, where parameters (like the noise threshold or the classification threshold) are tuned to improve the estimate or to adaptively vary the threshold(s). These feedback operations improve the VAD performance in non-stationary noise (i.e. when the noise varies a lot).</p>
  
  <p>Check out this <a href="https://en.m.wikipedia.org/wiki/Voice_activity_detection" rel="nofollow noreferrer">wiki page on Voice Activity Detection</a> for more information.</p>
  
Answers.ContentLicense: CC BY-SA 3.0
Answers.CreationDate: 2017-11-12T16:19:30.160Z
Answers.Text: Ah, that does look like a good start! In the interest of keeping answers as self-contained as possible, could you maybe include an outline of the architecture? That would be great.
Answers.UserDisplayName: Ben N
Answers.ContentLicense: CC BY-SA 3.0
Answers.CreationDate: 2017-11-13T19:06:36.487Z
Answers.Text: Good point, updated.
Answers.UserDisplayName: Jaden Travnik
Answers.ContentLicense: CC BY-SA 3.0
Answers.CreationDate: 2017-11-12T03:04:39.820Z
Answers.LastActivityDate: 2017-11-13T19:05:55.950Z
Answers.LastEditDate: 2017-11-13T19:05:55.950Z
Answers.UserDisplayName: Jaden Travnik
Body: <p>I want to build a personal assistant that listens to me continuously.. </p>
  
  <p>The flow looks like this: </p>
  
  <ol>
  <li>continuously record voice </li>
  <li>stream it to google speech api.</li>
  <li>get back the text in real time -> parse for intent etc..</li>
  </ol>
  
  <p>Problem is, google speech api gets expensive if you record for hours. A better way to do it is to only submit the parts where I'm actually speaking to it.. Then the cost of running this full time (17 hours a day, every day) becomes very accessible.
  Now my question is:</p>
  
  <p><strong>How can i detect that a voice is present in the microphone stream?</strong> </p>
  
  <p>I have a lot of noise in the background, dumb <code>increase in volume detection</code> is not a very good solution. I need something more intelligent. It doesn't need to be very accurate - just good enough to not break my cloud computing budget. I'm thinking that human voice sounds distinct enough that is not such a big problem to detect when is there.</p>
  
  <p>What do you recommend me to do, given this is a real time stream - not an audio file.</p>
  
  <p>The audio will be generated in chromium browser (electron) - with <code>getUserMedia</code> API, and using <code>node.js</code> i plan to handle the streaming logic. </p>
  
  <p>Note: there is a built in <code>speechRecognition api</code> in <code>electron</code> - but from my experience currently it doesn't work (not even after i give it my API key), and even if would have worked, i think it has the same cost problem. So this is why i'm trying to provide my own implementation. </p>
  
  <p>I don't know what i'm doing, any insight is welcomed:) Thank you.</p>
  
Comments.ContentLicense: CC BY-SA 3.0
Comments.CreationDate: 2017-11-12T22:10:51.997Z
Comments.Text: Welcome to AI.  I've added a "voice recognition" tag since this is in that general field.
Comments.UserDisplayName: DukeZhou
Tags: <intelligent-agent><voice-recognition>
Title: How to detect when human voice / speech appears in an microphone stream?
UserDisplayName: AIon
ThreadText: # How to detect when human voice / speech appears in an microphone stream?
  
  (Asked by: username_0 on 2017-11-11)
  
  I want to build a personal assistant that listens to me continuously..
  
  The flow looks like this:
  
  1. continuously record voice
  2. stream it to google speech api.
  3. get back the text in real time -> parse for intent etc..
  
  Problem is, google speech api gets expensive if you record for hours. A better way to do it is to only submit the parts where I'm actually speaking to it.. Then the cost of running this full time (17 hours a day, every day) becomes very accessible.
  Now my question is:
  
  **How can i detect that a voice is present in the microphone stream?**
  
  I have a lot of noise in the background, dumb `increase in volume detection` is not a very good solution. I need something more intelligent. It doesn't need to be very accurate - just good enough to not break my cloud computing budget. I'm thinking that human voice sounds distinct enough that is not such a big problem to detect when is there.
  
  What do you recommend me to do, given this is a real time stream - not an audio file.
  
  The audio will be generated in chromium browser (electron) - with `getUserMedia` API, and using `node.js` i plan to handle the streaming logic.
  
  Note: there is a built in `speechRecognition api` in `electron` - but from my experience currently it doesn't work (not even after i give it my API key), and even if would have worked, i think it has the same cost problem. So this is why i'm trying to provide my own implementation.
  
  I don't know what i'm doing, any insight is welcomed:) Thank you.
  
  **Tags:** intelligent-agent, voice-recognition
  > **Comments:**
  > **username_1**: Welcome to AI.  I've added a "voice recognition" tag since this is in that general field.  
  
  ---
  
  ## 1 answers
  
  ### Answer by username_2 on 2017-11-12. Score: 4
  
  Your problem is an old one. There are many methods, referred to as Voice Activity Detection (VAD) methods, which detect speech from an audio signal.
  
  The typical design of a VAD algorithm follows one of more of these 3 approaches:
  
  1. A noise reduction stage, e.g. via spectral subtraction.
  2. Some features or quantities are calculated from a section of the input signal.
  3. A classification rule is applied to classify the section as speech or non-speech – often this classification rule finds when a value exceeds a threshold.
  
  There may be some feedback in this sequence, where parameters (like the noise threshold or the classification threshold) are tuned to improve the estimate or to adaptively vary the threshold(s). These feedback operations improve the VAD performance in non-stationary noise (i.e. when the noise varies a lot).
  
  Check out this [wiki page on Voice Activity Detection](https://en.m.wikipedia.org/wiki/Voice_activity_detection) for more information.
  
  > **Comments:**
  > **username_3**: Ah, that does look like a good start! In the interest of keeping answers as self-contained as possible, could you maybe include an outline of the architecture? That would be great.  
  > **username_2**: Good point, updated.  
  
  ---
  
  