Reading audio from system output


#1

I’m surprised I didn’t find any existing topics about this: is there a simple (cross-platform) way to read audio from the system output using Juce’s audio libraries? I imagine it would work with some kind of virtual audio device, but there doesn’t seem to be any built-in Juce way to do it.

In general, I know that it’s possible for an application to do this directly – for example, Open Broadcaster Software has it. I want my app to be able to do it like OBS does, without requiring a third-party utility (such as JACK).

Thanks for any advice, or if this isn’t currently possible with Juce, could I request it as a feature?


#2

No, it isn’t possible for an app to read from other apps or the system audio output directly.

Not sure whether it’s deliberate in the part of OSes to avoid people ripping audio streams, but they certainly don’t provide a way to do it.

The only way is by installing a custom audio driver which other apps can connect to, e.g. SoundFlower. But no, we haven’t got a JUCE driver you could use for that kind of thing.


#3

Thanks. In looking at the OBS source code, I found things like: https://github.com/obsproject/obs-studio/blob/master/libobs/audio-monitoring/win32

Am I misunderstanding that the above might be a way to do it? The commit comment is “Add ability to monitor Outputs”.


#4

I have no idea, I’ve never even heard of that app.


#5

Windows WASAPI has a loopback mode :

https://docs.microsoft.com/en-us/windows/desktop/coreaudio/loopback-recording

But adding support for that in JUCE might be a bit iffy since an equivalent apparently doesn’t exist on macOs. (I don’t know about Linux.)


#6

Ah yes, that’s it. Well, bummer about MacOS but I still request this for Windows if possible! I’m sure a lot of users would want it!


#7

Here is an open source project for macOS that does it. The downside is it is a kernel extension, and kernel extensions are now required to be signed or users can’t load them. And getting a kernel extension signing key, you need to tell Apple what you are going to do with you extension and why and then wait 6+ months.