Ubuntu Studio 24.04, OBS 32.0.0: Audio Monitor through PipeWire: Brickwall-lowpassed at 2kHz

AaronD

Active Member
Trying to fix the ever-increasing latency problem on certain sound cards, by connecting OBS to a virtual thing and then the virtual thing goes to the actual hardware. (clock drift, that OBS hasn't handled correctly for years...)

But now I have a different problem:
Carla.png

The upper blue and red traces are the noise generator's output. The lower traces are from OBS. Re-patching to bypass OBS but keep the two virtual devices, gives a flat trace.

OBS's settings:
OBS.png


The recording is okay, so it's just the monitor that has a problem:
Audacity.png

Anyone else had this problem and solved it?
 
The audio library within OBS is damn near arcane - this would be quite difficult to debug and fix either problems e.g. the ever-increasing latency issue or that high shelf-like output. Good find! And good luck.
 

AaronD

Active Member
The audio library within OBS is damn near arcane
I know. The understandable part is that the official dev team hasn't had an audio guy for all those years and (perhaps wisely, given the circumstances) hasn't tried to fix it.

The frustrating part is their defense of the ever-increasing latency in terms of asynchronous networking! THIS IS NOT A NETWORK! It's supposed to emulate a physical wire in the same physical space. Noticeable latency has no place there, even if you have to compromise other things to get rid of it.

No other app that I know has that problem, hence the virtual device in between: send OBS to something else that has the same clock and is therefore okay, and let the something else handle the clock problem correctly.

Anyway, like I said, they don't have an audio guy, so their attempts to fix it will likely make it even worse, and so they haven't.

---

The routing as shown all the way up top here, would have worked...if it weren't for the 2k brickwall. The steepness and location suggest to me an anti-aliasing filter a decade too low. That filter is a required part of resampling:
  1. Stuff an equal number of zeroes between original samples to get a really high sample rate that is a common multiple of both the input and output rates.
  2. Lowpass to smooth it out, and gain it up to account for all the zeroes, often doing both in a single step.
    • For that matter, all 3 of these points can be condensed into a single step that doesn't look like anything useful at all until you've studied it for a long time.
    • The result of the lowpass should contain nothing consequential above half the new sample rate, and should not adversely affect anything audible. For 40-odd kHz sample rates, that's pretty steep! Hence the term, "brickwall".
  3. Pick samples out at the new rate.
If OBS is resampling the Monitor output (surprised it does, since the clock problem suggests it doesn't), and it gets the filter frequency wrong by a decade or an order of magnitude (same thing), then that would explain the measured behavior.

And good luck.
Thanks.
 

AaronD

Active Member
Found something that works! Seems that the key is to avoid connecting OBS through PipeWire...at all. On most rigs, that probably means, "direct from OBS to hardware," not to a virtual device because those *must* be PW, using OBS's own settings to do it, and never messing with those connections outside of OBS. (like a DAW or plugin host loading a session file that happens to include OBS's connections)

Even if you use PipeWire to put the same connection back, it *still* has the same problem described above. If you've made that mistake, or can't avoid it, the fix then is to either restart OBS, or deconfigure and reconfigure its Audio settings and all that that erases in other places too. So it's best to start the DAW or plugin host first, get that settled how it's going to be, and THEN start OBS.

This is also true in the latest v31 release, so it's not a v32 regression. Given that, I wouldn't be surprised if *every* version of OBS does this.

So, here's how to get some external processing in OBS, with PipeWire, without a decade-too-low anti-aliasing filter:
Patchbay.png

As you can see, it makes heavy use of the "monitor" loopbacks that the operating system creates for every output.
  1. Send the external plugin(s) (in my case, there's only one: the "LSP Delay Compensator Stereo" towards the top left) to a physical sound card that's not wired to anything.
    • Finally a use for the onboard audio chip! Or a cheap USB thing that barely works. It doesn't matter how terrible it is, or even if the analog side *is* in fact broken somehow, because the operating system copies the digital data straight across before it even goes to the device at all. It only needs to be "something" that satisfies the OS.
  2. Connect OBS's Desktop or Output Capture to the "monitor" of that same device.
    • It's not a Mic or Input Capture anymore, because OBS is now listening to the loopback of an output.
  3. If you want OBS's Monitor to go to multiple places like I do, send it directly to one of them, and have the plugin host connect the "monitor" of that one to the other(s).
    • I intentionally have my headphones last in that chain, so I can hear directly that all of it works.
    • No need to continue it as a chain. The last link as shown here can fan out to everything else.
Whew! All that because:
  1. OBS itself doesn't have an audio delay plugin. It has a Sync Delay, but that happens after the Monitor taps off, so it's still wrong for the operator. Doing it as shown here, with a delay before OBS at all, and OBS set for zero Sync Delay, fixes both instead of just one.
  2. OBS only has one physical audio output, and it can only go to a single device. Previous versions of Ubuntu (with PulseAudio and JACK separately) had an option in PA to create a virtual device that goes to all outputs, and that was nice. Send OBS to that, and it just works. But 24.04 doesn't have that anymore, thus the *output* side of the diagram here, and point #3 in the previous list.
I'm not looking forward to the next rig that I need to update, which needs to record a video with 6 different stereo soundtracks that all come from a DAW. I hope I can find a way to do that without absolutely requiring that many *physical* sound cards!
 
Top