Open tlecomte opened 6 years ago
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.
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.
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.
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()
.
Sounds great, thanks @slole ! bastibe/Soundcard does not support callback recording though, right ? Friture would also need this unfortunately...
I have already opened an issue about not supporting callback. https://github.com/bastibe/SoundCard/issues/30
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.
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