title: Using Python to playback mic input to PC in real-time
body: <p>I'm trying to use Python to 'mic-monitor', i.e., to playback the mic signal through the headphones in real-time, in addition to any other output signal from the PC.</p>
  <p>I can accomplish this by amending my PC's playback settings, but I want to do it with Python, so that I can program a Raspberry Pi to mic-monitor my cheap headset for the PS4.</p>
  <p>I can <em>almost</em> accomplish this with PyAudio or sounddevice, but there is a small but significant delay. So:</p>
  <ul>
  <li>Is there a way to eradicate that latency with Python, for example by somehow accessing my PC's inputs more directly?</li>
  <li>Otherwise, why is it not possible with Python?</li>
  <li>Can I somehow configure the Raspberry Pi to mic monitor in the same way as my PC?</li>
  </ul>
  <p>Sounddevice code is shown below for reference:</p>
  <pre><code>import sounddevice as sd
  duration = 5.5  # seconds
  
  def callback(indata, outdata, frames, time, status):
      if status:
          print(status)
      outdata[:] = indata
  
  with sd.Stream(channels=2, callback=callback):
      sd.sleep(int(duration * 1000))
  </code></pre>