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: Why do sample rates have to be twice the frequency being sampled? (Read 16322 times) previous topic - next topic
0 Members and 1 Guest are viewing this topic.

Why do sample rates have to be twice the frequency being sampled?

I have read about sample rates and the Shannon Sampling Theorem, but it has never been explained why the sample rate has to be twice the frequency being sampled. I know that CD's, for example, have a sampling rate of 44.1 khz in order to reproduce frequencies up to 22 khz, but why? Why doesn't it work for the sampling rate to be 22 khz in order to reproduce frequencies up to 22 khz?

Why do sample rates have to be twice the frequency being sampled?

Reply #1
Basically you need a minimum of two samples per period to define a tone (sinewave).  You can't define a tone with one sample.  See link for supporting explanation/math:

Nyquist-Shannon Sampling Wikipedia
Was that a 1 or a 0?

Why do sample rates have to be twice the frequency being sampled?

Reply #2
Why doesn't it work for the sampling rate to be 22 khz in order to reproduce frequencies up to 22 khz?


An oversimplified but easy to visualize explanation is to remember that both positive and negative frequencies are possible (since the choice of +/- is arbitrary), and that taking an ordinary Fourier transform always gives both.  Thus you must have one sample for each positive and negative frequency in your signal, thus the 2 samples per hz requirement.

Why do sample rates have to be twice the frequency being sampled?

Reply #3
An oversimplified but easy to visualize explanation is to remember that both positive and negative frequencies are possible (since the choice of +/- is arbitrary), and that taking an ordinary Fourier transform always gives both.  Thus you must have one sample for each positive and negative frequency in your signal, thus the 2 samples per hz requirement.


Ouch! was that really simplified? :S  I really understand it better in the time domain. Or did you mean amplitude instead of frequency?

Why do sample rates have to be twice the frequency being sampled?

Reply #4
I have read about sample rates and the Shannon Sampling Theorem, but it has never been explained why the sample rate has to be twice the frequency being sampled. I know that CD's, for example, have a sampling rate of 44.1 khz in order to reproduce frequencies up to 22 khz, but why? Why doesn't it work for the sampling rate to be 22 khz in order to reproduce frequencies up to 22 khz?


If you sampled a 22 khz signal at 22 khz, each sample would have the same value. How then could you tell if it's really a 22 khz signal or a flat unchanging signal?

Why do sample rates have to be twice the frequency being sampled?

Reply #5
I have read about sample rates and the Shannon Sampling Theorem, but it has never been explained why the sample rate has to be twice the frequency being sampled. I know that CD's, for example, have a sampling rate of 44.1 khz in order to reproduce frequencies up to 22 khz, but why? Why doesn't it work for the sampling rate to be 22 khz in order to reproduce frequencies up to 22 khz?

A very simple illustration should be more explaining than a lot of words here. Imagine the higher frequency (the one with shorter wavelength) displayed being something like 16kHz and the red dots marking a 22kHz sampling rate. What you'd hear after sampling would be a distorted wave at around 2kHz.

Why do sample rates have to be twice the frequency being sampled?

Reply #6
Quote
' date='Dec 29 2008, 16:04' post='606855']
Or did you mean amplitude instead of frequency?


Take a look at the wikipedia link above.  The Nyquist rate is about frequency.  Amplitude has nothing to do with it.

Why do sample rates have to be twice the frequency being sampled?

Reply #7
Quote
' date='Dec 29 2008, 16:04' post='606855']
Or did you mean amplitude instead of frequency?


Take a look at the wikipedia link above.  The Nyquist rate is about frequency.  Amplitude has nothing to do with it.

I have to agree with [JAZ]. Your explanation didn't help me at all.

Why do sample rates have to be twice the frequency being sampled?

Reply #8
Why does it take two points to define a line?

Why do sample rates have to be twice the frequency being sampled?

Reply #9

In other words there's an ambiguity. Here's an example:
Code: [Select]
cos( x * 2pi * f )  =  cos(x * 2pi * (k +/-f) )
for x and k being integral and f (frequency) being a real number.

If you sampled a sine wave (x=0,1,2,3,4,...) and try to figure out the frequency based on the sampled values you have to choose from an infinite number of possible frequencies (or linear combination thereof!) because there are infinite many frequencies that lead to the exact same sequence of values.

However, if you know that 'f' was in the interval [0, 0.5) then there's is only one possible frequency left that leads to the same sequence of values. This interval is [0,fs/2) where fs is the sampling frequency. In the above example the sampling frequency was fs=1.

HTH,
SG

Why do sample rates have to be twice the frequency being sampled?

Reply #10
I like Sebastian's explanation best.

Why do sample rates have to be twice the frequency being sampled?

Reply #11
Congratulations guys. It's the first time I see a discussion on sampling without some idiot arguing that you need at least 3 (or 4) samples per period to make a sine wave sound good! :-)

Why do sample rates have to be twice the frequency being sampled?

Reply #12
Gosh    ... I've lived with an impression that it's needed just because of two channels (left and right) of stereo audio data (meaning, both channels have 22.05k samples) 

Juha

Why do sample rates have to be twice the frequency being sampled?

Reply #13
@SebastianG
Thank you: for the first time, I have an inkling of how aliasing happens.

Why do sample rates have to be twice the frequency being sampled?

Reply #14
Gosh  ... I've lived with an impression that it's needed just because of two channels (left and right) of stereo audio data (meaning, both channels have 22.05k samples) 

Juha




Nope, a mono 44.1kHz file has the same ~22kHz range that a stereo 44.1kHz file does.

Why do sample rates have to be twice the frequency being sampled?

Reply #15
Congratulations guys. It's the first time I see a discussion on sampling without some idiot arguing that you need at least 3 (or 4) samples per period to make a sine wave sound good! :-)


That logic possibly came from the video world where transient pulses are the norm. To reproduce pulses they use 4 times subcarrier sampling while the early Ampex Time Base Correctors sampled at 3 times subcarrier rate. The 4x samplers (virtually all now) do a better job.


Why do sample rates have to be twice the frequency being sampled?

Reply #16
The 4x samplers (virtually all now) do a better job.
To be fair, few people sample at a rate linked to the sub carrier frequency - it's mostly ITU-R BT.601 - i.e. a fixed 13.5MHz sampling system for all SD systems.

And almost no one in the professional world digitises anything with a subcarrier anyway - it's all component video, except for archive - and the most used parts of that are already decoded to component now, at least in the UK.

Cheers,
David.

Why do sample rates have to be twice the frequency being sampled?

Reply #17
Let's say you want to find out how often something happens.

You check every minute, for a duration of 1 second. Something happened 10 times when you kept checking for 10 minutes.

OK, so far so good.

But can we say it really happened only 10 times? It could have happened every 2 seconds, occuring 300ish times.

-----

Let's say you check every minute, for a duration of 1 second.

It could still have happened every 2 seconds, but if you were always late by 1 second, then you would have gotten zero results!

-----

Now there's your answer.

Why do sample rates have to be twice the frequency being sampled?

Reply #18
Gosh    ... I've lived with an impression that it's needed just because of two channels (left and right) of stereo audio data (meaning, both channels have 22.05k samples) 

Juha
  Just in case it's not clear yet...  The sample-rate (kHz) doesn't change with the number of channels.    At a 44.1kHz sample rate, there is a "clock-tick" 44,100 times per second.  And, all of the channels get one data-point for each clock-tick.   

Since you are getting two samples for every clock-tick, you do have twice as many total samples for a stereo file and the bitrate (kpbs) is twice as high for a stereo file, as for a mono file (assuming no compression).    And of course, a stereo file has twice the data, and is twice the size of a mono file (if everything else is equal).

Why do sample rates have to be twice the frequency being sampled?

Reply #19
A very simple illustration should be more explaining than a lot of words here. Imagine the higher frequency (the one with shorter wavelength) displayed being something like 16kHz and the red dots marking a 22kHz sampling rate. What you'd hear after sampling would be a distorted wave at around 2kHz.


don't you mean 4kHz? or am i missing something?

Why do sample rates have to be twice the frequency being sampled?

Reply #20
don't you mean 4kHz? or am i missing something?

I come up with 6 kHz. Anything above 22/2 = 11 kHz would become 22 - f, or 22 - 16 = 6.