macOS loopback support
While working on one of my projects, I have been experimenting with recording system audio on macOS without relying on virtual devices such as blackhole. It seems that it is now possible to do so using CoreAudio Tap objects.
Having used this method in my project for a few months now, it seems to work quite well. Since macOS is the only platform lacking loopback recording support in this library, I thought it would be helpful to share this here.
Here is a gist I wrote to test this feature (includes links to the references I used to put it together):
I'm not entirely sure what the minimum macOS version required is. This other gist suggests 14.2, however looking at Apple documentation many of the components used are available since macOS 12.
Rather than taking the output of a speaker as input, this method creates a tap object that let you get the audio directly from the processes running as well as decide exactly which processes to record. In the gist I wrote, I create this object passing an array of processes to exclude from capture which is left empty in order to record all system audio, resulting in a behaviour similar to a loopback device. The tap object is then used as input in an Aggregate Device which SoundCard recognises as a proper microphone.
If you believe the method described to be compatible with this library, I'd be willing to draft a PR in my spare time.