# Sampling frequency of audio

Based on what we choose sampling frequency when sampling some song? Do we use Nyquist–Shannon sampling theorem, or maximum sampling frequencies are pre-defined, so it will never come to aliasing effect?

Audio is generally regarded to cover the frequency range from 20 Hz to 20,000 Hz, because the human ear is not capable of detecting signals outside of that range. When converting audio to a discrete signal, then, you must follow these steps:

• Bandpass filter the audio to eliminate any signals above 20 kHz. These may be produced by the audio source itself and by non-linearities in the electronics. Filtering prevents those higher frequencies to appear as alias in the 20 Hz -- 20 kHz range.

• Sample the audio at a frequency of at least 40 kHz (based on the Nyquist sampling theorem). In practice, the sampling frequency will be larger than 40 kHz, to make the reconstruction filter easier to implement. The reconstruction filter converts the sampled audio back to analog audio.

• Use an appropriate quantization -- for high quality audio, 16 bits per sample is considered acceptable.

Note that for specific audio signals and for different applications the specific numbers will change. For example: Digital telephony limits the audio (voice) signal to around 3.3 kHz and quantizes using 8 bits per sample. High-end studio equipment usually samples at higher frequencies (like 96,000 Hz) and uses up to 24 bits per sample. Compressed audio uses a variable number of bits per sample.

Of course you have to obey Shannon-Nyquist when sampling anything.

But, of course, sound cards were designed by engineers, so they have analogue filters that avoid aliasing at the sampling rates the cards offer.

So, if you're using a sound card, any sampling rate it supports should be largely alias-free. Use the sampling rate sufficient for your signal of interest and comfortable for your application and available from the sound card hardware. In effect, that means you can chose between 44.1, 48 and 96 kHz on most sound cards.