title: python play generated sound and accurate plot
body: <p>I am looking for a way the accurately plot sound generated in real time, using python. 
  Basically, I am generating a tone with the frequency varying following a noise function. When the frequency reaches certain thresholds, I need to output a visual cue (ie: a print statement)</p>
  
  <p>I have been outputting the audio using pyaudio, which works fine. But I have yet to find a way to plot it, or monitor when it reaches certain levels. </p>
  
  <p>EDIT : to clarify a little bit : Lets say I generate 1 second of samples. The frequency reaches the desired level at 0.1 second and 0.7 second. How can I play this audio sample, and print a statement precisely at the moment it reaches 0.1 second and 0.7 second. How can I sync some sort of visual clue, or any function call, precisely synced with the audio playing.</p>