friture icon indicating copy to clipboard operation
friture copied to clipboard

WASAPI loopback

Open tlecomte opened this issue 8 years ago • 7 comments

Audacity is patching PortAudio to get audio loopback: https://github.com/michaelni/audacity/blob/master/lib-src/portaudio-v19/wasapi-loopback.patch https://app.assembla.com/spaces/portaudio/git/source/master/src/hostapi/wasapi/pa_win_wasapi.c

tlecomte avatar Dec 17 '17 19:12 tlecomte

I also really need this.

I took a look around. In Friture there are some wrappers for PortAudio involved. to be precise: sounddevice -> PyAudio -> PortAudio

There is an inofficial modified PyAudio version that support WASAPI loopbacks. https://github.com/intxcc/pyaudio_portaudio I managed to get the examples working.

But sadly there is no supported sounddevice version for that.

It seems like there would be a lot of rewriting involved in audiobackend.py to make an exception for Windows OS and not use sounddevice, but (the modified) PyAudio library functions.

cgernert avatar Mar 03 '18 17:03 cgernert

Hello @cgernert ! That's very interesting. Another option that I have in mind is migrating away from sounddevice, and use the audio features from PyQt5 instead. It supports Android, which could be a nice new target for Friture... And it supports wasapi too, so maybe the loopback would work. I've not been able to find any info to confirm that though.

tlecomte avatar Mar 03 '18 18:03 tlecomte

I did a quick check and unfortunately PyQt5 does not support WASAPI loopback either.

Another option would be to use https://github.com/bastibe/SoundCard. It does not support WASAPI loopback either, but it may be easier to add support there.

tlecomte avatar Mar 11 '18 17:03 tlecomte

Another option would be to use https://github.com/bastibe/SoundCard. It does not support WASAPI loopback either, but it may be easier to add support there.

I actually added support for this and it is already merged. All you have to do is add the include_loopback=True flag when calling all_microphones().

janleskovec avatar Oct 07 '18 08:10 janleskovec

Sounds great, thanks @slole ! bastibe/Soundcard does not support callback recording though, right ? Friture would also need this unfortunately...

tlecomte avatar Oct 07 '18 12:10 tlecomte

I have already opened an issue about not supporting callback. https://github.com/bastibe/SoundCard/issues/30

janleskovec avatar Oct 07 '18 12:10 janleskovec

Hello, I also encountered a problem with recording with the WASAPI loopback devices via python. I did not find a ready-made solution, so I solved this one in my PyAudio fork.

All changes in PyAudio behavior are minor. The main thing is that the methodology for working with loopback devices has been worked out. It might help you solve your issues.

s0d3s avatar Sep 09 '22 20:09 s0d3s