339 points · by ckcheng · 2y ago · 125 comments
https://developer.apple.com/documentation/coreaudio/4160724-...
Agree with others in this post that it's WAY too hard to get a stable stack on OSX and that a tool like BlackHole should be standard in the OS.
On Mac stuff basically just works.
On Windows ASIO works with only ASIO, and doesn’t allow the OS to use the card for “regular” sound unless the device-specific driver allows for it.
Edit: Or in most cases for two ASIO applications to use the same soundcard at the same time. So you end up needing to install a virtual loopback anyway, losing out on the (theoretical) latency benefits of ASIO.
Not that anyone cared about watching live streamed video game footage back in 2001 or so.
Buy audio interfaces with good drivers (e.g. RME, Lynx, Metric Halo or even MOTU AVB stuff and stay away from Antelope - they have problems), install, plugin and away you go.
compared to what?
- Seriously though trying to understand audio midi setup from docs was pretty awful. - I've had a bunch of (mostly DJ) equipment refuse to connect with newer macs as they keep changing their security model. - Managing/fighting latency took a lot of experimentation (for me anyway). - The soundflower / blackhole stuff can be a pain until you've stitched everything together once or twice.
https://www.theverge.com/24148033/satya-nadella-microsoft-se...
On MacOS there is CoreAudio, and it's been there for two decades.
Good for streaming also, without needing to use OBS, which is hit and miss when it comes to some things.
I use Loopback and BlackHole both, although for different reasons/setups. I guess it's more an artifact of the surrounding macOS environment at the conception of each project. BlackHole's first commit was September 2019, while Loopback was released in 2016 (but also shares its capture engine with Audio Hijack, and its 1.0 release was 2002!)
A good usecase is having a nice mic for your Zoom calls or Youtube videos and doing basic noise filtering, compression and limiting on it w/o having to run a full DAW in the background.
Otherwise Loopback does everything else like piping specific sound sources from one app to another, without the rest of system audio.
The animations in the tool are quite good. Very polished.
pacmd load-module module-loopback
Last Halloween we hired a fortune teller and I used this with some ladspa plugins and my tts to rig up a self signups from cellphone thing. When the fortune teller pressed the button the next in line was announced in a scary voice over the whole home audio system. After the music decreased in volume of course!Looks like I have Traktor set to 192 samples @ 44khz. It's showing "4.4 ms processing + 17.6ms output = 22.0 ms" in its UI.
Ableton is set to 128 samples, and showing "Input Latency 4.72 ms, Output Latency 6.05 ms, Overall Latency 10.8 ms".
So maybe 33.8 ms in the whole pipeline? Although I throw audio signal across the room via the Babyface's optical out to a cheap optical -> RCA box, so that's probably adding a little more to my physical environment.
I've had this same Traktor/Live setup going for a long, long time. At one point I even used a physical loopback with the Babyface's optical out/in carrying 8 channels between Traktor and Ableton. That was sadly better than any software available before BlackHole. It was solid, although a bit higher latency, and it's nice to be able to use the optical out for its intended purpose!
I used to get very occasional crackle this BlackHole setup, until I tried a random tip of using the built-in speakers as the clock source on an aggregate device. It's been rock solid since. I could probably lower sample buffers even further these days (M3 Max)...
I personally use it to route my studio mic input through OBS, where I apply some filtering, to then be able to use it with different VoIP software.
On Mac, I can just buy Rogue Amoeba software, and on Linux, I can just run some commands or download a GUI to route audio around however I want.
I also find it interesting that all of the examples are for routing DAWs to video call apps. Don’t these apps have screen sharing and wouldn’t that be higher quality than using the microphone input?
Plus you'll often want to be using some sort of mixer to mix in a vocal/talk mic also.
That said, OBS has a “camera” mode where it will present itself as a camera. Anything you can do in OBS (including playing a video) can be sent to anything that takes camera input.
Also, it's just yet another reason that I'm so happy my Zoom meetings do not require a camera feed. There's just something Orwellian to me about having to have a camera on me. Having a camera on me is my absolute nightmare regardless of the purpose of the camera.
I did some research into using ffmpeg as a sort of live network based video router and compositor, My conclusion was that it would work. however my heart was set on actual transparent rgba video and support for that was finicky.
"People and culture" departments would argue that it creates a sense of belonging and cohesion to the team.
For example, in my live sets I send 8 separate audio channels from Ableton Live via a miniDSP optical interface [2] to my music partner's audio interface who does fx and live mixing.
When I'm working on the sets without him I don't have the midiDSP audio device plugged in and Ableton get's annoying. So I set up a routing in Element from BlackHole 8 track to mix down to stereo and my usual stereo output without having to remap my channels in Ableton. Just switch output devices.
Unfortunately, I don't think there's a good UI that exposes both a graph view and a way to create virtual devices for more advanced routing, however there is very rich support for advanced routing:
https://gitlab.freedesktop.org/pipewire/pipewire/-/wikis/Vir...
So there's probably no direct analogue, as at best you'll probably need to run some commands to get a device to combine streams for you, and then you can hook it in using Qpwgraph.
Pipewire also handles video devices and graphs too.
If you ever want to try this with a proper audio interface, you'll also want to switch the audio interface into Pro Audio mode most likely. It's a profile that can be selected (typically in whatever handles your volume settings, e.g. pavucontrol)
There might be other ways to do it depending on your distribution, for example https://askubuntu.com/q/78174
I have this "hard time" imagining what the X thousands lines of code do. Even more when the piece of software claims to be simple. I would have to devote months to really understand it, I guess, and "cure" this "superficialitis" (tendency to think everything is 50 lines of code)
I guess compilers are the only "kind" of project I can imagine a few complex parts.
You wouldn’t have to spend months understanding it, but you also wouldn’t be able to glance at the code for 5 minutes and understand everything that needs to happen.
Anything that handles driver or system level operations and deals with audio will get complex quickly. What happens when the input device gets unplugged? The output device disconnects? User changes from speakers to AirPods?
How do you handle situations where the input and output sample rate are different? What about when something backs up and a buffer overflows? Or underflows? What mechanism do you use for handling user setting changes?
The list of situations you have to handle goes on and on. The core concept is simple, but there are so many things to do that the code base will naturally become bigger than the 50 lines of code you’re imagining.
I don't think you could write any driver in 50 lines of code?
What's so hard about a compiler? You read some files, split into tokens, sort into a tree, and then walk the tree and write some instructions to disk at each node. Can be done in a couple hundred lines of code. (\s: the point is that all software gets complicated, and a few thousand lines is not a lot of code)
There are a ton of case statements; each one represents a situation that must be supported.
3500 lines goes quickly when you divide it by a few hundred situations/statuses.
As comments in another discussion tree have said, it's a shame that macOS doesn't provide some of this natively. If it did then this would probably be higher level code and shorter. Knowing where the boundary lies between the system and the application is part of having an understanding of why all this was written.
I wouldn't feel bad about this; it's just a domain knowledge thing. Be excited by the opportunity to learn with a toy project or a deep code review!
I still use Loopback because I like the interface it gives you. If I remember correctly, BlackHole doesn't provide a GUI.
Oh, actually, now I remember why I bought Loopback in the first place. I couldn't figure out how to map a single stereo input channel to both left and right channels with Blackhole, but Loopback makes that very easy. Maybe it's possible to do with Blackhole, but I'll happily pay to not feel like a confused old man when all I want to do is record audio the way I expect.
In the case of Audio Hijack, one might as well save the money and go with Blackhole instead of Loopback.
And in any case, as much as I normally embrace FOSS, Rogue Amoeba makes high quality software that's worth paying for, so I'm not champing at the bit to replace them.
It's also a pain to set things up this way (compared to loopback or hijack).
MacOS doesn’t even have per application volume control, which is a crazy thing to say for the OS aimed at audio professionals (at least as far as I know.)
But if Blackhole does what you need, that's awesome!
One would think in the edge of remote work, an operating system would bring a virtual web cam driver.
I used ManyCam but they cheated me out of a lifetime license.
That's why MacOS provides this in ScreenCaptureKit
I haven't used it personally but that's my understanding of why it exists. Otherwise there's no point to sending audio through it.
Good news: it's not. At least not from macOS Ventura onwards.
They don't want you to be able to do that.
(you get a blank area where the video is)
I’m not at my computer to check, but if this really is true, use VLC to get screen grabs from videos
maybe the same thing happens with audio, but there's no drm knowledge/support so they didn't implement any of it.
Then again it looks like patch bay. Then isn't there already: QjackCtl, and that works with mac/win/linux?
links:
1: https://www.macobserver.com/tmo/article/audio-midi-setup-you...