title=Fundamentals of Data Representation: Nyquist-theorem
We have seen the various ways that you can reduce the size of files, we have also seen that humans have a limit to the frequencies that they can perceive, so what sampling rate would be needed to only store the samples that humans can perceive. The full range of human hearing is between 20 Hz and 20 kHz.
People are able to hear different frequencies, up to what level can you hear?
For x = 0 To 25 Console.WriteLine("Can you hear: " & x * 1000 & "Hz?") Console.Beep(x * 1000, 500) Next
You lose your hearing with age, so the older you are the less likely you are to be able to hear the full spectrum.
So why not just use 20 kHz as our sampling rate record 20k cycles per second and be done with it? There is a small problem:
What we need to properly represent a sound wave is to sample it at least two times per cycle:
Therefore the minimum sampling rate that satisfies the sampling for the human ear is 40 kHz (2*20 kHz). The 44.1 kHz sampling rate used for Compact Disc was chosen for this and other technical reasons.
If a function x(t) contains no frequencies higher than B Hz, it is completely determined by giving its ordinates at a series of points spaced 1/(2B) seconds apart.
We can relate Frequency and period together using this equation. This equation will be very useful for working out the sample rate of a given wave.
What happens when you have a graph of time against displacement?
We know that Nyquist's Theorem is that the sample rate should be double than the highest frequency. So to calculate the sample rate,
- Work out the period by looking at the time taken for one complete oscillation.
- Work out the frequency
- Work out the sample rate with this:
- TIP - sometimes the period is hard to determine in one go as it may not cross an easily readable point on the axis.
- To Compensate, you can go to where it does cross the axis at a readable point, then divide by how many oscillations have occurred from 0 to the time
You should set the sample rate at a frequency which is at least twice the value of the highest frequency in the sampled signal
the sample has a frequency of 4 cycles per second. using Nyquist's theorem you would have to sample this at at least 8 Hz
- C. E. Shannon, "Communication in the presence of noise", Proc. Institute of Radio Engineers, vol. 37, no. 1, pp. 10–21, Jan. 1949. Reprint as classic paper in: Proc. IEEE, vol. 86, no. 2, (Feb. 1998)