Sampling Theory

Page 1

Sampling Theory For Digital Audio
By Dan Lavry, Lavry Engineering, Inc. Credit: Dr. Nyquist discovered the sampling theorem, one of technology’s fundamental building blocks. Dr. Nyquist received a PhD in Physics from Yale University. He discovered his sampling theory while working for Bell Labs, and was highly respected by Claude Shannon, the father of information theory. Nyquist Sampling Theory: A sampled waveforms contains ALL the information without any distortions, when the sampling rate exceeds twice the highest frequency contained by the sampled waveform. Introduction While this article offers a general explanation of sampling, the author's motivation is to help dispel the wide spread misconceptions regarding sampling of audio at a rate of 192KHz. This misconception, propagated by industry salesmen, is built on false premises, contrary to the fundamental theories that made digital communication and processing possible. The notion that more is better may appeal to one's common sense. Presented with analogies such as more pixels for better video, or faster clock to speed computers, one may be misled to believe that faster sampling will yield better resolution and detail. The analogies are wrong. The great value offered by Nyquist's theorem is the realization that we have ALL the information with 100% of the detail, and no distortions, without the burden of "extra fast" sampling. Nyquist pointed out that the sampling rate needs only to exceed twice the signal bandwidth. What is the audio bandwidth? Research shows that musical instruments may produce energy above 20 KHz, but there is little sound energy at above 40KHz. Most microphones do not pick up sound at much over 20KHz. Human hearing rarely exceeds 20KHz, and certainly does not reach 40KHz. The above suggests that 88.2 or 96KHz would be overkill. In fact all the objections regarding audio sampling at 44.1KHz, (including the arguments relating to pre ringing of an FIR filter) are long gone by increasing sampling to about 60KHz. Sampling at 192KHz produces larger files requiring more storage space and slowing down the transmission. Sampling at 192KHz produces a huge burden on the computational processing speed requirements. There is also a tradeoff between speed and accuracy. Conversion at 100MHz yield around 8 bits, conversion at 1MHz may yield near 16 bits and as we approach 50-60Hz we get near 24 bits. Speed related inaccuracies are due to real circuit considerations, such as charging capacitors, amplifier settling and more. Slowing down improves accuracy. So if going as fast as say 88.2 or 96KHz is already faster than the optimal rate, how can we explain the need for 192KHz sampling? Some tried to present it as a benefit due to narrower impulse response: implying either "better ability to locate a sonic impulse in space" or "a more analog like behavior". Such claims show a complete lack of understanding of signal theory fundamentals. We talk about bandwidth when addressing frequency content. We talk about impulse response when dealing with the time domain. Yet they are one of the same. An argument in favor of microsecond impulse is an argument for a Mega Hertz audio system. There is no need for such a system. The most exceptional human ear is far from being able to respond to frequencies above 40K. That is the reason musical instruments, microphones and

Copyright Dan Lavry, Lavry Engineering, Inc, 2004

Sampling Theory

Page 2

speakers are design to accommodate realistic audio bandwidth, not Mega Hertz bandwidth. Audio sample rate is the rate of the audio data. Such data may be generated by an AD converter, received and played by a DA converter, or even altered by a Sample Rate converter. Much confusion regarding sample rates stems from the fact that some localized processes happen at much faster rates than the data rate. For example, most front ends of modern AD (the modulator section) work at rates between 64 and 512 faster than a basic 44.1 or 48KHz system. This is 16 to 128 times faster than 192KHz. Such speedy operation yields only a few bits. Following such high speed low bits intermediary outcome is a process called decimation, slowing down the speed for more bits. There is a tradeoff between speed and accuracy. The localized converter circuit (few bits at MHz speeds) is followed by a decimation circuit, yielding the required bits at the final sample rate. Both the overall system data rate and the increased processing rate at specific locations (an intermediary step towards the final rate) are often referred to as “sample rate”. The reader is encouraged to make a distinction between the audio sample rate (which is the rate of audio data) and other sample rates (such as the sample rate of an AD converter input stage or an over sampling DA’s output stage). Sampling Let us begin by examining a band limited square wave. We set the fundamental frequency to 1KHz and the channel bandwidth to 22.05KHz (as in red book audio CD). A quick calculation yields 22 harmonics (though for a square wave all even harmonics are zero amplitude). The plot below shows the addition of the 22 harmonics:


1.25 0.75


0.25 0.25 0.75

− 1.25 1.25

0 0


20 tn



50 50

Let us magnify the part of the wave (red) between t=0 and t=25. The blue lines define sample times. The blue X's show the value assigned to each sample. For example, the value of the sample at t=1 is about -1, at t=2 we have .75 and so on. Our sampled wave can be represented by a sequence of values

Copyright Dan Lavry, Lavry Engineering, Inc, 2004

5 Sincn . If we go far enough.5 0 0. For the mathematically inclined sinc(x)=sin(x)/x. The ringing below 22 and above 28 is in the same direction.75 0.Sampling Theory Page 3 1. 23.25 0. 2004 .25 0. it approaches zero and gets negligible for all practical purposes.5 1. Let us see how it is done. 270 0. 1. All our sampling sinc functions will be positioned to have zero (zero crossing) at the same points. 22. Lavry Engineering. the number of samples (X's) need only to exceed twice the bandwidth in order to be able to retrieve the complete waveform.25 0.25 1.25 0 0 5 10 tn 15 20 25 25 Initial intuitive reaction may cause one to think that we do not have enough X's to be able to re plot the original wave (red) with all of its details.25 20 20 22 24 tn 26 28 30 30 We can see that the sinc plot continues to "ring" (go up and down) beyond the plot limits selected (n=20 to n=30. Inc.25 0 − .25 1 23 27 Sincn .25 Vn Sn 1. That intuitive reaction is wrong. Each sinc plot consists of a "main lobe" and ringing (decaying sin wave) on each side of the main lobe. Copyright Dan Lavry. including any value between the sample times. Note that each sinc crosses zero (the dotted black line) at t=20. but gets smaller in amplitude as we get away from the center. 230 1.75 0. Note that the ringing between the peaks of the two sincs (between 23 and 27) goes in opposite directions.75 − 1. When we expand the range we see that the "ringing" continues. We are now going to introduce our sampling sinc functions.25 0. For a given bandwidth.. 21. The key here is fact that the wave form is band limited. Let us plot two sinc functions. one centered at 23 (red) and the other at 27 (blue)..

We center them at t=20.Sampling Theory Page 4 1.25 0.30. 300 0 0. 220 Sincn .25 1 1. 250 0. Note that we are beginning to see some similarity to a band limited square wave.25 0 0 10 20 tn 30 40 50 50 Adding the above 11 equal amplitude sinc functions yields the pulse shape below (red).25 1. 280 Sincn .25 0 − . 200 Sincn . 1.22. 260 Sincn . Inc. 2004 .5 0. Copyright Dan Lavry. Lavry Engineering.5 Sincn ..75 Sincn . The blue dotted plot is a single sinc for visual reference. 230 0.25 1 0.25 − . 240 Sincn . 270 Sincn . 250 0. 210 Sincn .21.25 0..25 0 0 10 20 tn 30 40 50 50 Let us now generate 11 equal amplitude sinc functions spaced apart.25 Sincn .75 Sincn . 290 Sincn .

As mentioned earlier the width and position of the sinc is set so that the peak of the "main lobe" and the zero crossings of the ringing occur at sample time. 22 because this will yield a half cycle width of a 1KHz square wave.25 0 0 10 20 tn 30 40 50 50 Let's add 22 adjacent sincs.25 1 Sumn 0. 2004 .18 Vn 0. Lavry Engineering. but their sum can yield DC. (see the first plot in this paper).5 0 − .5 1.75 0.25 0. Each individual sinc is far from a straight line. Inc.89 − 1. The red wave bellow shows the outcome .54 Sumn 0. Note that the center of the sum (t=20 to t=30) is a good approximation of a DC signal (value 1).5 1.89 0.25 1.a positive half of a band limited square wave. The blue wave is the band limited 1KHz square wave we constructed by adding 22 sine waves.54 0.25 Sincn . Copyright Dan Lavry. 250 0. In fact.18 0. Note the similarity of the positive half of the waves (ignoring the horizontal shift in time).Sampling Theory Page 5 1.25 0.25 0 0 10 20 tn 30 40 50 50 Can one generate DC using such “twisted” sinc functions? The plot below is a sum of 480 equal amplitude sinc's.25 1. we can find a set of sinc functions such that when adding them will yield any band limited wave shapes we desire. 1.

Lavry Engineering. 2004 .Sampling Theory Page 6 1.75 20 30 Sum1n 0. We begin by plotting the wave: 1.25 1.25 VSn 0 − 1.5 0. Note that the sinc function gets inverted for negative values of the sine wave.25 0 0 10 20 tn 30 40 50 50 Next we multiply each sample point by a sinc function.25 1 0. The plot below shows the multiplication of the 3KHz tone (dotted black) by a sinc at 11 locations (20 to 30).25 0 0 0 0 10 20 tn 30 40 50 50 Let us find the set of sinc functions that correspond to a 3KHz sine wave. Inc. Copyright Dan Lavry. The center of each sinc is aligned and adjusted to the amplitude the sine wave at each sample time.

Sampling Theory Page 7   1.8 0.7 0 VO n . 300 VSn 0.8 − 1. 220 VO n . Lavry Engineering.4 0. The gate requires infinite bandwidth. Adding all sinc's yields the wave below.95 − 1. Any sudden beginning or ending amounts to high frequency content.25 0.4 Sumn 0 0. 280 0. 260 VO n . 210 VO n . A different way to state this is that the sinc functions at the beginning and end are truncated. 200 VO n . Copyright Dan Lavry.2 0. 230 VO n . thus their contribution is partial (see next plot). The middle (t=7 to t=45) looks similar to the 3KHz sine wave input. 290 VO n .2 1.2 1. 250 VO n . 270 1. Inc. 1.2 0 0 5 10 15 20 25 tn 30 35 40 45 50 50 Note that the first half cycle (t=0 to 7) and the last half cycle (t=45 to t=50) are distorted. A sine burst itself contains a sine wave and a gating wave (turning the sine on and off). 2004 . The distortions at both ends are due to an abrupt start and stop of the wave.25 10 10 15 20 25 tn 30 35 40 40 With sincs positioned and multiplied by the input wave at ALL sample points.4 VO n .25 VO n . 240 VO n . we are now ready to see what the combined outcome is.

In fact the distortions will disappear completely when the input signal has no high frequency energy. The sum of the sinc's will yield a wrong result.4 VS n SincS n 0 0. Lavry Engineering.2 0.2 1.4 0.2 Sumn VO n . The sinc ringing frequency must be higher than twice that of the highest possible frequency we want to sample. we do not have enough sample points to track the high frequency. The example above is made of a sine wave burst.2 1. and the reason for the distortions at the beginning and end is the high frequency energy content of the burst.2 0 1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 0 tn 20 Copyright Dan Lavry.2 0. At this point we need to clarify what we mean by "high frequency" signal: "high frequency" is any frequency above the "ringing" of the sinc function. Does it mean that the first few samples on a CD distorted? The answer is NO. Lowering the high frequency energy will reduce the distortions. Not meeting the requirements will cause distortions. Note that their contribution around t=25 is about zero.8 − 1.8 − 1.2 0 0 5 10 15 20 25 tn 30 35 40 45 50 50 Each sample point is an outcome of all the sinc's.Sampling Theory Page 8 The center of the wave (t=7 to t=45) is far enough from the sudden gating (t=0 and t=50). Inc.4 0 VO n . 2004 . yet those sinc's nearby the sample point contribute more to the outcome. A red book CD format is based on 44100 sinc's per second. 1. The center (say t=25) is impacted mostly by nearby sincs and little by far away sinc's The plot below shows the above wave with a black sinc at t=2 and blue sinc at 48. 10 0. called aliasing distortions. Our example consists of only 50 sinc's.8 0. 1.2 1. Let us examine sampling of a sine wave with frequency above half of the sampling rate.8 0. The red wave is the high frequency input. We must sample faster than twice the signal bandwidth. 490 1. The general shape of the sinc function is sinc = sine (X) / X . The blue shows the locations and magnitude of the sampling sinc's. What is X? The specific sine wave used to construct the sinc function sets the limits for our process of being able to reconstruct a wave out of a sum of sincs. Clearly in this case.4 0.

2 1.4 VS n SincS n 0 0. made by adding 16 harmonics.25 1. Lavry Engineering.25 0 0 5 10 15 20 25 tn 30 35 40 45 50 50 Both the ringing and the finite rise time are a result of band limiting.4 0.25 1. Let’s align and multiply a few sinc's with the saw tooth wave: Copyright Dan Lavry.8 0. 2004 .2 0.25 0.2 1. 1.8 − 1. Inc.25 0. We can repeat the above process for a band limited "saw tooth" wave. A perfect saw tooth would take infinite bandwidth. Let's slow the input wave to less than half the sampling frequency.75 − 1.2 0 1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 0 tn 20 Let's investigate a more complex waveform.75 0.Sampling Theory Page 9 In the previous plot. the occurrence of the sinc's is too slow to track the fast changing input wave. All harmonics above 22KHz are set to zero.25 VT n 0. 1. Below is such a wave. The sinc's location is now properly set to track the waveform.

25 0 0 5 10 15 20 25 tn 30 35 40 45 50 50 Let's find the difference between the original band limited wave and the sum of the sincs.75 VT n − 1. Note that the error converges to zero at around t=25.25 0. Lavry Engineering. The plot below shows the difference magnified by X10.75 0. 210 VO n .75 − 1.25 VO n . Again we see some distortions at the abrupt start (near t=0) and the end (t=50). Copyright Dan Lavry.25 VO n .25 1. Inc. the bigger the distortion. The more abrupt. 250 VO n . 230 VO n .Sampling Theory Page 10 1.25 1. 290 VO n .25 Sumn 0. 270 0.25 0. 220 VO n .25 VO n . 300 0. 1. 2004 . 200 VO n . The center point T=25 is only 25 sinc's away from the start and stop points.25 0. 280 VO n . 260 1.25 1. 240 VO n .25 10 10 13 16 19 22 25 tn 28 31 34 37 40 40 Let us complete the process by adding ALL the sincs functions.75 0.

scale them (multiply) and sum it all. Let us review Nyquist Sampling Theory: A sampled waveforms contains ALL the information without any distortions. but where can we find such sinc functions in hardware? Is there any additional meaning to the sinc function? So far we viewed the sinc as a time domain wave . we need not sample much faster than twice that bandwidth to have the ability to retrieve 100% of the original signal. Copyright Dan Lavry. because the addition of the sincs yields the proper wave shape. 2004 .25 1.75 Diff n⋅ 10 0. we require that the frequency of the sinc function will exceed the highest frequency of the signal we need to sample. Is there another meaning to it? Time domain and Frequency domain We saw how we can construct any band limited waveform out of sinc functions. We align our sinc's with our sample times. Lavry Engineering.25 0 0 5 10 15 20 25 tn 30 35 40 45 50 50 Once again.25 1. The sine wave is amplified by X100 for the sake of clarity.25 0 0. Inc. The bandwidth limitation provides sufficient basis for perfect results (it is analogous to needing only 2 points to draw a straight line). How can we retrieve the signal from a series of sample points? We already know one way to do that. when the sampling rate exceeds twice the highest frequency contained by the sampled waveform. and sinc ( x) := 1 for x=0 Graphically speaking. Note that once we agree on what constitutes audio bandwidth.Sampling Theory Page 11 1. we can see that sinc(x) is a product of sin(x) and 1/x. Next we will present some graphs and explain the relationship between sinc function and bandwidth. Such statement in the frequency domain can be restated in the time domain as: the sample width of the sinc (the distance between zero crossings) will not be longer than the cycle time of the highest frequency within the bandwidth. That is nice in theory. The traditional definition of sync is: sinc ( x) := sin ( x) x for all x not equal 0. However.a plot of amplitude variation in time. the errors near the ends (start and stop) are due to the high frequency content near the ends of the input signal.25 0. Keep in mind that the error is a high frequency signal.25 0. The plots below show a sine wave (red) and 1/X function (blue). We pointed out that there is no reason to sample at rates higher than twice the bandwidth.75 − 1.

The 1/x amplitude multiplier is 1. but the function itself has amazed me over the years. Note that the positive half cycle near zero is multiplied by positive value and the negative half cycle near zero by a negative value.5 0...3. 1/4. The region near zero is less intuitive to understand. That is the relationship between bandwidth and the sinc function. respectively. Inc.5 5 4 3 2 1 0 xn 1 2 3 4 5 5 −5 Authors comment: While I find the definition for a sinc function rather straight forward. I decided to try and understand it from a different angle..25 − . Proof: Copyright Dan Lavry. In fact at x=0 where we encounter multiplying infinity by zero. Let me begin by stating a theorem that will shed light on the relationship between the frequency domain behavior of a system and its time domain response. we set the outcome to 1 to make a continuous and smooth plot at x=0.4. The outcome is the sinc function as shown bellow: 1.75 Sincn 0.5 0.Sampling Theory Page 12 100 80 60 40 Sinen⋅ 100 20 0 Amp n 20 40 60 80 − 100 100 100 5 4 3 2 1 0 xn 1 2 3 4 5 5 −5 Multiplying the red and blue plots above yields a sinc function.25 0 0. at X=1. Lavry Engineering. specifically the "mysterious connection" between its ability to provide perfect interpolation of a band limited signal. 2. but we can see a multiplication of large envelope numbers (blue) by small sine wave near zero (red). Lavry's sinc function theorem: The sum of all cosine waves of amplitude A within a bandwidth 0 to BW (Hz) is equal to a sinc function with BW frequency and BW times A amplitude. 1/2. This generates a symmetrical outcome.. 1/3. 2004 .25 1.25 1 0. making for a decaying envelope sine wave.

2Hz. while two waves are peaked. We start by plotting 4 cosine waves at the following frequencies: 1Hz. all the peaks occurs at x=0. The sum of the 4 waves begins to look like a crude approximation of repeated sinc functions. Inc.Sampling Theory Page 13 ⌠ ⎮ ⌡ BW A ⋅ cos ( n ⋅ t ) dn is equal to ( A ⋅ BW) ⋅ sin ( BW⋅ t ) ( BW⋅ t) 0 Note: we use cosine waves (not sine waves) because the idea here is to take all the possible frequencies within the bandwidth and align the peaks of one cycle of each frequency at one point on the X axis. the other two waves are at a minimum value. Conversely. A sinc wave in the time domain is an expression of a perfect brick wall low pass filter. yet the theorem points a direct relationship between bandwidth and the time domain impulse response. This is where the added outcomes peak.75 0. 1. t=75 and t=100. 30 C n . When using cos(x) waves. 3Hz and 4Hz. Lavry Engineering.25 C n .25 − 1. 2004 .25 0 0 10 20 30 40 50 tn 60 70 80 90 100 100 Adding the 4 waves yields and interesting result. 20 0. t=25 and t=50. at say t=13.25 1.25 0. The mathematical proof is rather straight forward.25 C n . We see the 4 waves reach their maximum value at t=0. such as we use for sampling: Copyright Dan Lavry.75 C n . 40 0. making the sum at t=13 zero. Let us investigate this relationship graphically. 10 1.

1.25 C n . 40 C n . 80 0. 10 C n . Our Bandwidth is still 4Hz.25 1.75 − 1.25 0. 2004 . 2.25 0 10 20 30 40 50 60 70 80 90 100 0 tn 100 The sum of the above 8 waves yields the plot below. 60 C n . The frequencies are 1/2Hz.5Hz.25 0. but we now have 8 waves separated by 1/2Hz.25 0.. Copyright Dan Lavry. 50 C n .Sampling Theory Page 14 5 5 4 3 Sumn 2 1 0 1 −2 2 0 0 10 20 30 40 50 tn 60 70 80 90 100 100 Let us double the number of cosine wave. we use cosine wave (phase shifted sine waves) because we want the peaks to line up and add up to a "main lobe". 1Hz. 20 C n . 30 C n .75 1. 2Hz.5Hz. Again.. Inc.. 70 C n .4Hz. Lavry Engineering. 1.

including more tones within our bandwidth makes a better approximation of a sinc.the sinc width is halved and there are twice as many sinc's The sum made of higher frequencies created narrower sinc approximation.4Hz. when we have a cosine wave at every frequency over the selected bandwidth (there are infinite such frequencies) the sum becomes a perfect sinc. We also see that the number of peaks doubled. The plot below is made by summing 1Hz. by the time we add them ALL.. Given that the bandwidth we chose 0-4Hz contains infinite frequencies. 25. 1.8Hz. 2Hz. At the limit. the further the separation between the peaks.50. the width is a function of the bandwidth: increasing the bandwidth yields a narrower sinc. but we already saw how to decrease them: all we need to do is insert more cosine waves. Conversely. With 8 waves we get 3 peaks (at t=0. the width of the sinc (the time between zero crossing of the “main lobe”) occurs at a frequency equal to the bandwidth of the system. Note the decaying ringing. Lavry Engineering. We doubled the bandwidth (from 4Hz to 8Hz).constant frequency to the cutoff frequency. With 4 waves we had 5 peaks (at t=0. 2004 . the separation will be infinite and we will end up with ONE sinc function.. the better the sinc approximation. because we are adding narrower half cycles with the "main lobe". we doubled the number of cosine waves and the result yields half the "approximate sinc's". The overall shape is the same in both cases (8 waves) but the times scale is contracted . 50 and 100). Inc. Second. The previous plot was made by summing 1/2Hz. First. 1Hz. That limit is an expression of analog brick wall filter . zero amplitude above the cutoff frequency Copyright Dan Lavry.. The more harmonics we add. The more waves we add.. and there is only one "main lobe".. The next plot shows what happens when we increase the bandwidth by a factor of 2.5Hz. Third.Sampling Theory Page 15 10 10 8 6 Sumn 4 2 0 2 −4 4 0 0 10 20 30 40 50 tn 60 70 80 90 100 100 Let us analyze what happened.75 and 100). 3Hz.

In our case it is a "one cycle sinc function". and at the limit (infinite bandwidth). In the Fourier series case. Lavry Engineering. 2004 . These short duration sinc like waveforms provide near theoretical results. Although more complicated sums of waveforms could result in a sinc function. when designing sinc based digital signal processing gear (such as FIR filters) we can not have a sinc waveform that lasts for ever. because they constructively add at only one point : at time equal zero. we use sums of in phase sine and cosine waves to describe a periodic function. There are two other filters used in conjunction with sampling. This is covered in most Digital Signal Processing introductory literature (under the subject of FIR filters). The amplitude gets smaller as we get further from the center. Note that while Fourier series is limited to the construction of periodic waveforms. anti imaging (after DA). From a practical standpoint (such as meeting certain performance accuracy) we could simply ignore what happens far enough from center.Sampling Theory Page 16 10 10 8 6 Sumn 4 2 0 2 −4 4 0 0 10 20 30 40 50 tn 60 70 80 90 100 100 Counter to the Fourier series that is based on a fundamental frequency and its integer multiples. a set of cosines is the most convenient. the sinc will become a theoretical impulse (zero width vertical line). Practical vs. We can expect "only one cycle". we can expect one and only one point in time where all our waves will peak simultaneously at the center of our sinc. In fact. They are the near equivalent of an analog filter. Inc. theoretical filters While most of the energy of the mathematically pure sinc function is concentrated around the center (main lobe). We are now equipped with an intuitive understanding of the relationship between a sinc function and bandwidth. reconstruction and general signal processing: 1. Infinite impulse response (IIR) filters. 2. the decaying ringing continue in both directions for ever. Copyright Dan Lavry. Our analysis is based on infinite number of waves of all frequencies. Note that the outcome of increasing the bandwidth is a narrower sinc. thus there is no common denominator to define a repetitive cyclical behavior. Analog filters. We use these “analog in. analog out” circuits as anti alias filters (before AD). the sinc function we constructed out of infinite waves is not subjected to requirements of periodicity. There are methods yielding excellent approximation to a theoretical sinc function. With time limits set between -infinity and +infinity. the approach we have taken is to include all the possible sine (or cosine) waves.

5k VCC VEE R10 3. Any filtering (removal) of the high frequency energy would remove the difference.58k C12 1000p C8 1000p V6 15 Let us make the input V1 into a sine wave and sweep over 0 to 1MHz and plot the frequency response (red . However we need to be sure that while filtering of the high frequencies we leave all the energy bellow Nyquist (the audio band).015u VCC VEE Butter X9 OPA627 C7 2200p R9 1. Nyquist did not guide us to use a sinc function based filter.64k R11 1. Both circuits are 5 pole filters. He stated that the difference between the original wave and the original waveform is high frequency. V4 15 X4 OPA627 R4 1. thus yield the original.77k R23 2.Butterworth. The input V1 (left side) drives both the top circuit (Chebyshev filter) and the bottom filter (Butterworth).01k VCC VEE C11 1000p R13 3. thus the key to making them the same (to remove the difference) is filtering out high frequencies (above Nyquist). Lavry Engineering.84k VCC X5 OPA627 R24 681 C21 . The different resistor and capacitor values yield different responses.37k X8 OPA627 C20 680p V17 15 V8 15 C2 680p VIN V1 X6 OPA627 C13 . which may be used for anti aliasing or anti imaging.0033u VCC VEE Cheby VEE C9 2200p R5 1.72k R12 461 C10 . Bellow is a schematic of 2 analog filters. Inc. digital out” The theory presented so far showed signal reconstruction as a “sum of sinc functions”.Sampling Theory Page 17 These filters are “digital in. The concept works because we chose a sinc function that is a filter with a bandwidth at Nyquist (half the sample rate). 2004 . with a bandwidth of 48KHz (-3dB point).0018u X7 OPA627 VCC VEE R8 1. green – Chebyshev): Copyright Dan Lavry.

0 Plot1 20*lgt(vmagcheby). if the time duration is zero.0m 10.Butterworth. cheby. zero elsewhere). green – Chebyshev): 1 butter 2 cheby 3 vin 1. Lavry Engineering. vin in volts 500m 220m 1 3 2 -60.0u time in seconds 70. 20*lgt(vmagbutter) in unknown 0 -40.06 780m Plot1 butter.0 -80.0 3 -120 4 100 1k 10k frequency in hertz 100k 1Meg Let us now look into the impulse response. We will approximate the impulse by making V1 into a 10 uSec pulse.Sampling Theory Page 18 3 20*lgt(vmagcheby) 4 20*lgt(vmagbutter) 40. there is no energy.0u Copyright Dan Lavry. we should make V1 into zero width impulse. Of course.0u 30. Inc. Theoretically. The plot shows the impulse in blue (1 volt between 10 and 20uSec.0u 50.0u 90. unless the amplitude is infinite. The two other traces show the circuit impulse responses (red . 2004 .

It is certainly does not look like a sync function. Early audio converters designers faced a serious compromise between the steepness of a hardware filter and the size of data files. others are undesirable and are caused by equipment shortcomings. Retaining the correct waveform is the scientific criteria for perfect conversion. Both filters provide examples of real world circuits that can be used for anti aliasing or anti imaging. A 21uSec cycle time is 48KHz which is the filter bandwidth.Sampling Theory Page 19 These are “real world circuits”. It is removal of high frequency energy above Nyquist that counts (while keeping the audio in tact). The Butterworth is a “near relative” of the old sinc function. Inc. Lavry Engineering. Some of such deviations are intentional (EQ. 2004 . Filtering to avoid aliasing To meet Nyquist's criteria. at least on the decay side. High frequency energy may find its way into the audio range (aliasing). reverb and more). Many factors may cause deviation from the ideal conversion. sooner and free of ringing. any activity at the output can not happen before the occurrence of the input. The impulse is slightly steeper. one needs to ensure that no energy at frequencies above half of the sample rate enters the AD converter. Unlike the theoretical sinc analysis. Pre filtering may be needed to avoid such unwanted outcome. It is interesting to see that the Butterworth filter (red) looks similar to a sinc function on the right side of the peak. A good filter yields the original waveform out of a sampled signal. High filter orders yield better alias rejection but increase circuit complexity and can increase noise and distortions. An Ideal AD (for sampling) followed by an ideal DA (reconstruction) would behave as well as a perfect wire. The Chebyshev filter (green) yields a different impulse response. Other practical considerations Let us now focus on some practical issues relating to sampling and reconstruction hardware. Blue: filter curve Black: filtered audio Red: filtered aliased energy Copyright Dan Lavry. yielding a waveform out of the DA that is the same as the waveform fed into the AD (we can allow for gain or attenuation). Note that one cycle of ringing is about 21uSec (starting at 48uSec and ending at 69uSec).

but can be removed later. The advantage of the wider NRZ pulse is higher energy.10 5 200 0 50 n 100 0 22 44 f ( i) 66 88 110 Most practical circuits extend the width of each pulse so the time of the next sample.Sampling Theory Page 20 10 10 0 10 20 G ( x) 30 VF1 n 40 50 VF2 n 60 70 80 90 100 − 110 110 0 0 5 10 15 filtering of sampled signal 20 20 25 30 N+ 1 2 35 ⋅ 22 40 45 50 50 x⋅ p ⋅ 44 . Real hardware DA reconstruction require some minimum (non zero) pulse width.10 Vn vs n 0 5 analog and sampled time domain plot 0 vsf1i 50 Si 100 150 sampled signal frequency plot 1 . The difference between the input signal and its NRZ representation is an error signal (right plot) Copyright Dan Lavry. The signal shown below is made of 4 tones (time domain plot on the left and frequency plot on the right). 1 . The high frequency energy is “carried along” with the digital signal. Lavry Engineering. Zero width pulses carry no energy. is a good starting point but not really practical. The high frequency energy is part of the sampled signal. f ( n) Removing high frequency BEFORE sampling (above Nyquist) is needed to avoid aliasing. It is called NRZ (not return to zero). Inc. f ( n) . Sampling and the Sinc Function "Near theoretical" sampling. The sample value is no longer a point. 2004 . We will next see that sampling itself introduces high frequency energy. It is retained (held) until the next sample time.

10 0 50 n 100 5 0 50 n 100 Most of the energy in the error signal is made of frequencies above the audio band. frequency).10 Vn VSn 5 analog and NRZ sampling time plots 1 . It also shifts the frequency content of the error signal to higher frequencies. There is no harmonic distortion associated with that attenuation. This attenuation can be observed on a frequency response plot (amplitude vs. but some of that energy causes attenuation at audible high frequencies. Inc.10 5 1 . yet it is an undesirable side effect of NRZ sampling. frequency plot for NRZ sampling 22 0 25 27 vsf i 29 31 33 magifying the frequncy plot 22 vsf i 100 200 0 50 f ( i) 100 35 0 8 16 f ( i) 24 32 40 Over sampling (shown below X2): Sampling at a faster rate lowers the amplitude of the error (difference) energy.10 5 analog and sampled signal difference 0 ε1 n 0 1 . The error (right plot) shows X2 in black (X1 in red) Copyright Dan Lavry.Sampling Theory Page 21 1 . Lavry Engineering. 2004 .

Lavry Engineering.10 5 0 50 n 100 With X2 sampling.10 5 X2 oversampling difference signal 5 . Inc.10 Vn VS2n 4 5 . 2004 . this attenuation is due to NRZ sampling.10 ε2 n 4 0 4 ε1 n 0 4 5 .10 5 0 50 n 100 1 .Sampling Theory Page 22 1 . both AD alias protection requirement and DA high frequencies image removal are located at much higher frequencies thus pre and post filtering is much easier. f ( i) . The undesirable high frequency attenuation due to NRZ sampling has been reduced as well Blue: filter curve Black: filtered audio Red: filtered aliased energy 20 20 0 20 G2( x) 40 VF1i 60 80 VF2i 100 120 140 − 180 160 180 X2 oversampling and filtering 0 0 11 22 33 44 x⋅ p ⋅ 44 . The plot below shows the improvement in flatness response for increased over sampling ratios. The faster we over sample the less high frequency audio band attenuation. As mentioned before.10 5 . f ( i) 55 66 77 88 88 Note the additional advantage of over sampling: the attenuation of high frequency audio is reduced. Notice the attenuation near 20KHz: Black: X2 over sampling Red: X4 over sampling Blue: X8 over sampling Copyright Dan Lavry.10 5 X2 oversampling time plot 1 .10 1 .

x⋅ 705. You do not need "more dots" for better accuracy. In the case of DA converters. It is most important to avoid confusion between the modulator rate and the conversion rate. such faster sampling is common practice with both AD and DA hardware.2 . Lavry Engineering. X4. x⋅ 352.6 Clearly there are benefits to faster sampling: 1. More examples and plots: How many sample points are needed? Analog signal is continuous thus it has infinite points.5 2 2. Easier filtering (AD anti aliasing and DA anti imaging) 2.5 3 0 0 5 10 15 20 25 30 35 40 45 50 50 sin(x)/x plots for X2.1KHz X 16). Such over sampling and up sampling are local processes and tradeoff aimed at optimizing the conversion hardware.X8 and X16 22 −3 x⋅ 88. One should not confuse modulator speed or up sampling DA with sample rate. Sample rate is the data rate. For the sake of demonstrating our case. The reasons for such fast operation is outside the scope of this article. Indeed. It is sufficient to state that anti alias filtering and flatness response becomes a non issue at those rates. Inc. let us approximate (approach) an analog signal by sampling the audio at 705.5 1 1. such as in the case of 192KHz for audio. the fast modulator rate (typically less bits) is slowed down (decimated) to lower speed higher bit data. 2004 . Reduction of higher frequencies attenuation at the DA side.Sampling Theory Page 23 Purple: X16 overselling 0 OS2( x) OS4( x) OS8( x) OS16( x) 0 0.4 . the data is interpolated to higher rates which help filtering and response. x⋅ 176. The tone frequency is 17KHz.6KHz (44. Most AD's today are made of two sections: a front end (modulator) and a back end (decimator).8 . The front end operates at very fast rates (typically at 64 -512 times faster then the data output rate). Therefore analog simulation is not computer friendly. Copyright Dan Lavry. In the case of AD conversion.

1⋅ 16 60 70 80 90 100 100 Copyright Dan Lavry. which again looks like a 17KHz "analog tone" 10 20⋅ log( gain( v1 .93 0 0 100 200 n 300 400 500 500 The 17KHz sine wave does not look like much of a sine wave: 1.2 Digital. 2004 .Sampling Theory Page 24 1.2 0.2 Aproximation to analog VA n 0 − 1.93 0 0 100 200 n 300 400 500 500 Let us filter the above digitized (sampled) signal. 44. Inc.2 0. Lavry Engineering. We will again approximate an analog output with an X16 digital approximation.1KHz sampling VD n 0 − 1. x) 10 25 22 ) 60 95 − 130 130 0 0 10 20 30 40 50 x⋅ 44. Below are filter response plot (0-100KHz) and the output waveform.

Inc. 2004 .1⋅ 16 60 70 80 90 100 100 Copyright Dan Lavry. Lavry Engineering. 44. This is what an audio square wave looks like.925 VD n − 0.739 1000 1000 1100 1200 n 1300 1400 1500 500+ 1000 Let’s repeat the process for a 1 KHz square wave The wave is not "perfectly square" because it is bandwidth limited to 20KHz. We will again approximate an analog filter with an X16 digital approximation.1KHz sampling 0 2 0 0 200 400 n 600 800 1000 Points Let us filter the digitized signal. 10 20⋅ log( gain( v1 .Sampling Theory Page 25 0.739 Filtered digital signal VF n − 0.927 1 0 0 200 400 n 600 800 1000 Points 1 Aproximation to analog 0 0.927 2 Digital.927 VA n − 0. x) 10 25 22 ) 60 95 − 130 130 0 0 10 20 30 40 50 x⋅ 44. 0.

Can it be that someone made a real good 192KHz device.05KHz of audio. not just at sample times but at all times. the folks that like the "sound of a 192KHz" converter hear something.1KHz? There are reports of better sound with higher sampling rates. That same tape that typically contains "only" 20KHz of audio gets converted to digital by a 192K AD. As pointed out by the VERY FUNDUMENTAL Nyquist theory. up sampling and decimation.1KHz. So we have the pros and cons to increased sampling: Pro: Easier filter Overcome Sinc problem Con: Reduced accuracy Significant increase in data files size Significant increase in processing power required We can optimize conversion by taking advantage of concepts such as over sampling. Inc. These processes help the hardware at the proper locations (AD and DA) and should not be confused with system sample rate. “If you hear it. Clearly it has nothing to do with more bandwidth: the instruments make next to no 96KHz sound. Such reports neglect the fact that a 44.Sampling Theory Page 26 0. and the ear can not hear it. The determination of sample rate must be decided by bandwidth of the ear. Moreover. The same converter architecture can be optimized for slower rates and Copyright Dan Lavry. If you like it and want to use it. There is NO ADDITIONAL INFORMATION in higher sampling rates. than stripped out of all possible content above 22KHz (down sample to CD). 2004 . It could be certain type of distortions that sound good to you. there is something there” is an artistic statement. Record at 192KHz than process down to 44. we need to sample at above twice the audio bandwidth to contain ALL the information. the microphones don't respond to it. No doubt. Some claim that that 192K is closer to the audio tape. All is contained within the "lower band".887 VF1 n − 0. It is important to realize that the end result yields a waveform where the values are correct. and even after down sampling it has fewer distortions? Not likely. we hear some reports about "some of that special quality captured by that 192KHz is retained when down sampling to 44. You DO NOT need more dots. Lavry Engineering.1KHz sampled material can not contain above 22. go ahead.887 1 Filtered digital signal 0 1 1000 1000 1200 1400 n 1600 1800 2000 Points + 1000 We saw 2 examples of sampling (AD) followed by reconstruction (DA). But whatever you hear is not due to energy above audio. the speakers don't produce it.

increased data size and much additional processing requirement on the other hand. While there is no up side to operation at excessive speeds. Operating at 192KHz causes a very significant increase in the required processing power. This indirectly implies that lower rates are inferior. 2. Whatever one hears on a 192KHz system can be introduced into a 96KHz system. 2004 .Sampling Theory Page 27 with more time to process it should be more accurate (less distortions). resulting in very costly gear and/or further compromise in audio quality. Sampling audio signals at 192KHz is about 3 times faster than the optimal rate. The compromise between speed and accuracy is a permanent engineering and scientific reality. the promoters. The danger here is that people who hear something they like may associate better sound with faster sampling. The optimal sample rate should be largely based on the required signal bandwidth. much of which is due to insufficient time to achieve the level of accuracy of slower sampling. leading the industry in the wrong direction. Conclusion: There is an inescapable tradeoff between faster sampling on one hand and a loss of accuracy. AD converter designers can not generate 20 bits at MHz speeds. there are further disadvantages: 1. That includes any distortions associated with 192KHz gear. The promotion of such ideas is based on the fallacy that faster rates yield more accuracy and/or more detail. and higher accuracy. Lavry Engineering. Weather motivated by profit or ignorance. are stating the opposite of what is true. Copyright Dan Lavry. Inc. and much of it into lower sampling rates. It compromises the accuracy which ends up as audio distortions. The increased speed causes larger amount of data (impacting data storage and data transmission speed requirements). wider bandwidth. Audio industry salesman have been promoting faster than optimal rates. yet they often utilize a circuit yielding a few bits at MHz speeds as a step towards making many bits at lower speeds.

Sign up to vote on this title
UsefulNot useful