intxcc / pyaudio_portaudio

A fork to record speaker output with python. PyAudio with PortAudio for Windows | Extended | Loopback | WASAPI | Latest precompiled Version
MIT License
245 stars 61 forks source link

Speaker output looping back into EVERY input device's left audio channel when using Stereo Mix #35

Open CaptainXLAB opened 4 years ago

CaptainXLAB commented 4 years ago

I'm using this with Python3.7 (used the .msi installer) and after the audio stream goes on for a while (as_loopback = true), speaker output starts inputting itself into microphone's left channel and it stays that way until I restart my system.

The script is using system audio output as input to do frequency cutoffs (scipy butterworth), some analysis and write results onto a file. Script has nothing to do with microphone. Only device used is Speakers with (as_loopback=true) parameter.

Signing out and back in again, stopping the python script, unplugging and plugging mic back in, nothing else helps. It's quite annoying since I use my mic for meetings and all, and all speaker output can be heard in left channel of my mic. At times I'm doing rendering/encoding in background that takes a few hours each time and restarting over and over isn't a good solution.

Happens consistently, every time I run the script longer than a few minutes. Fixes consistently when I restart.

CaptainXLAB commented 3 years ago

Update: This issue happens specifically when using "Stereo Mix" as the input device on Win64

To reproduce: Start an audio stream and just print audio values (using np.linalg.norm), wait for 5-10 minutes. The audio levels will be high even when no audio is playing through speakers, in every input device that is enabled. That also includes devices that only have a physical wire plugged in but with no actual device attached.

Even after killing the script, Stereo Mix and EVERY INPUT DEVICE's audio levels stay the same.

Working fine with as_loopback=true when using with Speakers as the input device.