Skip to main content

Notice

Please note that most of the software linked on this forum is likely to be safe to use. If you are unsure, feel free to ask in the relevant topics, or send a private message to an administrator or moderator. To help curb the problems of false positives, or in the event that you do find actual malware, you can contribute through the article linked here.
Topic: Question about the correct use of Case's Spatial Audio and Xaudio2 components. (Read 1362 times) previous topic - next topic
0 Members and 1 Guest are viewing this topic.

Question about the correct use of Case's Spatial Audio and Xaudio2 components.

Hi!

I guess that Case will jump in first, but everybody is welcome to answer.

In a thread in the support forum Case introduced these components.
I was about to ask my questions there but I thought that it could be more appropriate here.

So, first of all, thanks again for another cool component.
The Spatial Audio finally made me realize that actually there IS a difference between Windows Sonic, Dolby Atmos (which I got with my headphones) and DTS Headphone:X (which came with the laptop).
Until now, in Windows 11 Pro 23H2, when playing music in Foobar or in Spotify or watching stuff in Firefox or VLC, I could never hear any difference with or without any of those three DSPs active. So I thought that they all suck.
But now with this component I could make them work, and damn, they are COMPLETELY different.
Dolby Atmos for headphones SUCKS so bad that I am wondering if maybe there's something wrong going on. There's little feeling of space compared to the other two, and the sound becomes noticeably darker. I wouldn't use it for free, let alone paying for it.
DTS Headphone:X is the most spacious of the three without sounding unnatural, and Windows Sonic maybe is a little more natural or at least closer to the original sound but also noticeably less spacious (although more than Atmos).

Now, on a side note I'd LOVE if any of you happens to know how can I get these damn DSPs to work globally in Windows like any Store App is supposed to do.
Atm I have another "go to" for Foobar (the JB_Isone_Pro_Surround, much crispier sound, and support for very high sample rates).
But if I could get them to work globally in Windows I could use them with Spotify, Firefox, VLC etc.

Back on track, about the Spatial Audio component:
  • does it automatically resample audio (or have Windows resample it) to match the sample rate and bit depth of the active output device?
    Because it works also with 96000 and 192000 FLAC, although those three DSP only support up to 48000.
    For instance, if I have my headphones set at 96000, as soon as I activate one of those DSPs Windows sets my headphones at 48000.
    And with the Dolby Headphone Wrapper I had to use a resampler to downsample all at 48000 for it to work.
  • To the best of my knowledge, these DSPs are meant to work with stereo sources = don't need 5.1/7.1 material.
    Yet I wonder, am I supposed to use the 5.1 or 7.1 upmixer when using the Spatial Audio output, in order for those DSP to perform correctly/better?
    I've tried with the 5.1 upmixer. Other than it increases gain and (maybe because of that) it decreases the spatial effect, I don't see much change.
    Actually with some tracks (e.g. "Electronic Performers" by Air) if causes a wahwah up and down in loudness, which I think it might be what in another thread someone Case called "pumping" and described as a result of Windows' attempt to avoid clipping by reducing gain. To which Case of course has a component as solution :) Which is a bit weird btw, after so much effort to avoid clipping, having to use a clip-inducer to avoid Windows wahwah... Crazy.

And about the Xaudio2:
  • In another thread Case said that although now this component doesn't serve its original purpose of spatial virtualization, it's still a potentially better output than the default one at least in some setups, because (quote) "It lets OS do all the resampling and channel mixing. Current default WASAPI outputs will get resampled by foobar.".
    I fail to understand, why is it better if Windows handles the resampling & Co instead of Foobar?
  • I thought that to have resampling I had to place a resampler in the DSP chain.
    Now I start putting the puzzle together and atm my guess is that, unless exclusive mode is used, someone (Foobar or OS) must resample the tracks which are in a sample rate not supported by the audio device, and in case that's done by Foobar it happens in the background (I wonder with which resampler), silently, secretly.
    Is this so?
  • This borders a greater topic which might be worth exploring on a separate thread but let me ask just a couple questions.
    My Audeze Maxwell when connected via USB Dongle support 48000 and 96000, but I have lot of 44100 and some 88.200 and 192000 files.
    If there's such a thing as a silent resampling, either Foobar or the OS will resample those files to either 48000 or 96000 (silently).
    Question 1: how would they choose between 48 and 96? Would they default to the higher one?
    Question 2: if I have a resampler in the DSP chain, set to up/downsample all to 96000, would that prevent the silent resampling?
    Question 3: if so, would there still be a difference (and which) between using the default output or Xaudio2, considering that anyway the resampling is done by the DSP?

Damn, getting back to Foobar after a decade of Spotify is proving more complex than I had imagined.
But I enjoy this learning process...

Re: Question about the correct use of Case's Spatial Audio and Xaudio2 components.

Reply #1
Back on track, about the Spatial Audio component:
  • does it automatically resample audio (or have Windows resample it) to match the sample rate and bit depth of the active output device?
The component will automatically resample audio to the sampling rate used by the spatial audio engine, which seems to be hardcoded as 48 kHz. The component let's foobar2000 pick resampler automatically. If you wish to decide the used resampler, use the 'Advanced Preferences' -> 'Tools' -> 'Automatic resampling preference' configuration to override the preferred order.

  • To the best of my knowledge, these DSPs are meant to work with stereo sources = don't need 5.1/7.1 material.
    Yet I wonder, am I supposed to use the 5.1 or 7.1 upmixer when using the Spatial Audio output, in order for those DSP to perform correctly/better?
I think these effects are supposed to be at their best with multi channel input. The upmixers won't do anything good as they will just repeat the stereo data to extra channels.

And about the Xaudio2:
  • In another thread Case said that although now this component doesn't serve its original purpose of spatial virtualization, it's still a potentially better output than the default one at least in some setups, because (quote) "It lets OS do all the resampling and channel mixing. Current default WASAPI outputs will get resampled by foobar.".
That comment was meant mainly for people who use foobar2000 through Wine (Windows emulator). Some people have complained how foobar2000 unnecessarily resamples the audio only to then be fed to Linux's audio engine to be potentially resampled again to a different target. With XAudio2 Wine will get untouched, unresampled audio and it's free to do to it what it wants.

Now I start putting the puzzle together and atm my guess is that, unless exclusive mode is used, someone (Foobar or OS) must resample the tracks which are in a sample rate not supported by the audio device, and in case that's done by Foobar it happens in the background (I wonder with which resampler), silently, secretly.
Is this so?
Yes.

If there's such a thing as a silent resampling, either Foobar or the OS will resample those files to either 48000 or 96000 (silently).
Question 1: how would they choose between 48 and 96? Would they default to the higher one?
Question 2: if I have a resampler in the DSP chain, set to up/downsample all to 96000, would that prevent the silent resampling?
Question 3: if so, would there still be a difference (and which) between using the default output or Xaudio2, considering that anyway the resampling is done by the DSP?
The automatic silent resampling will always use the sampling rate selected in Windows as the sound device's mixing rate. If the data already matches that sampling rate then nothing is done. Note that automatic resampling is only done with non-exclusive outputs. Exclusive outputs don't perform any resampling automatically - they will hit you with an error message if you try to play content the hardware doesn't support.
You can manually configure resamplers to do what you wish though. For example if you download modified SoX resampler you can configure one instance where target samplerate is 48 kHz and set special samplerate handling to "Resample ONLY these rates:" and configure it to 1-48000. Then set another instance to target 96 kHz with settings "Resample everything EXCEPT these rates:" 1-48000.[/list][/list]

Re: Question about the correct use of Case's Spatial Audio and Xaudio2 components.

Reply #2
Ah, the multiple instances trick is cool, I will look into it.

Yes I had noticed that by selecting the exclusive output there is a popup error if the file's and device's sample rate don't match.
What I find fascinating is that it seems that the bit depth is not affected by the exclusive mode. If I select 24 in the output, and I play a 16bit file, as long as file's and device's sample rates match, the track plays perfectly.
Which makes me wonder, what happens when I play a 16bit file on a device set to 24bit? Will there be bit depth reduction and the file will play at 16bit, and do I therefore need dithering?
Or will there be bit depth increase, or just bypass?

When you say "If the data already matches that sampling rate then nothing is done", does this also mean that if I use a resampler in the DSP chain it will prevent automatic resampling?

I know that you don't like DSPs, but you have done lot of research while compiling these two components. Can you think at any reason why these spatial audio engines are not affecting any sound that I play anywhere in Windows?
Well, Dolby Atmos also has normalization and EQ besides spatial virtualization.
The EQ works. The normalization works. The virtualization makes zero difference.
DST Headphone:X offers some profiles for existing headphones and a generic one, plus a balanced and a spacious setting. I can hear a difference in the color of the sound if I use my Sony WH-1000XM3 with their preset or with the generic one. The generic makes them brighter. But ZERO spatial virtualization with this engine on or off, or between balanced and spacious.
Same story with Windows Sonic. ZERO difference with or without.
Using your component was almost shocking, as I had no idea that these engines could do that.

If you can think at any way to make them work everywhere, it would be great.

Either way thanks again for the help!

Re: Question about the correct use of Case's Spatial Audio and Xaudio2 components.

Reply #3
Which makes me wonder, what happens when I play a 16bit file on a device set to 24bit?
It will be played back at 24 bps. That just means the lowest bits are padded with zeroes. It won't affect anything and you definitely don't need dithering.

When you say "If the data already matches that sampling rate then nothing is done", does this also mean that if I use a resampler in the DSP chain it will prevent automatic resampling?
Automatic resampling isn't performed when it isn't needed. If the source samplerate matches target samplerate resampling step is skipped. If you have a resampler in the chain with wrong sample rate then automatic resampling will be performed.

I know that you don't like DSPs, but you have done lot of research while compiling these two components. Can you think at any reason why these spatial audio engines are not affecting any sound that I play anywhere in Windows?
I'm not against DSPs, I just don't like effects that try to simulate speakers with headphones. It's just unrealistic and wrong.

I'm not certain about your question. But all extra processing causes latency. Perhaps Microsoft didn't want to force extra lantency to low-level audio interfaces.

If you can think at any way to make them work everywhere, it would be great.
Not sure this is a solution for you, but you could add effects to entire OS using Equalizer APO.

Re: Question about the correct use of Case's Spatial Audio and Xaudio2 components.

Reply #4
I'm not certain about your question. But all extra processing causes latency. Perhaps Microsoft didn't want to force extra lantency to low-level audio interfaces.

I don't think so.
Let me explain.
DTS Headphones:X, Dolby Atmos for Headphones, Windows Sonic for headphones...
They all are supposed to do the same: exactly what you hate. Simulating the sound of speakers through headphones, more or less.
How each of them affects the sound is different. But the result should be CLEARLY noticeable, immediately, with not a shred of doubt, no arduous A/B needed to see if something changed.
AND, they work globally. Meaning that they affect ANY sound, the movie you're watching in VLC, the YouTube you're watching in Firefox, the music you're listening in Foobar or in Spotify, etc.

In my case, they NEVER do that, with no sound, from no source.
That's why I thought that they were just poorly made.
But as soon as I tried your Spatial Audio I realized that they are NOT poorly made, they were simply not working. Something in my system prevents them from being active.

Is there anything in what you had to do to make them work in Foobar that could make you think at a solution to why they in my case don't work at all, even outside Foobar?
What did you do to make them work in Foobar? What was the issue that was not making them work?
Maybe understanding "your" issue and how you solved it, I can find more about my issue and how to solve it.

Equalizer APO won't work, because it's not about ANY effects. It's those specific spatial engines which I already have, and they can't be integrated in Equalizer APO like the MathAudio effects.


About your statement that making headphones sound like speakers is unrealistic and wrong, I disagree.
Unrealistic is that there are "speakers" attached to our ears and that they push the sound directly in the ears, right channel in the right ear, left channel in the left ear, complete separation.
That is NOT how our ears work.
All what we ear, be it a sound in nature or music from speakers, is always coming to us in such a way that the sound gets mixed, a bit of left in the right, a bit or right in the left. Unless we are in an anechoic chamber of course. But even there still a bit.
That's why some people consider using crossfeed with headphones a must.
But that alone can't change the fact that our brain and ears are still able to sense that the sound comes few cm from our ears and in a separated way.
So there are binaural this and spatial virtualizer that, not unrealistically "simulate speakers", but to compensate the UNNATURAL sound of headphones and make it closer to our ears' NATURAL way or hearing when there are no tiny speakers attached to them.
So, the secret is having good headphones with already a good soundstage and image, and then using a GOOD spatial effect which doesn't sound weird like cheap reverb.
If either the effect or the headphones suck, yes, it's unrealistic and wrong.
Otherwise, it's magic.

But it's also matter of tastes I guess :)

Re: Question about the correct use of Case's Spatial Audio and Xaudio2 components.

Reply #5
The best DSP for headphones is reverse ambiophonics. Ordinarily, ambiophonics removes inter-channel crosstalk. In other words, it makes speakers sound like headphones. (Some people like that.) What I do is change the '-' in the processing chain to a '+'. So, instead of removing cross talk that is normally present when listening with speakers, it adds crosstalk that is normally absent when listening with headphones. By changing the recursion parameters, one can recreate the sound of a near-field, or far-field speaker setup or anything in between. It's spooky.
Jon Bokelman

Re: Question about the correct use of Case's Spatial Audio and Xaudio2 components.

Reply #6
The best DSP for headphones is reverse ambiophonics.

Does it come in VST so that it can be used in Foobar with the VST adapter?
Is it free?
And how do I do the -/+ trick exactly?

Re: Question about the correct use of Case's Spatial Audio and Xaudio2 components.

Reply #7
Ok, I misunderstood your question a bit then. The spatial processors are not supposed to affect everything globally. They only affect software using the special Spatial Audio programming interfaces provided by Windows.

Higher level audio interfaces like the old DirectSound (which Microsoft asks you not to use) or its replacement XAudio2 have/had some automation to get basic spatial processing automatically enabled for them. With XAudio2 it for example was enabled automatically for certain profiles and you could opt-out by using a different playback category. But as my output component shows, Microsoft figured foobar2000 isn't a game that should get automatic spatial treatment and it got disabled in some update.

Only old software uses DirectSound anymore and Microsoft is trying to get everyone to stop using it. The newer audio APIs require one to specially code support for Spatial Audio. That is why I too had to make an entirely new audio output component for people to be able to use it with foobar2000.

Re: Question about the correct use of Case's Spatial Audio and Xaudio2 components.

Reply #8
Ok, I misunderstood your question a bit then. The spatial processors are not supposed to affect everything globally. They only affect software using the special Spatial Audio programming interfaces provided by Windows.
Noooo!
Why....

And what are these software?
Is there any to listen to music?
To watch videos?
To stream stuff?
Or does Microsoft assume that all these spatial engine have the one and only purpose of making games more immersive?
Dolby Atoms CLEARLY has only ONE mode for game, and then it has music, movies, voice and 3 custom sections. And NONE of them does ANYTHING unless it's in a game? What sense does this make?
Same exact story for DTS:X Ultra.
And DTS Headphone:X has presets for a lot of NON GAMING headphones like the Sony WH-1000XM3.

There's afaik no legal clause in any of those spatial engines that binds them to only games.

My laptop is not even remotely a gaming laptop either, yet it came with those 2 DTS things.

This pisses me off.
It's not ok.
How can one bypass this stupid imposition in let's say at least Firefox?
I make a Case for it! :)

Re: Question about the correct use of Case's Spatial Audio and Xaudio2 components.

Reply #9
Quote
Does it come in VST so that it can be used in Foobar with the VST adapter?
Is it free?
And how do I do the -/+ trick exactly?
Why don't you try doing something for yourself instead of demanding others to give you what ever you want.

If you were to search the foobar forums for "ambiophonics" you would find a thread titled "foo_dsp_ambio". Foo_dsp_ambio is the plugin I wrote years ago. The current version has several new features, including the '-/+' trick, but you'll never get it. You see, based on my experience, back then, sharing my work in internet forums was a huge waste of my time for little reward. I abandoned "j_b" and the forums.

Recently, I thought I would try again but for some reason I couldn't get the "j_b" user id working, hence "tam lin". But, alas, the forums are still the same waste of time. I can't be bothered helping people who aren't willing to help them selves.
Jon Bokelman

 

Re: Question about the correct use of Case's Spatial Audio and Xaudio2 components.

Reply #10
the forums are still the same waste of time. I can't be bothered helping people who aren't willing to help them selves.
I agree with you, stop wasting your time writing to me, it's not welcome, I really don't like the way you think and the way you handle people, nor your narcissistic conviction that everything but what you write is bad. Maybe it's even true, but the way you present it is so unpleasant that it doesn't even make me wanna look into it.
No idea what you experienced in the past, nor if that made you into what you are now or if you were already like this and that's why you experienced that, and I don't care. I simply don't allow anybody to talk to me like this, period.
Bye.