Is WASAPI limited to 44000Hz?

Hi,
I am still running Audacity 2.0.4. I thought that WASAPI was limited to 44000Hz, but I just recorded streaming music through WASAPI with 96000Hz as the Project rate, and saved it to FLAC without any apparent problem.
Was the WASAPI limitation linked to the audio drivers (I just updated my Realtek drivers)?
Robert

It gets rather complicated… I found some information on [u]this page[/u]. It looks like there is a mode where Windows can re-sample whatever is coming out of the hardware. In another mode, you get whatever you hardware supports.

Was the WASAPI limitation linked to the audio drivers (I just updated my Realtek drivers)?

Yes. The drivers and the hardware. WASAPI is a driver protocol. From what I understand, there is a “driver stack” (where drivers talk to drivers, the digital audio stream passes through several drivers. Some of those drivers are supplied with Windows).

but I just recorded streaming music through WASAPI with 96000Hz…

Was that intentional? It’s very unlikely that the streaming audio was 96kHz, so the main effect of up-sampling would be a bigger file.

Hi Doug,
Information can be found on the following pages, but they are unclear what are the sample rate limitation of WASAPI.

WASAPI
About WASAPI
What’s up with WASAPI?

Streaming audio can have high sample rates. Here is what is offered at http://www.sky.fm:

Our free service streams:

MP3: 96 kbits/sec
AAC-HE: 40 kbits/sec
Windows Media: 40 kbits/sec

Our Premium service streams:

MP3: 256 kbits/sec
AAC: 128 kbits/sec
AAC-HE: 64 and 40 kbits/sec
Windows Media: 128 and 64 kbits/sec

I normally use WDM-KS to record streaming audio or cassette deck output. It works fine on my system. I might be deluded but after extensive testing, I found that FLAC files created from WDM-KS recording at 96kHz gave me the best rendition (for classical music).

As I said, I have just updated my Realtek drivers to their latest Windows 8.1 version. So I checked that everything was still working fine. WDM-KS is still working fine. I also tested WASAPI out of sheer curiosity. Up to now I had assumed that WASAPI was limited to 48kHz (at some point, I read something to that effect in the Audacity online manual). But it turned out that I can (now?) use WASAPI to record at 96kHz, which is described as “Studio Quality” in the Windows Sound Panel applet. I could even use 192kHz which is supposed to be even higher “Studio Quality”.

Cheers,
Robert

I don’t see anything there over 256 kbps even for the paid premium accounts.
“kbps” is not the same as “kHz”.

“kbps” refers to then number of “bits” (a digital 1 or 0) per second (the “bit rate”).

“kHz” refers to the sample rate. For CD quality, each sample period requires 4 bytes (2 bytes per channel) and a “byte” is 8 “bits”. Thus for true CD quality (16 bits per channel, 2 channel stereo, 44100 samples per second) the “bit rate” is 1411200 bits per second, which is approximately 1400 kbps.

You are right. There is interesting information on this subject at Check Bit Rate of Streaming Audio and What does the bit depth and sample rate refer to. Also audio samples at different bit rates are available from PowerStream Audio Samples and High Definition Audio Test Files.

It seems 160 kbps 44 kHz Stereo is the best we can expect from streaming audio.

Just some reference points…

256 kbps (kilobits per second) is the (approximate) bit rate you get when you download an MP3 from Amazon or an AAC file from iTunes. (320kbps is the maximum allowed for MP3.)

44.1 kHz (samples per second) is the CD sample rate. DVDs are 48kHz. Recording studios typically record at 96kHz/24-bit.

For uncompressed audio, you can calculate the bitrate from the sample rate… CDs are stereo (2-channels) of 16-bit audio at 44,100 samples per second.

So… 44.1kHz x 2 channels x 16-bits = 1411.2 kbps for a CD.

And if you know there are 8 bits in a byte, you can calculate file size from the bitrate and the playing time.

…but they are unclear what are the sample rate limitation of WASAPI

As I understand it…

There are no limitations in the default mode. You can have a consumer soundcard/soundchip running at 48kHz and the drivers will hide that from you and make the conversion automatically to/from whatever you want. (That’s what DirectX does.) Your printer basically does the same thing… You can send an image to your printer that’s higher resolution than the printer can handle, and the printer driver automatically converts it to something the printer can handle.


In the exclusive mode you are locked-into whatever the hardware can do.

The current 2.0.5 release of Audacity does not offer WDM-KS unfortunately because it causes Audacity to hang or the computer to crash on a few machines.

I don’t think you did (or if you can find it, please point us to it so we can correct it).

The limitation is that the WASAPI loopback audio comes into Audacity at 44100 Hz (look bottom right of the Audacity window). Therefore if you choose other than 44100 Hz project rate, the recording will be resampled. It is better to avoid that. I don’t think any of the developers knows for sure where that 44100 Hz limitation comes from. I don’t believe shared or exclusive mode or the sample rate you choose in Windows “Sound” affects this.


Gale

Hi Gale,
I meant the 44100 Hz limitation. This is why I prefer to use WDM-KS which I set at 96000Hz.

Now if I have 96000 Hz in the Windows Sound Applet, and 96000 Hz as the Audacity Default Rate, and I record using WASAPI, the “Actual Rate” in Audacity is also 96000 Hz (bottom right of the Audacity window). Does this mean that resampling from 44100 Hz to 96000 Hz is being done somewhere?
Robert

Assuming this is WASAPI loopback recording then the only relevant settings you can change in Windows are for the device that is playing the audio to be recorded.

Almost always, whatever rate I set the playback device’s Default Format to in “Sound” (with the “Exclusive Mode” boxes checked or unchecked), the Audacity actual rate being recorded at shows 44100 Hz irrespective of Audacity Project Rate.

I have occasionally seen the recording “Actual Rate” be the same as “Default Format” (irrespective of the project rate) which is what I would have expected to happen (at least when Exclusive Mode is unchecked). But this seems a rare occurrence and most people always see 44100 Hz actual rate. If that happens and the project rate is some other rate then yes Audacity is resampling to the project rate. This often seems to cause poor recorded quality.

If you consistently see 96000 Hz actual rate when project rate is 96000 Hz, Default Format is 96000 Hz and Exclusive Mode is on, then there should not be any resampling anywhere.

What happens for you if you record with 48000 Hz project rate, Default Format 96000 Hz, Exclusive Mode on (both boxes checked)? You might think that actual rate would be 48000 Hz but I suspect what is meant to happen is that the actual rate is 96000 Hz. In any case (most of the time) I see actual rate of 44100 Hz in that scenario, and only very rarely 96000 Hz.


Gale

I am running Windows 8.1, where things seem to be different from other (previous) Windows systems.

First, I don’t have two check boxes in the Advanced settings of the Windows Sound applet. I only have one check box for “Stereo Mix”, i.e. “Allow applications to take exclusive control of this device”.

Now, I consistently see 96000 Hz Actual Rate in Audacity when Project Rate is 96000 Hz, Default Format is 96000 Hz and Exclusive Mode is on.

However, the Audacity Actual Rate indicator is stuck at 96000 Hz, whichever Project Rate I choose. It seems the Audacity Actual Rate only shows the Default Windows rate. Or maybe the Audacity Default Sample Rate?

But there is more. If I record streaming audio from the Web in Audacity, and Exclusive Mode is on, I can play a completely different music through Foobar2000, and hear the two audio tracks playing together!

So it seems that Exclusive Mode is not working on my system.

Note that the same is true of Windows WDM-KS. Recording through WDM-KS in Audacity, and with Exclusive Mode on, I can hear two sound sources coming out of the speakers (that from Audacity and that from Foobar2000).

Windows works in mysterious ways!

Maybe this is due to the fact that I have no sound card, the audio and graphic chipsets are integrated into the main Intel G2020 chipset.

Robert

It will be showing the Windows Default Format rate. This may be reasonable for loopback recording (if your Actual Rate isn’t fixed on 44100 Hz), given there is no loopback input device exposed in Windows “Sound”.

The relevant setting would be Exclusive Mode for the Speakers device, of course, but yes I find the same for both WASAPI and WDM-KS. I am not sure what the explanation is, perhaps that Foobar2000 (and Windows Media Player for that matter) use MME.

Most people find that if you play a video on YouTube you cannot play audio in Audacity if you choose WDM-KS host. This is true if Exclusive Mode is on or not. WDM-KS should always behave so that “only one application can use the device”, so the Exclusive Mode checkboxes should have no effect for a device using WDM-KS.

Probably not. :wink:


Gale

Hi Gale,
You are right regarding Foobar2000: it uses something else than WASAPI when it can play a different audio concurrently with the Web browser. Out of sheer curiosity, I have downloaded and installed a Foobar2000 “component” adding support for WASAPI output in Foobar (WASAPI output support). If I activate “WASAPI output” in the Foobar preferences, play streaming music in my Web browser, and try to play a different music in Foobar, I get the following message from Foobar:

Unrecoverable playback error: Device in use

This is irrespective of whether Exclusive Mode is on or not.

However, I can record streaming music from the Web with WDM-KS in Audacity, and play a completely different tune in Foobar2000 (with “automatic” non-WASAPI output). Both audio come out of the same speakers then. And Audacity records both audio sources together! All of it with Exclusive Mode on! This is a good fast way to mix music: I have just mixed Beethoven’s Piano Concerto No. 5 with some accordion music!

Windows works in mysterious ways!

Cheers,
Robert

I do know that Foobar2000 doesn’t support WDM-KS, so perhaps this is still understandable.

If both sources are playing mixed together through the device then stereo mix under WDM-KS doesn’t have much choice but to record it. But if after starting web playback you tried to play music in any application that supported WDM-KS, such as some other audio editor, that should error (whether you were recording in Audacity or not).



Gale

Hi,

I am new to this forum so please bear with me if I ask a silly question.

I have recently installed Audacity 2 for the first time. I am using V 2.1.1 . I have also installed windows 10 64 bit. I normally record LPs at 96 / 24. I use a Xitel INPORT for A to D conversion.

I note that if I use WASAPI as the audio host the actual sample rate reflects the Windows settings for non-exclusive mode even though I have checked the enable exclusive mode boxes in the control panel audio device options and have set the project rate at 96. If I change to MME then the actual rate equals the desired project rate.

I don’t know what the actual result is because the file size and bitrate of songs recorded at the actual sample rate of 48 with WASAPI are comparable to 96 using MME. I save edited files converted to wav as 24 bit. So my first question relates to whether Audacity is somehow packing the bitdepth with zeros and somehow resampling the actual rate to 96 or is it just obtaining data as requested i.e. at 96 / 24.

Any advice will be much appreciated.

Regards

Warren

Thanks for giving the Audacity and Windows versions.

It would help though if you did not use abbreviations :wink: . Other users who are new to digital audio as well as to Audacity won’t have a clue what your last two sentences above mean. I assume you mean 96000 Hz sample rate and 24-bit depth, and Analogue to Digital conversion.

Yes, that can happen, or the Actual Rate is 44100 Hz regardless of Project Rate or Windows settings. It is noted in the Audacity Bugzilla Report Bug 652 – WASAPI issues thus:

The Status Bar Actual Rate when recording is unpredictable. It often shows 44100 Hz irrespective of the device’s Default Format or whether Exclusive Mode is on or off. But sometimes the recording “Actual Rate” is the same as “Default Format” (irrespective of the Audacity project rate). Gale would have expected that to happen (at least when Exclusive Mode is unchecked), but users tend to see only 44100 Hz. What display or behaviour do we want?

At the moment that is deemed not to be important or consistent enough a problem to release note ( http://wiki.audacityteam.org/wiki/Release_Notes_2.1.1#wasapi ) . However from Audacity 2.1.0 onwards on my machine (running Windows 7, 8.1 or 10) I do usually find that Actual Rate is the same as Default Format, regardless of Exclusive Mode.

The export sample rate and bit depth should be totally decoupled from the sample rate you record at and from the bit depth used to store audio in the project. Conversions will be made as required in the exported file.

Actual Rate is probably correct, so resampling from 48000 Hz to the project rate of 96000 Hz is probably occurring. It is probably best to set Default Format to 96000 Hz if you believe there is any benefit in recording at that rate.

WASAPI host records at 24-bit without padded zeros if you send it 24-bit input. The Windows DirectSound and MME hosts pad, as implemented in Audacity.

Audacity always captures at 32-bit float so to minimise bit depth conversions it is best to leave Default Sample Rate in Quality Preferences at its shipped setting of 32-bit float.


Gale

Hi Gale,

Thanks for your detailed response which provided me with much food for thought. Also apologies for the abbreviations. I certainly take your point.

On thinking about what I am trying to achieve, it is simply recording my vinyl and converting it to 96000Hz / 24 bit wav files on my computer without resorting to so called up-sampling.

I have my project rate set to 96000hz and do use the default 32 bit floating sample rate.

If I now understand everything correctly, there is therefore nothing to be gained by using WASAPI as the audio host and may as well stick with MME. There isn’t anything to be gained by using the computer playback recording loop.

Have I got it right?

Regards,

Warren

32-bit float, 24-bit and 16-bit are bit depths affecting dynamic range, not sample rates.

You were choosing the Xitel recording device with WASAPI host, weren’t you? There is no loopback when choosing a physical input device as recording device.

The possible gain of using WASAPI is that you will record true 24-bit samples (not padded 16-bit) if your Xitel is a 24-bit recording device.

Bit depth upconversions should be essentially lossless. Windows will definitely upconvert from 16-bit or 24-bit to 32-bit float before handing the audio off to Audacity if you use MME, Windows DirectSound (Exclusive Mode on or not) or WASAPI (Exclusive Mode off).

So if bit depth upconversions worry you, you should definitely use WASAPI in Exclusive Mode where Windows should not upconvert to 32-bit float. Set Audacity project rate to 96000 Hz, and because of the current observed behaviour, set Default Format to 96000 Hz too.

If you use 96000 Hz, do check for one or more small dropouts in the first second or two of the recording. WASAPI host might dropout there at other than 44100 Hz (that bug is mentioned in the Release Notes but not everyone will experience the bug).


Gale

Thanks again Gale. To my ageing ears bit depth seems to be more important than sample rate to overall listening experience so I will continue to use WASAPI.
Xitel has previuosly advised that the INPORT is 24 bit so I will take that at face value for the moment.
One final question on this - should I also set the default format to 24 bit PCM as well as 96000Hz sample rate? This would keep the bit depth consistent from recording through to saving the file as a 24 bit wav file.
Thanks again for your help.
Regards
Warren

With the “Exclusive Mode” boxes checked and using WASAPI host in Audacity, the only component of Default Format that Windows “should” observe should be mono or stereo - that is, Windows should hand off 24-bit samples from Xitel to Audacity, at the sample rate Audacity requests in Project Rate.

But given the sample rate Audacity receives “often” seems to be that set in Default Format regardless, it seems safest to set 24-bit in Default Format as well as setting the sample rate. I don’t have a 24-bit recording device to test with, but my “belief” is still that Windows does not upconvert bit depth in WASAPI Exclusive Mode.

As I said, Audacity always captures in 32-bit float (irrespective of your Audacity Default Sample Format set in Quality Preferences). So even using WASAPI Exclusive Mode, the 24-bit samples from Xitel will be captured at 32-bit float by Audacity and then stored at 32-bit float in the track, assuming your Audacity Default Sample Format is the default 32-bit float.

If you were to use 24-bit Audacity Default Sample Format, you would actually get more bit depth conversions:

  • From 32-bit float capture to 24-bit storage
  • If you apply an effect that changes the sample amplitude values, from 24-bit storage to 32-bit float to process the effect, then back to 24-bit storage in the track (Audacity’s internal processing is always in 32-bit float).

Gale

Hi Gale
Sorry to trouble you again but suddenly the recording volume control has been disabled after a windows 10 64 bit update. It works when using MME but not WASAPI. I have reinstalled Audacity but that didn’t solve the problem.
Any thoughts?
Regards,Warren