INTERACT FORUM

Please login or register.

Login with username, password and session length
Advanced search  
Pages: [1]   Go Down

Author Topic: Why is exclusive use needed for higher res?  (Read 15484 times)

zenpmd

  • World Citizen
  • ***
  • Posts: 221
Why is exclusive use needed for higher res?
« on: May 11, 2015, 12:47:47 pm »

VLC plays fine without such a thing. I really dont like exclusive use but some flac downloads are 96khz so I have no choice if I want to play them
Logged

mwillems

  • MC Beta Team
  • Citizen of the Universe
  • *****
  • Posts: 5234
  • "Linux Merit Badge" Recipient
Re: Why is xclusive use needed for higher res?
« Reply #1 on: May 11, 2015, 12:53:34 pm »

Because the system mixer has to be set to a specific sample rate in order to mix sounds.  Sound devices can generally only output one sample rate at any given time, so in order for multiple applications to output to the same device at the same time they have to either 1) "agree" on a sample rate or 2) the system needs to resample all input to the same rate before output.

The windows mixer transparently resamples all audio to whatever sample rate is set in the windows control panel, unless you use an exclusive audio output mode to bypass the mixer. So VLC may play the 96KHz file, but windows promptly resamples it down to 44KHz without telling you (or whatever sample rate you have set in control panel).

The only way to be certain that your 96KHz file is actually being output to your DAC as a 96KHz file is to use exclusive access methods (or set your windows sound device to 96KHz, but then everything else will get resampled to 96KHz by the windows mixer, etc.)
Logged

zenpmd

  • World Citizen
  • ***
  • Posts: 221
Re: Why is xclusive use needed for higher res?
« Reply #2 on: May 11, 2015, 12:59:15 pm »

so is it, because, in effect, vlc is using onboard DAC? In other words, if VLC was using my external DAC it too would have to take exclusive control?
Logged

zenpmd

  • World Citizen
  • ***
  • Posts: 221
Re: Why is xclusive use needed for higher res?
« Reply #3 on: May 11, 2015, 12:59:56 pm »

Very interesting set up in your sig there, by the way! I use Ncores so like Hypex a lot :)
Logged

mwillems

  • MC Beta Team
  • Citizen of the Universe
  • *****
  • Posts: 5234
  • "Linux Merit Badge" Recipient
Re: Why is xclusive use needed for higher res?
« Reply #4 on: May 11, 2015, 01:04:38 pm »

so is it, because, in effect, vlc is using onboard DAC? In other words, if VLC was using my external DAC it too would have to take exclusive control?

No, it's not a DAC dependent issue.  I'm not aware of any commercially available DAC that can playback more than one sample rate at a time, and the windows mixer does what it does regardless of your hardware.  If you want to playback material with different sample rates you need to set the hardware to the appropriate sample rate; because hardware has to have a single sample rate that requires taking control of the hardware.  

As noted above, if you want to playback high res files in high resolution you either need to use an exclusive mode, or pick one high res sample rate and resample everything to that one sample rate (either by letting windows do it, or using MC's DSP studio).

Very interesting set up in your sig there, by the way! I use Ncores so like Hypex a lot :)

I've been very happy with mine.  I may grab some ncores one day, but for now the UcD's are amazing for the price.
Logged

zenpmd

  • World Citizen
  • ***
  • Posts: 221
Re: Why is xclusive use needed for higher res?
« Reply #5 on: May 11, 2015, 01:13:57 pm »

In that case how do I let windows resample when using j river?

Basically I want to achieve playback of all sample rates without using exclusive use.

Sample rate is a laod of BS as far as I am concerned and high res is a total con, so I dont mind if it resamples
Logged

mwillems

  • MC Beta Team
  • Citizen of the Universe
  • *****
  • Posts: 5234
  • "Linux Merit Badge" Recipient
Re: Why is xclusive use needed for higher res?
« Reply #6 on: May 11, 2015, 01:21:14 pm »

Use WASAPI (but uncheck the box for exclusive use), or use "Direct Sound" as your output option.

Just FYI, the windows resampler is not the best resampler, and even if you're not a fan of hi res (I'm not a fan of it myself) resampling is not necessarily transparent/lossless.  If you really want to resample everything, you'd probably be better off using the JRiver resampler to set everything to one sample rate (in output format under DSP studio).
Logged

zenpmd

  • World Citizen
  • ***
  • Posts: 221
Re: Why is xclusive use needed for higher res?
« Reply #7 on: May 11, 2015, 01:30:23 pm »

I dont want to resample if I can get away with it.

are you saying WASAPI means I can play any sample rate and not have to have exclusive use?
Logged

mwillems

  • MC Beta Team
  • Citizen of the Universe
  • *****
  • Posts: 5234
  • "Linux Merit Badge" Recipient
Re: Why is xclusive use needed for higher res?
« Reply #8 on: May 11, 2015, 01:35:12 pm »

I dont want to resample if I can get away with it.

are you saying WASAPI means I can play any sample rate and not have to have exclusive use?

No.  I'm not aware of any way to playback different sample rates without resampling other than exclusive use.  Using WASAPI without exclusive access just let's windows do the resampling if need be (to my knowledge)
Logged

Awesome Donkey

  • Administrator
  • Citizen of the Universe
  • *****
  • Posts: 7804
  • Autumn shade...
Re: Why is xclusive use needed for higher res?
« Reply #9 on: May 11, 2015, 01:44:28 pm »

Using WASAPI without exclusive access just let's windows do the resampling if need be (to my knowledge)

You'd be correct. If you want to playback a hi-res file at the native sample rate, you need to use WASAPI exclusive, ASIO (if it's available with your hardware) or kernel streaming (if it's available). Other than those you'd be at the mercy of Windows' mixer and resampling.
Logged
I don't work for JRiver... I help keep the forums safe from "male enhancements" and other sources of sketchy pharmaceuticals.

Windows 11 24H2 Update 64-bit + Ubuntu 24.10 Oracular Oriole 64-bit | Windows 11 24H2 Update 64-bit (Intel N305 Fanless NUC 16GB RAM/500GB M.2 NVMe SSD)
JRiver Media Center 33 (Windows + Linux) | iFi ZEN DAC 3 | JBL 306P MkII Studio Monitors | Audio-Technica ATH-M50x Headphones

glynor

  • MC Beta Team
  • Citizen of the Universe
  • *****
  • Posts: 19608
Re: Why is xclusive use needed for higher res?
« Reply #10 on: May 11, 2015, 01:47:22 pm »

Using WASAPI without exclusive access just let's windows do the resampling if need be (to my knowledge)

This is not correct.  Microsoft does not support automatic resampling on WASAPI at all.  To get that, you have to go to DirectSound.  In WASAPI non-exclusive, playback fails if the sample rate doesn't match the selected default output format in Windows.

VLC and other similar applications just use DirectSound or Wave Out, and so always resample everything through the kernel mixer.

This stuff is included in the wiki article about Exclusive Access:
http://wiki.jriver.com/index.php/Exclusive_Access

Read that.  It explains the options and alternatives fairly clearly.
Logged
"Some cultures are defined by their relationship to cheese."

Visit me on the Interweb Thingie: http://glynor.com/

mwillems

  • MC Beta Team
  • Citizen of the Universe
  • *****
  • Posts: 5234
  • "Linux Merit Badge" Recipient
Re: Why is xclusive use needed for higher res?
« Reply #11 on: May 11, 2015, 02:25:42 pm »

This is not correct.  Microsoft does not support automatic resampling on WASAPI at all.  To get that, you have to go to DirectSound.  In WASAPI non-exclusive, playback fails if the sample rate doesn't match the selected default output format in Windows.

That makes sense, I stand corrected.  So to use the windows mixer it's direct sound or nothing.
Logged

glynor

  • MC Beta Team
  • Citizen of the Universe
  • *****
  • Posts: 19608
Re: Why is xclusive use needed for higher res?
« Reply #12 on: May 11, 2015, 02:29:00 pm »

So to use the windows mixer it's direct sound or nothing.

Well, if you love latency +500ms you can use Wave Out like an animal.
Logged
"Some cultures are defined by their relationship to cheese."

Visit me on the Interweb Thingie: http://glynor.com/

mwillems

  • MC Beta Team
  • Citizen of the Universe
  • *****
  • Posts: 5234
  • "Linux Merit Badge" Recipient
Re: Why is exclusive use needed for higher res?
« Reply #13 on: May 11, 2015, 02:31:39 pm »

Well, if you love latency +500ms you can use Wave Out like an animal.

I don't see wave out in my list of outputs in MC; was that eliminated in more recent versions of windows?  I don't have any windows boxes running anything older than 7.
Logged

glynor

  • MC Beta Team
  • Citizen of the Universe
  • *****
  • Posts: 19608
Re: Why is exclusive use needed for higher res?
« Reply #14 on: May 11, 2015, 02:38:29 pm »

I think so.  I think the API still works, but MC hides it now on Vista+.
Logged
"Some cultures are defined by their relationship to cheese."

Visit me on the Interweb Thingie: http://glynor.com/

zenpmd

  • World Citizen
  • ***
  • Posts: 221
Re: Why is exclusive use needed for higher res?
« Reply #15 on: May 11, 2015, 03:18:36 pm »

Thanks but that link doesn't explain direct sound? Is that not what I am after?
Logged

glynor

  • MC Beta Team
  • Citizen of the Universe
  • *****
  • Posts: 19608
Re: Why is exclusive use needed for higher res?
« Reply #16 on: May 11, 2015, 03:52:18 pm »

Thanks but that link doesn't explain direct sound? Is that not what I am after?

It depends what you want to do.  DirectSound is the legacy setup for sound in Windows, and it routes everything through the kernel mixer, and does automatically resample on the fly. MC has no control over the resampler, in this instance.

Exclusive Access is a feature of WASAPI on Windows and CoreAudio on OSX.  If you are using other APIs to access your sound device, then those rules don't apply.  DirectSound is the "old cruddy way" which cannot control remixing, but maybe that is what you want.

Some of the things you said above would seem to indicate that you WANT Exclusive Access enabled, but want a magic solution that doesn't exist.  The article covers the options.

You can:
* Use WASAPI with Exclusive Access, and then MC will play all formats your device supports natively without resampling.  But, you can't use the sound device with other applications while MC is playing or paused.
* Use WASAPI in Shared Mode, which means you MUST resample all formats to match whatever setting you have selected in the Windows Sound control panel as the default for your audio device.  But, you can share the device then.
* Use DirectSound which goes through the kernel mixer and lets Windows resample whatever it wants and MC has no control.
* Use a hardware device with a good ASIO driver.
Logged
"Some cultures are defined by their relationship to cheese."

Visit me on the Interweb Thingie: http://glynor.com/

zenpmd

  • World Citizen
  • ***
  • Posts: 221
Re: Why is exclusive use needed for higher res?
« Reply #17 on: May 11, 2015, 03:55:27 pm »

Got you. SO it goes back to the original point - if I am using an external DAC, and I want it to play all sample rates, then I HAVE to use exclusive access and that is a windows limitation, right?

What about Linux?
Logged

glynor

  • MC Beta Team
  • Citizen of the Universe
  • *****
  • Posts: 19608
Re: Why is exclusive use needed for higher res?
« Reply #18 on: May 11, 2015, 03:59:35 pm »

Got you. SO it goes back to the original point - if I am using an external DAC, and I want it to play all sample rates, then I HAVE to use exclusive access and that is a windows limitation, right?

Well... It is a theoretical limitation imposed by the entire idea of a digital mixer.

The same thing applies to all OSes.

You cannot mix different sample rates together digitally.  The ONLY OPTION is to resample something to match the output format.  That's why WASAPI locks the audio device to a single application, because only then can you guarantee some other thing isn't going to make some sound that needs to be mixed in.

It works the same way on OSX, except that playback never fails because CoreAudio will automatically resample when needed (like DirectSound used to on Windows).  CoreAudio has a way less brain-dead resampler, of course, but it still isn't as nice as MC's.
Logged
"Some cultures are defined by their relationship to cheese."

Visit me on the Interweb Thingie: http://glynor.com/

zenpmd

  • World Citizen
  • ***
  • Posts: 221
Re: Why is exclusive use needed for higher res?
« Reply #19 on: May 11, 2015, 04:01:46 pm »

But why cant there be an option that playback just fails if something else trys to play at a different sample rate?

Unless I am misunderstanding you, I dont understand why my j river installation will play standard 16/44 without exclusive use, but wont play anything else?
Logged

glynor

  • MC Beta Team
  • Citizen of the Universe
  • *****
  • Posts: 19608
Re: Why is exclusive use needed for higher res?
« Reply #20 on: May 11, 2015, 04:10:23 pm »

But why cant there be an option that playback just fails if something else trys to play at a different sample rate?

I don't understand what you're asking.  You mean you want it to let MC control the audio device and switch it into different modes, and then have it suddenly "on the fly" stop/error playback in MC whenever another system sound happens that needs to alter the sample rate?

You can't do that because of the playback buffers.  It would crash MC, and very likely the other application as well (which could be the OS).

You cannot play a 44.1kHz and a 48kHz file at the same time on the same hardware. Period.  The only option is for one or the other application to resample, or for playback of one or the other to fail.  The way WASAPI works is that you can "lock" the device, causing other applications' attempts to access the device to fail.  Again, this only happens while MC is actively playing back audio.

Unless I am misunderstanding you, I dont understand why my j river installation will play standard 16/44 without exclusive use, but wont play anything else?

This is covered in the article I linked, in great detail.  When you disable Exclusive Access in WASAPI mode, the only output format that works is the one you've selected as the default for that device in the Windows Sound Control Panel.

If you go to the Windows Sound control panel and set the default for that device to 48kHz, then all of your 44.1kHz files will fail to play.
Logged
"Some cultures are defined by their relationship to cheese."

Visit me on the Interweb Thingie: http://glynor.com/

zenpmd

  • World Citizen
  • ***
  • Posts: 221
Re: Why is exclusive use needed for higher res?
« Reply #21 on: May 11, 2015, 04:15:34 pm »

So what is the reason why JRiver cannot just play any sample rate when not in exclusive use? Ie. why does it follow the default for the sound device in the control panel. Your points are circular?
Logged

ferday

  • MC Beta Team
  • Citizen of the Universe
  • *****
  • Posts: 1732
Re: Why is exclusive use needed for higher res?
« Reply #22 on: May 11, 2015, 04:30:33 pm »

So what is the reason why J River cannot just play any sample rate when not in exclusive use? Ie. why does it follow the default for the sound device in the control panel. Your points are circular?

Because windows has control over the sample rate, and sets your chosen sample rate to the default audio device.  If you set the windows default to 96k, then JRiver will only play 96k without exclusive mode!  44.1 isn't special, it's just default.

Without granting exclusive access to WASAPI, windows maintains that control and will resample (or fail to play) all other sample rates.  Exclusive mode is the only way to switch off windows death grip on the audio device.

The link glynor has posted (twice) explains it pretty in depth. 

The best way around it is to use multiple audio devices. 
Logged

glynor

  • MC Beta Team
  • Citizen of the Universe
  • *****
  • Posts: 19608
Re: Why is exclusive use needed for higher res?
« Reply #23 on: May 11, 2015, 05:26:02 pm »

Hmmmm... Maybe we'll start again. The way VLC works by default is using the DirectSound API.  If you want MC to work just like VLC, put MC in DirectSound mode.  What happens when you do this (which is also what happens when you use VLC) is:

* Applications can send DirectSound audio in any supported format (so, VLC can "play" a 24-bit 96kHz audio file).
...however...
* All audio is resampled by Windows to the format specified in the Sound control panel.
* So, if you have Windows set to 16-bit 44.1kHz (as you do from your comments above), you never actually get 24-bit 96kHz audio because Windows resamples it before it gets to your audio device driver.

DirectSound is very "sharing friendly" but it essentially resamples everything, and it does so "outside" of the application (at the OS level). The application has no idea what format is going to the sound driver.

You can change VLC to use WASAPI in its advanced options, but don't because from everything I've read, it is horribly broken and basically doesn't work at all.

WASAPI is a much better audio API because it works around these limitations in one of two ways:

1. An application can play an exclusive-mode stream. While this stream is active, the audio device's full capabilities are exposed to the application, but it is up to the application to deliver a format compatible with the device.  And, while the exclusive mode stream is active, Windows blocks all other applications (including itself) from using the audio device.

2. An application can play a shared-mode stream. In this case, the application must deliver audio in the format specified by Windows. Applications playing shared-mode streams can only "see" and access the one setting set in the Windows Sound control panel.  That way, you know no "secret, dirty resampling" is happening behind the scenes (as it does in DirectSound mode) but all audio played on the system must be played in the user's selected format (and the user can only specify one).

Those are the choices.  If you want to play multiple formats (different sample rates) to the same audio output device on your computer:

* Without resampling: Your only choice is to enable Exclusive Access.
* With MC doing the resampling: Enable WASAPI and disable Exclusive Access, and you must set MC to resample to the option you have selected in the Windows Sound control panel.  The Output Format DSP can do this, and you would be well advised to set Windows to the highest settings supported by your sound device.
* With Windows doing the resampling: Enable DirectSound in MC, and Windows will automatically resample all system audio (including MC) to whatever setting you've specified in the Windows Sound control panel.
* Maybe Without Resampling: Use a "professional" device with an ASIO driver. But, most applications can't play to ASIO devices at all, so this isn't really the same thing. And, the ASIO device has the same limitations so it either does the same thing as Exclusive Access (this is most of them I've seen), it resamples the audio itself, or it has some kind of crazy analog mixer with multiple internal DACs.

That's it. The only other option is to use multiple sound output devices and a hardware (analog) mixer (or to play to discreet speakers). None of this has anything to do with external DACs or any of that. The same rules apply to all sound devices.
Logged
"Some cultures are defined by their relationship to cheese."

Visit me on the Interweb Thingie: http://glynor.com/

zenpmd

  • World Citizen
  • ***
  • Posts: 221
Re: Why is exclusive use needed for higher res?
« Reply #24 on: May 12, 2015, 01:06:30 am »

Absolutely fantastic, thank you Glynor that is a great explanation. You gotta put that in the wiki!!
Logged

zenpmd

  • World Citizen
  • ***
  • Posts: 221
Re: Why is exclusive use needed for higher res?
« Reply #25 on: May 13, 2015, 12:44:03 pm »

Now I know why I turned exclusive use off.... Everytime this happens now. It wont release from the web browser.

http://s28.postimg.org/rcpttribh/Capture.jpg
Logged

glynor

  • MC Beta Team
  • Citizen of the Universe
  • *****
  • Posts: 19608
Re: Why is exclusive use needed for higher res?
« Reply #26 on: May 13, 2015, 12:56:58 pm »

What's your default audio output device?

That screenshot is too small as well, so I can't see the play state of MC.
Logged
"Some cultures are defined by their relationship to cheese."

Visit me on the Interweb Thingie: http://glynor.com/

zenpmd

  • World Citizen
  • ***
  • Posts: 221
Re: Why is exclusive use needed for higher res?
« Reply #27 on: May 13, 2015, 12:59:35 pm »

there is no play state, that is what happens when I attempt to play.

default audio output is my external dac
Logged

fitbrit

  • MC Beta Team
  • Citizen of the Universe
  • *****
  • Posts: 4887
Re: Why is exclusive use needed for higher res?
« Reply #28 on: May 13, 2015, 04:28:17 pm »

In your playback devices within MC, please recheck that the wasapi selected really is for the device you are intending it to go through.
Logged

altae

  • Recent member
  • *
  • Posts: 10
Re: Why is exclusive use needed for higher res?
« Reply #29 on: May 13, 2015, 07:41:37 pm »

I guess it is somewhat hardware/ software dependent. On my system with a Creative soundcard (optical output to the receiver) I can control the soundcard's internal sampling rate so it works as follows:

The setting in the Windows control panel controls the sampling rate of the Windows mixer, everything that runs through there is resampled at that sampling rate and than passed on to the soundcard. If it does match the soundcards internal sampling rate it is played as it is. But if it does not match it is resampled one more time in order to match the soundcards internal sampling rate. But this only applies if the soundcard is run in the so called audio creation mode. Otherwise the soundcard's internal sampling rate matches the one set in the Windows control panel.

Since I use MC together with ASIO the soundcard's internal sampling rate is selected by MC depending on the sampling rate of the audio file that is currently beeing played. Remember, the audio stream of MC/ ASIO bypasses the Windows mixer. On the other hand, everything that comes from the Windows mixer and does not match the currently active internal sampling rate of the soundcard gets resampled one more time to match that sampling rate. This way I can playback any file at any sampling rate supported by the soundcard without using exclusive mode. But it only works with ASIO, not with WASAPI or kernel streaming. I can confirm that this definitely works since I can check the currently active sampling rate on my receiver and it always matches the one of the source played back with MC.

Of course I do not know if this setup would also work with other hard- or software.
Logged

zenpmd

  • World Citizen
  • ***
  • Posts: 221
Re: Why is exclusive use needed for higher res?
« Reply #30 on: May 21, 2015, 01:39:03 am »

Having looked into this further, if you are going to use exclusive use, I can see that in order for smooth operation YOU ABSOLUTELY MUST also check "give exclusive mode applications priority". This should be in the wiki page if it isnt already. Failure to do this will result in repeated playback failures.
Logged

mwillems

  • MC Beta Team
  • Citizen of the Universe
  • *****
  • Posts: 5234
  • "Linux Merit Badge" Recipient
Re: Why is exclusive use needed for higher res?
« Reply #31 on: May 21, 2015, 06:59:34 am »

Having looked into this further, if you are going to use exclusive use, I can see that in order for smooth operation YOU ABSOLUTELY MUST also check "give exclusive mode applications priority". This should be in the wiki page if it isnt already. Failure to do this will result in repeated playback failures.

Two points:
1) That box is checked by default on Windows.  
2) This info is already on the wiki page that glynor linked you to twice above.

From the wiki http://wiki.jriver.com/index.php/Exclusive_Access:
Quote
Windows should default to allowing exclusive access (as described above), but you can verify this by:

1.   Open the Sound control panel in Windows
2.   Select your device and click Properties.
3.   Switch to the Advanced tab.
4.   Ensure that Allow applications to take exclusive control of this device and Give exclusive mode applications priority are both enabled.

The wiki then goes on to explain that failure to enable exclusive access will lead to playback failures in some circs.
Logged

zenpmd

  • World Citizen
  • ***
  • Posts: 221
Re: Why is exclusive use needed for higher res?
« Reply #32 on: May 21, 2015, 07:51:17 am »

The second option was not on by default and, even if it was, there should be a reminder "make sure"...

And my original point was more that exclusive access was causing problems, not not having exclusive acces...
Logged

glynor

  • MC Beta Team
  • Citizen of the Universe
  • *****
  • Posts: 19608
Re: Why is exclusive use needed for higher res?
« Reply #33 on: May 21, 2015, 10:13:24 am »

It definitely is the default option in Windows.

Whether disabling this impacts playback reliability depends on your specific audio hardware and drivers.  It is not a universal rule.  But, as mwillems pointed out, it is in there (I know, I wrote it).
Logged
"Some cultures are defined by their relationship to cheese."

Visit me on the Interweb Thingie: http://glynor.com/

fitbrit

  • MC Beta Team
  • Citizen of the Universe
  • *****
  • Posts: 4887
Re: Why is exclusive use needed for higher res?
« Reply #34 on: May 21, 2015, 01:07:49 pm »

That's another issue, glynor. I don't see any reminders to read the Wiki carefully. They should be there as a default.
And the reminders should have reminders to look at the reminders.
Logged
Pages: [1]   Go Up