To all you DSP mavens out there. I am looking for some references to distortions introduced by sampling = errors, especially sampling close to the Nyquist criterion. In all the = literature I have seen, reconstruction of a waveform is guaranteed if the sampling = meets the Nyquist criterion, that is sample rate > 2F. =20 There are lots of cases where the Nyquist criterion doesn't seem to work = well. A classic case is there you have a single frequency (frequency F) sine = wave, and you sample at 4F starting at a phase angle of 0 degrees, you can = perfectly reconstruct the wave. However, if you begin to sample at a lag of 45 = degrees, you can reconstruct the wave shape, but not the amplitude because the = sampling will miss the peaks of the wave. Is the sampling really a statistical phenomena, where on average we can reconstruct the waveform, or is it more deterministic? If it is = statistical, how does one compute the second order statistics? I have heard musicians criticize CD recordings, complaining about = distortion at the higher frequencies. This seems to be part of the same phenomena. Any help in understanding (including any references) this would be = appreciated. Steve

# Does anyone have any reference to sampling distortion?

Started by ●September 1, 2003

Posted by ●September 1, 2003

In article erd7lvct2b0sluh0ocqs8166jiotd7jlkq@4ax.com, Steve at nospam@nowhere.org wrote on 09/01/2003 17:43:> To all you DSP mavens out there. > > I am looking for some references to distortions introduced by sampling errors, > especially sampling close to the Nyquist criterion. In all the literature I > have seen, reconstruction of a waveform is guaranteed if the sampling meets > the Nyquist criterion, that is sample rate > 2F. > > There are lots of cases where the Nyquist criterion doesn't seem to work well. > A classic case is there you have a single frequency (frequency F) sine wave, > and you sample at 4F starting at a phase angle of 0 degrees, you can perfectly > reconstruct the wave. However, if you begin to sample at a lag of 45 degrees, > you can reconstruct the wave shape, but not the amplitude because the sampling > will miss the peaks of the wave.no, 4F is sufficient. there will be only one sine wave below 2F that will go through the sample points and that will have the correct amplitude.> > Is the sampling really a statistical phenomena, where on average we can > reconstruct the waveform, or is it more deterministic?it's deterministic, but it calls for an ideal brickwall low-pass filter, something i haven't seen in the real world yet.> I have heard musicians criticize CD recordings, complaining about distortion > at the higher frequencies. This seems to be part of the same phenomena.Ah, the anal-retentive wimps! someone should slap them on the side of their head and force them to listen to 78s (or even "modern" LPs). :-) r b-j

Posted by ●September 2, 2003

In comp.dsp, Steve <nospam@nowhere.org> wrote:>To all you DSP mavens out there. > >I am looking for some references to distortions introduced by sampling = >errors, >especially sampling close to the Nyquist criterion. In all the = >literature I >have seen, reconstruction of a waveform is guaranteed if the sampling = >meets the >Nyquist criterion, that is sample rate > 2F. =20 > >There are lots of cases where the Nyquist criterion doesn't seem to work = >well. >A classic case is there you have a single frequency (frequency F) sine = >wave, and >you sample at 4F starting at a phase angle of 0 degrees, you can = >perfectly >reconstruct the wave.Assuming an amplitute range of -1 to 1, and the sine is just at full scale, the samples should look like 0, +1, 0, and -1.>However, if you begin to sample at a lag of 45 = >degrees, >you can reconstruct the wave shape, but not the amplitude because the = >sampling >will miss the peaks of the wave.In this case, the samples should be: sin(45 degrees), sin(135 degrees), sin (225 degrees), sin (315 degrees). Or: sqrt (2), sqrt (2), -sqrt (2), -sqrt (2). Or numerically to five significant figures: 0.70711, 0.70711, -0.70711, -0.70711. I don't know this for a 'theoretical fact,' but I think the reconstruction filter (a brickwall [or practical near-brickwall] low-pass filter at 1/2 the sample rate) will output a sine wave with peaks of +1 and -1 for either of these two inputs. The filter generates a sine wave (less than the Nyquist frequency) that passes through all the points. There is only one such sine wave in either case, and both sine waves have the same frequency and amplitude. I just proved to my own satisfaction that this is true. I generated an 8-bit mono 6ksps [the lowest sample rate for standard PC soundcards] .wav file in Cool Edit 2000. It starts with a 1500Hz (giving four samples per cycle) sine wave (at -6dBFS), zero degrees phase shift, for two seconds, followed by the same with a 45 degree phase shift for two seconds. When played back there is a 'click' transition between the two sections caused by the sudden phase shift, but the loudness of both sections is identical to my ears. The level indicator along the bottom shows -6dBFS for the first section, and -9dBFS for the second section, which is actually correct because the indicator does peak detection. Cool Edit 2000 has a statistics section that I used to read power levels. Here are the stats for the first two seconds (these might not be exact, as I just eyeballed the selection, I didn't try to be sample-accurate): Mono Min Sample Value: -16640 Max Sample Value: 16384 Peak Amplitude: -5.82 dB Possibly Clipped: 0 DC Offset: -.391 Minimum RMS Power: -9 dB Maximum RMS Power: -8.97 dB Average RMS Power: -8.99 dB Total RMS Power: -8.97 dB Using RMS Window of 50 ms Here are the stats for the last two seconds: Mono Min Sample Value: -11776 Max Sample Value: 11520 Peak Amplitude: -8.79 dB Possibly Clipped: 0 DC Offset: -.394 Minimum RMS Power: -9.01 dB Maximum RMS Power: -9.01 dB Average RMS Power: -9.01 dB Total RMS Power: -8.99 dB Using RMS Window of 50 ms This looks quite good, the min sample value and max sample value of the second selection are very close to those of the first selection times sin (45 degrees) or 1/sqrt(2), and the RMS power numbers of thw two sections are almost identical. The proof to me is in 1) hearing that both sections play a 1.5kHz tone at the same loudness, and 2) zooming in to the transition area to see the data points for the first half are zero, +peak, zero, -peak and the second half are 7/10ths peak, 7/10ths peak, -7/10ths peak, -7/10ths peak. You could also do an FFT of the data, and see that both sections give the same level of the same frequency. To further prove it, I generated a third section of two seconds of a sine wave, this time starting at 45 degrees (the same phase angle as the second section) but with a frequency of 1501 Hz instead of 1500 Hz. The file plays seamlessly from the second section to the third section (at four seconds into the file), and I cannot hear any variation in volume of the sound, as one might expect from looking at the waveform: the data points vary from the .7, .7, -.7, -.7 scenario to the 0, 1, 0, -1 scenario and back, four times per second. Zoomed to display all six seconds (which shows peak values) you can see eight 'humps' on the right third of the waveform. I cannot hear any volume variation nor the increase in frequency from 1500Hz to 1501Hz, but I CAN hear some 'flying saucer' sounds in the background of the last two seconds, apparently from the cheap, standard 'Soundblaster-compatible' soundcard in this computer. I think it's 'birdies' (unwanted modulation products, as sometimes heard in radio receivers) in the converter circuitry. (It helps to close your eyes or otherwise not be able to see the app's level indicator, to be sure you're not just imagining you hear the loudness going up and down with the indicator.) I've saved the file here (36k bytes): http://www.mindspring.com/~benbradley/1500.wav Play it in any .wav file player, look at it in any .wav editor.>Is the sampling really a statistical phenomena, where on average we can >reconstruct the waveform, or is it more deterministic? If it is = >statistical, >how does one compute the second order statistics? > >I have heard musicians criticize CD recordings, complaining about = >distortion at >the higher frequencies. This seems to be part of the same phenomena.I would have thought so too, but everything I've seen, read and heard on this topic has led me to believe that any distortion is due to practical real-world phenomena such as imperfect A/D/A converters, especially imperfect anti-aliasing filters on the A/D side and imperfect reconstruction filters on the D/A side, and not to any theoretical distortion of frequencies near the Nyquist frequency. (Jitter also plays a role as a source of distortion). Twenty or so years ago, the filters used to be physically separate analog blocks (in the age of successive-approximation A/D's and R-2R or equivalent-current-switched D/A's), but now they are highly integrated into sigma-delta converters, and are now (digital) FIR filters instead of analog.>Any help in understanding (including any references) this would be = >appreciated.Hope this helps. Have a nice day.>Steve

Posted by ●September 2, 2003

Steve wrote:> > To all you DSP mavens out there. > > I am looking for some references to distortions introduced by sampling errors, > especially sampling close to the Nyquist criterion. In all the literature I > have seen, reconstruction of a waveform is guaranteed if the sampling meets the > Nyquist criterion, that is sample rate > 2F. > > There are lots of cases where the Nyquist criterion doesn't seem to work well. > A classic case is there you have a single frequency (frequency F) sine wave, and > you sample at 4F starting at a phase angle of 0 degrees, you can perfectly > reconstruct the wave. However, if you begin to sample at a lag of 45 degrees, > you can reconstruct the wave shape, but not the amplitude because the sampling > will miss the peaks of the wave. > > Is the sampling really a statistical phenomena, where on average we can > reconstruct the waveform, or is it more deterministic? If it is statistical, > how does one compute the second order statistics? > > I have heard musicians criticize CD recordings, complaining about distortion at > the higher frequencies. This seems to be part of the same phenomena. > > Any help in understanding (including any references) this would be appreciated. > > SteveThe two other responses I see do the job, but I'll add this: Sample at 4F - .1, so that all phases are run through in a ten-second interval. There will be no amplitude modulation; sampling wouldn't work if there were. To sum all that up, realize that the waveform isn't simply what you might imagine from a blurry picture of the dots, but that single function which passes through all the points while containing no frequencies as high as half the sampling frequency. For any given set of samples, it is unique. Jerry -- Engineering is the art of making what you want from things you can get. �����������������������������������������������������������������������

Posted by ●September 2, 2003

Jerry Avins <jya@ieee.org> wrote in message news:<3F54BB61.5EDF952E@ieee.org>...> Sample at 4F - .1, so that all phases are run through in a ten-second > interval. There will be no amplitude modulation; sampling wouldn't work > if there were. To sum all that up, realize that the waveform isn't > simply what you might imagine from a blurry picture of the dots, but > that single function which passes through all the points while > containing no frequencies as high as half the sampling frequency. For > any given set of samples, it is unique.Almost all confusion about the accuracy of sampling stems back to people forgetting those magic words "while containing no frequencies as high as half the sampling frequency". Any time you get confused just think "am I properly band limited", and the confusion should go away! It can be fun to draw the sampled dots on a sheet of paper, and ask a confused person to join them with all possible curves that are band limited. If they draw more than one, you just tell them to iterate until they correct their mistake :-) The really confused people, who have some notion of square or triangular waves comming out of a sampled system, can be real fun with this. By the way, does anyone know a good web site to point people to, that gets the sampling idea across well to the uninitiated?