andrewrk / libsoundio

C library for cross-platform real-time audio input and output
http://libsound.io/
MIT License
1.92k stars 229 forks source link

Capturing system audio (loopback support) #233

Open marioortizmanero opened 4 years ago

marioortizmanero commented 4 years ago

For what I've seen, libsoundio is only able to record inputs. You can't for instance record your desktop audio. Are there any plans on supporting this? On PulseAudio I've done it with ffmpeg, so it must be possible. Similarly, Windows lets you do it with WASAPI.

geekuillaume commented 4 years ago

With pulseaudio, you can access the monitor source created for each sink like a classic source.

It is possible to do this with WASAPI but it is not supported by libsoundio. I'm planning on working on this for one of my project by using this PR from rtaudio as a base: https://github.com/thestk/rtaudio/pull/162/files

geekuillaume commented 4 years ago

For MacOS, you can use https://github.com/ExistentialAudio/BlackHole to create a loopback device, it's not as easy as what we can do with WASAPI or PulseAudio but should work well for some usage.

marioortizmanero commented 4 years ago

Hey, thanks a lot for the suggestions. For now it might be best to use rtaudio + BlackHole because these are already available. Best of luck on your project!

I'm keeping this open in case anyone wants to update the loopback progress for libsoundio.