title: Python record audio on detected sound
body: <p>I am looking to have a python script run in the background and use pyaudio to record sound files when the threshold of the microphone has reached a certain point. This is for a monitor on a two way radio network. So hence we only want to record transmitted audio.</p>
  
  <p>Tasks in mind:</p>
  
  <ul>
  <li><p>Record audio input on a n% gate threshold</p></li>
  <li><p>stop recording after so many seconds of silence</p></li>
  <li><p>keep recording for so many seconds after audio</p></li>
  <li><p>Phase 2: input data into MySQL database to search the recordings</p></li>
  </ul>
  
  <p>I am looking at a file structure of the similar</p>
  
  <p>/home/Recodings/2013/8/23/12-33.wav would be a recording of the transmision on 23/08/2013 @ 12:33.wav</p>
  
  <p>I have used the code from</p>
  
  <p><a href="https://stackoverflow.com/questions/2668442/detect-and-record-a-sound-with-python">Detect and record a sound with python</a></p>
  
  <p>I am at a bit of a loss where to go from here now and a little guidance would be greatly appreciated</p>
  
  <p>thank you</p>