Help understanding Sampling Rates in Windows 7

OS: Windows 7
Audacity v. 2.0.1

My question is this – In Audacity, one can choose a sample rate from the box in the lower left hand corner. One can also apparently choose a default sample rate and bit depth from the Sound control panel in the taskbar for whatever device you select as the recording input. If the “Allow applications to take exclusive control of this device” is checked, which selection takes priority?

Here are a couple of scenarios to illustrate:

  1. A sample rate of 192khz is selected in Audacity. But a rate of only 44.1khz is selected in the sound control panel. What happens? Is there downsampling? Which rate controls and why?
  2. Same question, but the reverse. 44.1khz is chosen in Audacity, and 192khz is chosen in the Sound control panel. What happens? Is there upsampling? Which rate controls and why?

Is it essential to set the rate in Audacity equal to the rate selected in the Sound control panel? Why or why not?

And how are those choices affected by whether you use MME or Windows Direct Sound as the Audio Host?

Thanks for your time. I’m attempting to record and archive the voicemail greeting of someone dearly departed and I’m kind of feeling my way through Audacity (and feeling a little lost in the process). I just need to assure myself that I’m recording at the highest quality and not doing something that would inadvertently affect the audio quality merely because I wasn’t aware of it.

To do the recording, I’ll be using the following:

  1. Telephone to line-in via 3.5mm jack;
  2. telephone to mic input via 3.5mm jack; and
  3. Skype via Stereo Mix.

Any other tips to maximize the quality will be greatly appreciated. Thank you for your time!

The short answer is that the default settings in Audacity should work well.

The longer answer:
It is generally advisable to set the sampling rate the same in both Windows and Audacity, though Audacity should be able to cope if they are different.
Audacity requests data from the sound system according to the settings in Audacity. The operating system then sends audio data to Audacity. In an ideal world, Windows would request the data from the sound card via the sound card drivers, and the sound card responds by sending audio data to the Windows sound system which passes it on to Audacity via Portaudio and the sample rate will ideally be in the format requested by Audacity. This is where it can get messy. Audacity has no control over what the sound card and sound card drivers can or cannot do. If the data received by Audacity is not what it asked for, Audacity will convert it to the format that you set in Audacity.

If your final format will be CD or MP3, then setting the sample rate to 44.1 kHz is a good choice as that sample rate should be supported throughout the chain and it will not need to be converted when you burn it to CD. If your final format will be DVD then 48 kHz is a better choice as that is the standard rate for DVD.

The bit format (bit depth) in Audacity should be set to 32 bit float format. Your sound card will not support 32-bit float, but converting from 16 or 24 bit to 32 bit is lossless and 32 bit float format is better for processing audio.

Steve -

Thanks for your incredibly prompt and thorough reply!

To confirm my understanding:

  1. If “exclusive control” is selected for the input device in the Sound Control Panel; and
  2. I stick with traditionally used rates in Audacity (like 44.1khz, 48khz, 96khz, etc.); and
  3. avoid using arbitrary or unsupported rates (like 53,492Hz for example); then

Audacity should, at least in theory, record at the rate set within the program and ignore whatever is set as the default rate for the input device in the Sound Control Panel.

However, because each hardware & driver set may behave differently, best practices recommend setting the same rates in both Audacity and the input device in the Sound Control Panel.

There is some more explanation here:
http://wiki.audacityteam.org/wiki/Windows_7_OS#sample_rates

Audacity can only receive audio at the requested project rate if the sound device supports that rate and if you tick (check) both “Exclusive Mode” boxes in Windows and choose “Windows DirectSound” host in Audacity.



Gale

Thanks for the link Gale. That has answered some of my questions about the detail of Windows 7. (now bookmarked)

Thanks again to Gale and Steve for the informative answers and links to the relevant portion of the manual.

I think Gale more clearly stated the point I was trying to get at with the steps in my earlier post, so again I’ll just confirm my plan of action to make sure that the rate I choose is the rate that gets recorded:

  1. Select a Sound Input Device from the Sound Control Panel (ex. stereo mix)

  2. In the Control Panel, ensure that the two “Exclusive control” boxes are checked for that device

  3. In the Control Panel, choose a sampling rate for that device (ex. 2 channel, 96000Hz)

  4. In Audacity, choose Windows DirectSound as the audio host

  5. In Audacity, choose a rate that matches the one I selected in Step 3 (ex. 96000Hz, Stereo) (as per the “Choose a project rate that the device supports, and use that same rate everywhere.” in the manual)

  6. Record

Now, Gale’s post, and the manual, seem to imply that if you’re running in Exclusive Mode, Audacity should ignore any rate in the Sound Control Panel (so if the CP rate is set to 44.1khz, and Audacity is set to 96khz, the recording should be 96khz). How essential is it that they match? Is anything lost or gained by choosing the same rate in both?

Apologies if I’m beating a dead horse. Just trying to ensure I understand it before diving in.

The link I gave is in the Main Wiki ( the place for extra tutorials, tips and tricks http://wiki.audacityteam.org/wiki/Audacity_Wiki_Home_Page ) rather than the Manual ( http://manual.audacityteam.org/o/ ).

The sample rate (and bit depth) set in Windows “Default Format” have no effect in Exclusive Mode for a device like Audacity that can request a specific sample rate and bit depth. But see below about bit depth.

The number of channels in Default Format do have an effect (at least with an inbuilt sound device) in so far that if you set Audacity to record in stereo from a stereo source but have Windows set to mono, you’ll probably record “dual mono” (the same content in left and right channels of the stereo track).

Again the rate in Windows should be ignored by Audacity if it is running with Windows DirectSound host and if you checked both “Exclusive Mode” boxes. Note the text for “Default Format” in Windows is explicitly “when running in shared mode”.

If your device has a control panel or switch where sample rate is specified (many external devices do) that is where you must set the same rate as the Audacity project rate.

So set 96000 Hz, Windows DirectSound in Audacity, 96000 Hz in your sound device if settable, and any stereo setting in Windows Default Format. If you set 22050 Hz in Windows, it doesn’t matter because Exclusive Mode does not resample but lets Audacity and the sound device communicate directly.

As regards choosing 16- and 24-bit recording, Audacity on Windows will only record 16-bit as shipped due to a limitation in the PortAudio input/output code we use. If this limitation did not exist, the bit-depth in Windows would be disregarded and you would just set the bit depth in Audacity’s Quality Preferences to 24-bit or 32-bit float (the default) and your sound device to 24-bit (if it has such a control).

You can record 24-bit in Audacity if you compile it with support for the ASIO audio interface, in which case you then choose ASIO host in Audacity and the Windows Default Format should be disregarded if set to Exclusive Mode.

Matching Windows Default Format sample rate should be totally irrelevant if Windows is set to Exclusive Mode and Audacity to Windows Direct Sound.



Gale

Gale, your patience seemingly knows no bounds, so thank you for your continued assistance with my beginner-type questions. I genuinely appreciate it.

I don’t have any external recording devices with switches or separate control panels. I merely have on-board sound and a phone to be connected with a 3.5mm jack, and the standard Windows Sound Control Panel from the taskbar icon (where the only selectable option is in the Default Format box). So I guess I don’t have to worry about the Default Format aside from the number of channels.

If my understanding is correct, then all I should concern myself with is:

  1. making sure that the Exclusive Mode boxes for whatever input device I’m working with are checked;
  2. choosing the correct number of channels in the Default Format selection area; and
  3. selecting Windows DirectSound and a sample rate in Audacity

and Audacity should record at the rate selected from within the program.

If that is correct, then I just have one more curiosity question before I get to some recording. I understand that the Default Format should have no bearing on a recording when running in Exclusive Mode. However, what I notice when recording silence changes based on the Default Format rate selection. For instance, at 48khz or lower, Audacity’s meter shows no noise and it records a flat line. When I change the Default Format rate to 96khz, the noise registers at -54db. It goes up again to -39db if 192khz is selected as a Default Format rate (resulting in a visible waveform instead of a flat line). If the Default Format setting should conceivably have no bearing on the recording, what is happening with each change to result in noise? I would hate to have any noise in the background if I needed to amplify a recording.

Where are you setting that? In Audacity or in the Windows Sounds Control Panel settings?

So you have a phone to computer audio adaptor, is that so?

The sample rate has to be one the device supports to ensure the stream will not fail. You can look at Help > Audio Device Info in Audacity to see the rates the device claims to support.

All sound cards have a noise floor level. A motherboard device on Windows will often have a noise floor level of about -60 dB to -40 dB.

By default, Audacity’s meter has a lower limit of -60 dB. If you lowered the limit in the Interface Preferences, the noise would be visible in the meters at any frequency and with any input.

The way to see the peak amplitude of noise accurately is to select it and Effect > Amplify. The level below 0 dB can be calculated by adding the Amplification (dB) level to the New Peak Amplitude level. For example if the Amplification level is 50 dB (the maximum in one pass) and the New Peak Amplitude in -4.00 dB then the peak amplitude of the noise is -54 dB.

Can you just confirm - have you got Windows DirectSound selected in Audacity host? In that case you should not be able to record 192000 Hz unless you have 192000 Hz selected in Audacity project rate.

And did you change the input in Audacity Device Toolbar for any of these tests?


Gale

Correct. It is just a simple cable with a 2.5mm jack on one end (into the phone) and a 3.5mm jack on the other (for line-in or microphone input).

For the most part, that’s what I’m seeing. The reason I wrote is that I’m finding the Default Format set in the Windows Sound Control Panel is increasing the noise floor as higher rates are selected, even though conceivably that selection should have no bearing on anything when running in Exclusive Mode.

I hope I can explain my process. I choose an input (ex. microphone; plug the phone into that; enable it in Windows Sound Control Panel and disable any other possible sound inputs like Line In or Stereo Mix). Then, I go through a complete combination of rates in Audacity (44.1, 48, 96, 192) for each Default Format I select in the Sound Control Panel. So, for example, I choose 44.1khz in the Default Format. Then I test 44.1, 48, 96, and 192 rates in Audacity. I increment the Default Format to 48khz, and repeat. This continues for 96khz and 192khz. Each test is a short recording of silence, followed by an amplification to see what the numbers look like. Then I change inputs, and do it again.

What I found is that, for a Default Format rate of 44.1khz or 48khz, the noise floor remains constant at approximately -50 to -60db regardless of the rate set in Audacity. However, if a Default Format rate of 96khz is selected, then the noise floor raises into the -40 to -50db range. And I see -30 to -40db range when 192khz is selected which results in visible waveforms instead of flat lines.

My understanding is that the Default Format selection should have no effect on Audacity, but it does indeed appear to change the noisefloor on my system. As a result, what combination should I select in order to best minimize noise in my recordings if they are to eventually be amplified to some extent (which they will be)? Do I select the Default Format rate of 44.1khz, which shows the least noise across all my tests, and then choose an appropriate recording rate (whether it be 44.1, 48, or 96khz) in Audacity? Is there any explanation for the increased noise I’m seeing?

At the end of the day, I guess it boils down to this – how can I be sure Audacity’s sample rate takes priority over the one in Windows Sound Control Panel (despite Exclusive mode boxes being checked)? If I do have to select 44.1khz in the control panel, but a higher rate in Audacity, is there any way to tell which one will ultimately appear in the recording?

Again, the purpose of this is to record the voicemail of a dearly departed person. I’d ideally like to get the highest quality recording I can before the voicemail service is terminated; one that will hold up to any post-processing without the unnecessary introduction of artifacts that may have to be removed like noise. I realize I’m asking a lot, and it’s probably unnecessary minutia, because a voicemail is low quality to begin with. But it’s important to know I’m doing all I can to preserve it.

Yes, WDS is selected as the host.

Yes. Each time I enabled a new input in the Windows Sound Control Panel, I would close Audacity, then re-open it to select the newly recognized input from the Toolbar. At no time did I select “Primary Sound Capture Driver.”

So the noise level is not dependent on the actual rate you record at, as chosen in Project Rate? If you set default format to 192000 Hz, the noise is -30 dB to -40 dB at both 44100 Hz Project Rate and 192000 Hz Project Rate?

I don’t see behaviour like that on my main laptop on Windows 7.

Do you agree that if you set the Project Rate to 44100 Hz and Default Format to 192000 Hz that the actual rate recorded is 44100 Hz (as shown bottom right of the Audacity window)?

Yes.

I would suggest making sure you have the latest drivers for the sound device, made by the computer or motherboard manufacturer. See http://wiki.audacityteam.org/wiki/Updating_Sound_Device_Drivers .

I guess it is possible that more noise is being generated by some interaction that checks if Windows is to resample then cancels the resampling. I have not heard of such a case before. But if you only have Microsoft drivers (or outdated/incorrect drivers) for the sound device, anything can happen.

Look bottom right of the Audacity window.

Exactly, the noise level of that recording may well be above even the worst case -30 dB sound card noise floor you have found.

Primary Sound Capture Driver selects whatever is the default Windows device at the time.

Do I presume the noise level varies between inputs, though always higher at higher Default Formats?

I don’t understand the purpose of recording from the adaptor to both line-in and microphone. I would guess as it has a 2.5 mm plug at one end that it is meant for the mic input and will be too quiet for the line input. In that case, connecting the adaptor to line-in will reduce the ratio of signal to noise, whatever the noise level. But you should choose whichever input the manual for the adaptor says to choose.


Gale

Here’s an example. Stereo Mix for input. Default Format rate 192000Hz. Here are the noise levels for Audacity at each selected project rate:

44,100Hz - -51 to -54db
48,000Hz - -51 to -54db
96,000Hz - -48 to -51db
192,000Hz - -39 to -42db

For purposes of comparison, the noise floor was <-60db for each of those Project Rates when the Default Format rate was 44,100Hz.

So it appears that noise not only increases with the Default Format rate, but also as the Project Rate gets higher within that particular Default Format rate. Why? I have no idea. But I think it’s an academic discussion at this point as explained next.

Yes, I do now. I found a handy utility called SoundCheck (free for personal use) that will show the actual real-time rate being recorded compared with the project rate selected from within the program. What I found was, as you have repeatedly mentioned, that the Default Format rate is irrelevant in Exclusive Mode. The rate recorded was exactly the rate I selected from within the SoundCheck program, regardless of what was selected in the Default Format rate. In fact, thanks to the program’s real-time spectrogram, I was able to see that the only effect of higher Default Format rates was to increase the noise floor, even though it ultimately had no effect on the actual rate recorded.

With that insight, I believe that the best course of action (as you just recommended) for this set of hardware is to set the Default Format rate to 44,100Hz (which introduces the least noise of all of the selections across all inputs), and then record at whatever device-supported Project Rate I select from within Audacity.

I checked and my sound drivers are up-to-date.

Yes. Stereo Mix tends to be pretty quiet from a noise perspective. So too does the Line-In. The microphone input is a bit noisier. But the behavior is the same, often manifesting itself in the 96,000Hz to 192,000Hz Default Format rate range, depending on the input.

The cable is a standard 3.5mm-3.5mm male-male cable. But the phone from which I’ll be dialing has a 2.5mm female jack. So I merely purchased a 2.5mm-3.5mm adapter to take care of that. So it looks like this:

Phone(2.5mm female)<-[2.5mm(male)/3.5mm(female)]<-3.5mm(male)--------3.5mm(male)->[input port on computer]

There is no manual, and I don’t know anything about the differences between line-in and mic, so I’m just planning to do a recording from each one.

The mic port accepts low input signals and applies amplification. It is usually a mono input.

The line-in port accepts stronger line-level signals. It is usually a stereo input.

If you connect a line-level input (like that from a phono amplifier or mic with phantom power) to the mic port, you will get distortion.

If you connect an unamplified mic input to the line-in port, the input will be too quiet.


Gale

With that answer, and the previous information I learned from both you and watching the results in the SoundCheck program, I think it’s safe to say that I’m fully informed about the topic and ready to proceed. I’ll set the Default Format at 44,100Hz (and the appropriate number of channels) to minimize noise, and then record at a device-supported rate from within Audacity.

Thanks again for your boundless patience. It really is appreciated!