96 Khz Support

KensonPlays

New Member
I have read this post: https://obsproject.com/forum/threads/accept-96khz-audio.116873/

But I still would like to see 96 Khz audio support. My Wave DX mic, and Wave XLR can support 96 Khz for my microphone channel while rest is in 48 Khz. I'd like to get the full benefit of my XLR mic if possible.

I'd use 96 Khz in a recording only profile, not a streaming profile.

Is 96 Khz support something that can be considered, even if its hidden behind the "advanced" settings and not available in simple settings?
 

R1CH

Forum Admin
Developer
A higher sampling rate is not necessarily "better". At 48 KHz you can already reproduce any waveform below 24,000 Hz perfectly. The human voice is typically well below this level, and you're already at a range outside of human hearing, so there is no reason to go beyond this.
 

PaddyMac

New Member
The antagonism toward supporting higher sampling rates for audio by the OBS developer baffles me. I realize it probably isn't a good idea for streaming. But it absolutely makes sense for recording. Many people, such as myself, upload content to Youtube. And if you look at Youtube's upload guidelines ( https://support.google.com/youtube/answer/1722171 ) they fully support 96 KHz audio sampling, and they support up to 128, 384, or 512 bitrate for mono, stereo, or 5.1 audio, respectfully. But OBS limits audio bitrate to 320. At the very least, if popular platforms that people are producing content for -- using OBS, mind you -- support this level of quality, it seems asinine to arbitrarily cripple the software from producing such content.
 

PaddyMac

New Member
Since I can't edit my post, I'll just add that, clearly, 96 KHz (or even 128 KHz) recording doesn't always make sense. But there are valid use cases. These use cases will most likely be for musicians or anyone desiring to work with professional-quality audio. For others, it will just result in unnecessarily large file sizes. But the logic currently being applied to audio isn't consistent with the logic applied to video options in OBS. In the video section, OBS will emit warnings about certain options or combinations of options, but it doesn't disable those options. My opinion is that audio options should be the same. Make the options available and emit warnings/informational text advising the user that anything over 44.1 KHZ or 48 KHz will likely result in unnecessarily large file sizes for no real benefit for many average users. And while I'm at it, why is there only one audio section? Just like video, audio should have separate tabs for streaming and recording settings. Maybe I want to stream at a bitrate of 128 but record at 384. That should be an option.
 

R1CH

Forum Admin
Developer
For pro audio needs you should not be using OBS in the first place, it's the wrong tool as everything will be passed through a mixing and encoding process. For audio mastering purposes you want the output to be direct from the device without any conversions or compression so you can manage all those things in the mastering process.

For the use cases that OBS is designed for (mixing a stream or recording for human consumption), 48 KHz is more than enough.
 

DayGeckoArt

Member
A higher sampling rate is not necessarily "better". At 48 KHz you can already reproduce any waveform below 24,000 Hz perfectly. The human voice is typically well below this level, and you're already at a range outside of human hearing, so there is no reason to go beyond this.
There is a very good reason to record in 96khz. You can export to both 48khz and 44.,1khz, for standard video and platforms that only support 44.1khz like Youtube. If you record in 48khz like most of us do, there is aliasing when that gets converted to 44.1khz. I'm not sure if I can notice a difference, but there is a difference. Recording in 96khz or 192khz stores a lot more samples that then get downsampled to either rate.
 

DayGeckoArt

Member
For pro audio needs you should not be using OBS in the first place, it's the wrong tool as everything will be passed through a mixing and encoding process. For audio mastering purposes you want the output to be direct from the device without any conversions or compression so you can manage all those things in the mastering process.

For the use cases that OBS is designed for (mixing a stream or recording for human consumption), 48 KHz is more than enough.
Maybe I'm missing something but isn't OBS recording directly from the mic? It's doing exactly what any other program does. It has lossless options including PCM, FLAC, and ALAC. I'm not sure what the alternative is. Record your audio in a separate program? But how do you make sure it's synchronized?
 

AaronD

Active Member
If you record in 48khz like most of us do, there is aliasing when that gets converted to 44.1khz. I'm not sure if I can notice a difference, but there is a difference.
Resampling done RIGHT, mathematically correct, is completely transparent. No audible difference at all, even between similar rates.

Effectively, in raw form, you:
  1. Oversample by stuffing zeros between samples, up to a common multiple.
  2. Lowpass at that insanely high sample rate, both as an anti-aliasing filter for the next step and to smooth out the waveform from all those zeros you stuffed in.
    • Also gain it up by the number of zeros that you stuffed in, compared to the number of original samples. Three zeros for every original would need a gain of 4, for example, to get back to the same level. This gain is easy to include as part of the lowpass filter itself.
  3. Pick out samples at the final rate, and throw the rest away.
And of course, there are optimizations to that:
  • Most commonly, a Finite Impulse Response (FIR) or convolution filter is used for the lowpass, and that has a massive opportunity to optimize, by only calculating the output samples that are actually used. Unlike an Infinite Impulse Response (IIR) filter that uses *all* samples internally, and so it must calculate all of them. The calculation is much simpler per sample for an IIR, but the sheer number of them dominates, to make FIR the better choice here.
  • And when you know how the two rates line up with each other, you can also figure out ahead of time which terms of the FIR equation are going to be zero (from the stuffing), and simply not calculate them or include them in the sum. Still mathematically perfect...if you haven't messed up that determination somehow.

All of that said, OBS itself does NOT resample. (at least, not correctly) This of course causes problems with different sources that use different rates, or even different clocks! The different-clocks problem is harder to solve, because they drift relative to each other, so the same nominal rate is not the same physical rate, and different micro-weather for each causes that drift to change too!

You'll never notice a single clock wandering like that, even if the wandering is different in playback than it was in recording. The total range is measured in tens of parts per million. But the artifacts from combining more than one of them are obvious without an asynchronous resampler, which more-or-less has to take the long way around as described above, with some of the optimizations unavailable, and a sufficiently high arbitrary intermediate rate that the error of not being an exact common multiple hardly matters.

Or you could connect a DAC to an ADC, right next to each other with very little opportunity for noise to get into it, and each of them uses their respective clocks. When you consider that the entire universe is practically digital because quantum, this is still effectively the same resampling as described above, with a truly insane but still finite intermediate sample rate.
 
Last edited:

AaronD

Active Member
Record your audio in a separate program? But how do you make sure it's synchronized?
For edited videos, I:
  1. Record the "real" audio in Audacity, while the camera puts its own internal mic in the video file.
  2. Use my editor's "Align to Reference" feature to line it up automatically.
  3. Mute the camera's soundtrack.
It works amazingly well, and I do get a very small fraction of a percentage speed up or slow down from the auto-alignment tool - different clocks, like I said in my previous post here - but nowhere near enough to notice.

I used to align them manually, and the drift was noticeable after a few minutes. Fortunately, I also had a lot of um's and multiple takes to whittle down, and each of those was an opportunity to re-align, so the final render was still unnoticeable.
 

Reticuli

New Member
Resampling done RIGHT, mathematically correct, is completely transparent.

Unless you're about to win a Nobel Prize on the subject, that's false. Even with look-ahead windowing functions, FIR-based sample rate conversion of audio is not completely transparent, let alone exactly reversible... though it's often 'good enough'. There are wildly differing methods of doing SRC, each with their own pros and cons, and if you're stuck without being able to add a delay or utilize look-ahead buffering of the SRC'ed material (e.g. pre-loaded audio and a lot of number crunching ability), then you're usually doing the horrendous linear variety which only even approximates the non-real-time higher quality types if it's a conversion that's halving or doubling.

The primary reason for OBS to actually allow something like 96khz sampling frequency audio would be to utilize real-time source software or hardware that natively outputs that rate... like some professional audio equipment that is fixed at 96. The OP's original request has become increasingly valid considering the weirdly growing list of gear that is set at that and actually can't be changed. It's true that when streaming in OBS the OS will first convert the rates over for you or you can just do DAC to ADC, but neither is optimal. It's also true that some sites like YouTube are capable of accepting and re-streaming higher rates now.

I wouldn't hold my breath that this capability ever gets added, but it has more merit than this thread has previously indicated.
 

julius_the_tiger

New Member
I bought a $7 HDMI capture device that has one flaw: it's reading 48 KHz stereo as 96 KHz interleaved mono. I would love to be able to capture this so that I could process the audio later in Audacity to fix.
 

AaronD

Active Member
...it's reading 48 KHz stereo as 96 KHz interleaved mono.
Ouch! I guess you get what you pay for. Perhaps whoever made it just happened to stumble onto a configuration that didn't cause the host computer to blow up, and shipped that. Cheap captures are practically random as to what you actually get and what they actually do, with either misleading listings or just flat-out wrong listings, and a lot of that randomness is outside the useful area.

I don't think you can use that audio stream in OBS. Not directly. Not just because of 96kHz, but also because OBS doesn't interlace like that. You might be able to run the capture through something *else* though, that gives you a stereo stream for OBS to pick up.

(Keep in mind also, that if you actually want dual mono out of this, OBS can't really split a multichannel source. The closest you can get to that is to have two copies of a stereo source, balance them hard in opposite directions, and then use the mono button to put the one remaining channel back in the center. Generally though, whatever independent streams you want in OBS, must be independent *already* - and correctly formatted already, in the sense that you described - as they come into OBS.)

If the conversion is live (in something other than OBS), then you might be home free, depending on what other "fun" that cheap capture has for you to deal with.

If the conversion can only be on a recording, then it's either a deal-killer for that device, or you use Audacity to record the audio, not OBS, and see if you can find a sort of "audio deinterlacer" as an Audacity effect.

You can't use OBS to record it, because OBS (almost) can't help modifying it along the way. It does that to save a TON of data in ways that are inaudible, but you have a special reqirement here. You still don't need bit-perfection (that's almost never a requirement for *anything* outside of forensics), but you do need sample-independence, which most of the available encoders still fail miserably at.

---

Thinking about how a WAV file works, it might not be a deal-killer just yet if you can't find a "fix-up" effect to use in Audacity. You could also export a WAV file from Audacity as the original 96kHz mono, open it in your favorite free hex editor, and tweak a few bytes up front (in the "header" section) to make it a 48kHz stereo WAV file with the exact same data. Listen to it to be sure, and if it's good, use that.

There are all kinds of places to look up how a WAV file works. It's an ancient format now, and practically common knowledge to anyone who wants it. And once you have that and a hex editor and you know how to do it manually, all you have left is to find a free beginners' programming kit (a real one, that runs on your local machine and actually does something useful, not an online thing that stays in the cloud), and make a quick-and-dirty app that does that tweak automatically. :-)
 
Top