6

I'm trying to capture the system output audio on Windows, Mac and Linux using PyAudio but am having mixed results. Right now I am doing this:

self.p = pyaudio.PyAudio()
self.inStream = self.p.open(format=pyaudio.paInt16,channels=1,rate=self.RATE,input=True, output=False,frames_per_buffer=self.BUFFERSIZE)

And then reading from inStream.

However, on Ubuntu, it is very flaky. Worked for a while but also picked up the microphone. Then I connected my headphones and it has not picked up anything since.

On Windows, it will only pick up the line in or microphone so the only way I could get it to work was to route the headphones output back into the line in.

Also, I tried with input=False, output=True and it just tells me there is no output device.

Is there a better way of doing this? Is there a way to select the default device? I just want it to pick up whatever is coming out of the speakers.

Adam Haile
  • 30,705
  • 58
  • 191
  • 286

0 Answers0