I am trying to capture the audio output of a system on Windows, Mac and Linux using PyAudio, but I have mixed results. 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, he is very flaky. He worked for a while, but also took a microphone. Then I plugged in my headphones and since then he hasn’t understood anything.
On Windows, it will only pick up the line or microphone, so the only way to make it work is to redirect the headphone output back to the line.
Also, I tried with input = False, output = True, and it just tells me that there is no output device.
Is there a better way to do this? Is there a way to choose a default device? I just want him to take everything that comes out of the speakers.
source share