## A Conversation for Fourier Theory

### Nyquist Theorem

J. Nigel Aalst Started conversation May 23, 2001

That isn't exactly how the Nyquist theorem (or rate, whichever you prefer) works. The Nyquist theorem has to do with frequencies, not distortion. There also is no "perfect" digital reproduction of an analog wave.

The Nyquist theorem merely states that to reproduce a given frequency, the sample rate must be at least twice the frequency. Or, stated another way, that the highest frequency that can be reproduced by a given sample rate is half of that sample rate.

A wave at a particular frequency must be sampled twice in each cycle (once on compression and once on rarefaction) to be reproduced as that frequency. If a frequency which is higher than half the sample rate being used is sampled, then that wave will instead be reproduced as a completely differenct frequency. This is mucch easier to explain with visual aids.

The practical application of this is that when recording sound digitally, a low pass filter is used and set at half of the sampling rate to avoid introducing spurious frequencies.

It should also be noted that the sample rate of twice the highest frequency is the bare minimum needed to reproduce that frequency at all. Amplitude will not be correct at this rate (as only two samples per cycle are being taken, as compared with thousands per cycle of the lower frequencies). This is why the high end suffers on CDs, and the reason for audiophiles and recording engineers pushing for a DVD-Audio format which uses a 96kHz sampling rate. Even though people can't hear the higest frequencies a 96kHz rate can reproduce (48kHz), it will make reproduce the highest frequencies that humans can hear (approx. 20kHz) more accurately than the 44.1kHz CD standard does.

### Nyquist Theorem

ShortCircuit Posted May 23, 2001

Furthermore, to clarify on "reproduce audible frequencies more accurately" part, here's some more confusing facts that come back to Fourier.

If you listen to a naturally produced tone - for example, from a piano - of a certain frequency - say, C4 (which would have a certain, known, main frequency), and then listen to the same tone, but produced on another instrument - again for example, a guitar - they sound different. People usually refer to this as 'the tone colour'. What it really means is that the _waveforms_ of these two tones (of the same main frequency) are different (by the way, it really is hard to talk about this without drawing). Roughly, one might say that one tone has approximately triangular waveform, and the other one has approximately rectangular waveform. A pure tone of one single frequency would have a perfect sinusoidal waveform. A Fourier transform of such a pure tone would be just one single peak at this frequency. And Fourier transforms of the two natural tones would have an infinite number of bigger and smaller peaks that would be totally different except for the one that represents the main frequency (that musicians would call C4).

Now, if you'd sample these tones at the minimal rate given by the Nyquist theorem, based on the main frequency - that is, twice the main frequency - and reproduced them back, both would sound much more similar to one another than the original tones, and both very much different from their originals. Basically, you'd hear a single main frequency tone of a distinctive 'metallic' sound toghether with some lower-frequencies noise (like a distant construction machinery). The noises coming from the so-called 'aliasing' effect - which means that the higher frequencies which give the 'color' to the sound are too high to be sampled correctly according to the Nyquist theorem, and thus are transformed into a senseless noise.

The practical effect is: CD reproduction is, actually, very, VERY, far from flawless and the distortion at higher frequencies (10 kHz and more) most probably comes exactly from the CD player, and NOT from the speakers.

### Nyquist Theorem

Martin Harper Posted May 23, 2001

Umm, the fourier transform of a square wave of frequency f has a number of higher harmonics at frequencies 3f, 5f, 7f, 9f... and they are all smaller than the spike at frequency f. None of them are at lower frequencies. So, obviously you can't store these infinite number of harmonics. But you don't need to, because the brain can't hear them - after a certain point, they're all above-threshhold.

I'm not sure about CDs, to be honest. It may well be that they misestimated the hearing threshhold of people, or that the reproduction isn't perfect. I'm not sure, I'm not an expert on the specifics, just some random theorist.

The Nyquist Rate *is* perfect, though - the difficulty is in insuring that the incoming signal is strictly bandlimited - that's why you need to filter them out, and in practice this filtering is imperfect, and you get these aliasing effects.

### Nyquist Theorem

J. Nigel Aalst Posted May 24, 2001

The Nyquist Theorem is perfect in what way? This is what I'm not getting, because, as I stated above, the amplitude of a 22k wave sampled at 44k is going to be off. The frequency will be reproduced accurately, but with the amplitude is only going to be close if the samples fall somewhere around the wave peak. Yes, it's true that at these very high frequencies, about no one is going to notice. There are a few sensitive eared individuals out there who can tell the difference, but by and large, it's accurate enough that most people aren't going to compain.

I just dispute the fact that any digital reproduction of an audio signal is perfect. However, you may mean something different that I'm not getting, and if that is the case, it would be lovely if you could clarify.

### Nyquist Theorem

Martin Harper Posted May 24, 2001

Well, you can dispute the fact, but it *is* a fact... at the very basic level, "y = sin x" is a digital reproduction of an audio signal and is absolutely perfect - it's not a very complicated signal, tis true - but it shows that it can be done.

Sampling at the Nyquist Rate should be perfect, meaning that from that information you can reproduce both amplitude and frequency. I'm staring at my Computer Science notes as I write this, and these people don't tend to get things wrong. I can see your point about the amplitude being undefined though - I'll get back to you, if that's OK?

### Nyquist Theorem

ShortCircuit Posted May 25, 2001

I'm not sure whether this is allowed here (if not, someone, please, erase it), but I'm willing to bet on my whole home HiFi equipment (approximately 3000 US$) that your're wrong.

About your notes, I don't doubt Your lecturers' knowledge, but have you considered the fact that you may have written it down wrong (or incomplete), hmm?

My (now very old and dusty) notes state differently, and my experience supports them.

If the original is just a plain sine wave (which in practice rarely is the case, usually, the signals are much more complex) of the frequency f1, and you sample it at the minimal Nyquist rate of 2*f1, you'll get a digital replica of the original which WILL have exactly the same frequency f1, but will NOT have exactly the same amplitude (the amplitude will vary from zero to original amplitude) unless the sampling process is somehow synchronised with the original signal in terms of phase shift. Most important, what the replica most certainly will NOT have is the same waveform. While the original is a SINE wave of frequency f1, the replica would, in this case, be a SQUARE wave of frequency f1. The only thing that you can do about this is ASSUME that the original was a sine wave, and algorhytmically generate a 2nd generation sinusoidal replica with sampled points assumed to be at known phase angles of the original. But, if you do this, you'll make it even worse for all the originals other than a sine wave.

It borders the Impossible to prove or explain this any further here without a few diagrams and drawings, so I will not try any further. If you insist, drop a note to [email protected] and I can clarify by E-mail.

### Nyquist Theorem

Martin Harper Posted May 25, 2001

My lecturer was wrong - or rather his own notes were...

You need to sample at strictly *more* than twice the frequency of the original. So if the original has a highest frequency of 1Hz, you need to sample at 2.00001Hz. This gives you enough information that you *can* reconstruct the original - it's just *very* difficult.

Note that to reconstruct the original from the samples you don't just use step functions and suchlike: you do Fun With Sinc in order to get back the original, smooth, wave form. That's why you don't get a square wave...

### Nyquist Theorem

J. Nigel Aalst Posted May 28, 2001

I found a couple of interesting sites on this. One is a paper entitled "Nyquist Theorem Fallacy" and it explains why the Nyquist Rate doesn't reproduce the signal accurately, with math that is over my head. But then I wasn't a math major, I was an audio major. One of the major things was something about how the theorem assumes an infinite sample rate, which is not possible. The other site is a more practical discussion, which includes bits on audio and video sampling. For anyone interested, I've linked to them on my researcher page.

### Nyquist Theorem

ShortCircuit Posted May 28, 2001

Er... Exactly where could you apply something like this? What you described IS in fact an accurate, but very simplified theory. While it might be of some use in, I don't know, maybe in an off-line digitized image analysis, it certainly couldn't work in any real-time application (like playing a CD, digital measurement, automatic control, etc.) which is the most common use.

I've studied digital automatic control systems (and one very important part of this is digital real-time sampling) and work in that field for 6 years now, and I'm also a part-time junior lecturer on the subject. In real-time applications with signals of wide-variety (sound processing, measurements, robotic vision,...) you MUST use STEP functions (or, at the very best, linear segments), because everything else is too specific.

You know, under-graduate theory is always way too simplified to be actually useful. That's because its purpose is not to be useful but to teach the students to comprehend the principle. Only when you manage that, you can go into details and do something useful with it.

I suggest you try and make an experiment. Record two sounds - one a single sinusoidal tone of a known frequency (possibly from a function generator or something similar), and another natural, of about the same frequency (a single piano or a guitar tone). Then reproduce them into your PC's soundcard over and over and try sampling with different rates - try picking the original frequency to be close to the half of the lowest sampling rate that you have available. Then play the sounds that you digitized and compare it to the original sounds. If you have the time, you could also try to write your own software that would use the digitized files (WAV or something) to read the samples, but play them by interposing a sine function or something like that into the sample-points. I guarantee that you shall be amazed how nicely the first tone sounds, but even more so about how badly the second one sounds using that kind of reproduction.

### Nyquist Theorem

Martin Harper Posted May 28, 2001

I hear what you're saying - and yes, I definately agree that most undergraduate stuff is distinctly unlikely to ever be useful. My understanding was that the Nyquist rate gave you the rate you needed assuming:

A) an infinitely prolonged signal and sampling

B) unquantised samples (IE, sample the exact analogue value at a point in time, rather than sampling the value and storing it digitally)

C) reconstruction using sincs et al

D) a perfect filter for the reconstruction

and probably other stuff. In practice you have none of these things, so in practice you need to sample at a rather higher rate. Again, my understanding was that there were appropriate modifications to Nyquist which could take account of such things {given, perhaps, a minimum tolerance of error} - but that was probably just youthful optimism...

So yeah, the few lines of comment on Nyquist in this entry should be altered. Of course, what we *really* need is someone who understands it properly to write an entry on the subject... perhaps one of you fine gentlemen would care to do such a thing?

### Nyquist Theorem

ShortCircuit Posted May 29, 2001

As soon as it becomes possible to illustrate an article with external (meaningful) images, I might try. Without that tool, I find it a futile effort.

### Nyquist Theorem

J. Nigel Aalst Posted May 31, 2001

No, they killed offsite picture linking as part of the BBC deal. It's not supposed to work anymore. It is my understanding (although I could be mistaken) that eventually there will be some sort of image storage space for this sort of thing, or it will be worked out somehow. But for the moment there is no really easy way to illustrate this kind of thing (unfortunately).

### Nyquist Theorem

Mycroft Posted May 31, 2001

If you care to try, it's quite possible to aurally distinguish between a 48k (i.e. DAT quality) sample and a 44.1k sample recorded and played back from the same source.

Anyone for 192k 32-bit sampling?

### Nyquist Theorem

Martin Harper Posted May 31, 2001

Nigel - you can't use the tag to link to offsite images, but you *can* use the tag or the tag, to open up the picture in a seperate window. It's been done.

### Nyquist Theorem

J. Nigel Aalst Posted Jun 1, 2001

Oh, but that's just such poor design that I don't think I could bring myself to do it. Yes, I *am* that anal. Anyway, I only know this as it applies to digital audio, and therefore I am unqualified to write more than that bit of an article.

As for 192/32. I'll bet it sounds great, but think of the storage space you would need. For it to be practical (at least given current storage tech - and assuming you'd want it relatively portable), you'd want to build a lossless compression scheme into the hardware or something. Hmmm....

### Nyquist Theorem

Mycroft Posted Jun 1, 2001

The storage requirement is only an 8-fold increase on CD quality and DVDs have the bandwidth to handle that losslessly, but it was deemed more useful to add extra channels instead .

### Nyquist Theorem

me[Andy]g Posted Feb 8, 2002

"Er... exactly where could you apply something like this?"

Well.... if you're processing seismic waves (measuring the response from sending a signal - any kind of wave signal - into the ground), then you do use the FFT... and hence you need to know something about the Nyquist frequency in order to prevent data aliasing, which would hide the actual results.

If not, then the oil and gas industry (in particular) are barking up completely the wrong tree and someone needs to tell them about it!

Andy

### Nyquist Theorem

GTBacchus Posted Dec 8, 2002

I wonder if anyone subscribed to this thread would like to comment on A882182, which I'm currently subbing. It's about digital versus analogue recording techniques, and you lot know a good deal more about that stuff than I do. Lucinda was telling me that he thought the entry was very biased, but I don't really get that impression.

Thanks.

GTB

Key: Complain about this post

### Nyquist Theorem

- 1: J. Nigel Aalst (May 23, 2001)
- 2: ShortCircuit (May 23, 2001)
- 3: Martin Harper (May 23, 2001)
- 4: J. Nigel Aalst (May 24, 2001)
- 5: Martin Harper (May 24, 2001)
- 6: ShortCircuit (May 25, 2001)
- 7: Martin Harper (May 25, 2001)
- 8: J. Nigel Aalst (May 28, 2001)
- 9: ShortCircuit (May 28, 2001)
- 10: Martin Harper (May 28, 2001)
- 11: ShortCircuit (May 29, 2001)
- 12: Martin Harper (May 29, 2001)
- 13: J. Nigel Aalst (May 31, 2001)
- 14: Mycroft (May 31, 2001)
- 15: Martin Harper (May 31, 2001)
- 16: J. Nigel Aalst (Jun 1, 2001)
- 17: Mycroft (Jun 1, 2001)
- 18: me[Andy]g (Feb 8, 2002)
- 19: GTBacchus (Dec 8, 2002)

### More Conversations for Fourier Theory

### Write an Entry

"The Hitchhiker's Guide to the Galaxy is a wholly remarkable book. It has been compiled and recompiled many times and under many different editorships. It contains contributions from countless numbers of travellers and researchers."