Reading audio from system output

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?

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.

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”.

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

Windows WASAPI has a loopback mode :

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.)

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!

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.

Is there any chance that WASAPI loopback recording will be supported? I know there’s no macOS alternative but it would be a useful feature in Windows. It’s for example implemented in Reaper.

Here’s an example implementation with code:



I haven’t found any license mentioned but the general implementation seems to be not to complicated.

1 Like

With Windows virtual sound driver structure like https://www.vb-audio.com/Voicemeeter/index.htm
it is easy to capture each sound output from any program.

I could probably also use reaper to capture the audio and then send it to my application using ReaASIO. But this is not the point.

Windows supplies a feature to directly capture the current audio output. My question simply is whether this will be supported in JUCE.

Any comments from the JUCE team regarding support for WASAPI loopback recording?

Maybe this is such a ridiculous request that it doesn’t deserve an answer. If so, I’m afraid I don’t see it. Please let me know.

My guess is that it will not be supported. It would be a Windows-only feature that would add even more complexity to the WASAPI-implementation in JUCE.

Yeah, sorry for not replying. It’s an understandable FR and not ridiculous, but not being very cross-platform or widely requested it’s not really something we’d prioritise. If it was easy we might consider it, but to figure out a clean, portable way to present this kind of thing and then implement it on the few platforms that support it would involve quite a bit of research.

Thanks for the reply, Jules. I’ll have a look for an implementation myself than. That is, if I find some time.

Bump!
Has the situation evolved this last two years?
I would definitely use this feature if it was available.
(I want to throw audio-out thru speech-reco).

2 votes so far Windows WASAPI Loopback, I doubt there’s going to be any progress made here.

In the meantime I’m trying to implement it with miniaudio library with moderate success. Got the loopback working. But stopping and opening a new device ends up in an infinite “wait for an object” loop. I reckon it might be conflicting with what’s going on with JUCE’s WASAPI back end at that moment.

1 Like

If anyone is still looking for a solution, I can upload a Projucer project based on the JUCE AudioRecordingDemo with WASAPI Loopback recording implemented using miniaudio library.

3 Likes

Yes please I need it

Here you go:
LoopbackRecordingDemo.zip (26.3 KB)

5 Likes