It's the details that take longest (Part 3)


Though it's true that the >20kHz frequencies aren't audible, the digitally stored waveforms of (especially) higher frequencies under 20 kHz will look (and thus sound) a lot better on 192KHz than they ever will on 44.1KHz. As you can imagine drawing a 20kHz sinus with only 2 points to draw it with won't make a nice sinus at all
 

Actually, this misunderstanding is very common, and the source of a lot of the wrong ideas about digital sound. Somehow people get the idea that a sine at 20khz that is, indeed, represented by more or less one dot at the peak and one dot at the valley would somehow be more jagged than if there were more dots (i.e. a higher sampling frequency). The point of the nyquist theorem is that it really isn't, at all. The only way to get it to be more jagged (that is, having sharper bends, looking squarer (or possibly more triangular) is for it to have higher frequency components. When those higher frequencies does not exist, as they per definition don't, since the cutoff is att 22khz (and the first harmonic of that 20khz will be at 40 khz), the sine will be a perfect sine. That is what the output filter does, if it does its job. The filter removes the components above the cutoff frequency, and therefore makes the jaggies become perfect sines. 

If the filter is ideal, that is. If it isn't, there will be some artifacts, but that is not mainly an effect of how "jagged" the sampled sound is. 
 
Well, you lot mentioning Nyquist all the time:

"If a function x(t) contains no frequencies higher than B cps, it is completely determined by giving its ordinates at a series of points spaced 1/(2B) seconds apart."

I already posted earlier, wondering about the difference between "completely determined" and "best sample rate for playback".

I was actually hoping for someone to explain that to me. Just saying "Nyquist" again and again doesn't explain anything.

Or to explain my problem with that theory with a comparison: If I say "f(0)=3", "f(3)=18", "f(100)=10203" and "f(x)=cx^2 + bx + c" then f(x) is "completely determined", but for drawing f(x) for 0<x<100 that doesn't help me a lot, for drawing f(x) I would prefer equally spaced samples, and at least 10 of them. With just three of them the function might be determined (a=1, b=2, c=3), but I can't draw it without calculating more samples.
 
Well, that theroem kinda presupposes that the function is a periodic function (because if it isn't, it does not make sense to speak of it in terms of cycles-per-second). That means that your example with the second degree equation fails - the theorem says that the points are to be placed 1/2B seconds apart, whith means that they are 1) equally spaced, and 2) goes on to infinity. Now, most sounds does not go on to infinity (except Justin Bieber songs) so there are some edge conditions, but those are for all intents and purposes inconsequential. We can approximate "goes on to infinity" with "goes on until the sound ends". 

But, yes, periodic. A periodic sound has some other properties, and one of those is that we can see it in two different ways. One is in the time domain, where we see it as basically a graph of air pressure over time - the classic "waveform display". The other way is to see it in the frequency domain: Every periodic sound can also be represented as a sum of the separate frequency components that the sound contains. That is, a graph of frequencies and their intensities. That is what you get in a sound spectrum. 

(some graphs here: http://en.wikipedia.org/wiki/Frequency_spectrum#Spectrum_analysis )

The only sound that has no more components than its base frequency is a pure sine wave. A pure sine contains only its base component and has no overtones, and that means that we can see that spectrum diagram as a chart of the sines that make up the sound. In fact, you can perfectly reconstruct a periodic sound by adding together sine waves of the frequencies and intensities given in such a diagram (you can also do it in a myriad other ways, for instance by adding together a special class of square waves called Walsh functions, but that means you'd have to do a lot of math to convert between the two). 

Now, and this is important: We can shift between these. Every periodic sound can be fully represented by its time-airpressure graph, or by its frequency-intensity graph. We can go from one to another (with some limitations that I can detail later, if you like), and that means that when Nyquist above says that it contains no frequencies above B cps, he's really talking about it in the frequency domain. The actual waveform might look completely chaotic, but if it is a periodic waveform, then it is possible to analyze it in the frequency domain, and if in that frequency analysis there are no components above B cps, then it will be fully represented by giving its ordinates (that is, by sampling it) at a series of points spaced 1/2B seconds apart (that is, at the frequency double-B ). Once again, that means that the equally spaced points go on forever, or at least for as long as the sound goes on.

This is, then, dependent on a few things. The first is that the sound really must contain no frequency components above that limit. That is ascertained by an input filter that removes everything above the limit. It also is dependent on the playback mechanism not trying to play back any frequencies above that limit, either, and that is ascertained by an output filter that removes everything above that limit. That last bit is the magic thing. Intuitively, we think that if we have a perfect top-to-bottom swing between every sample, then our sine-at-the-limit will look like a square wave - Top-bottom-top-bottom with no slopes inbetween. Right. And that is correct, it does look like that, but a square wave is not a sine (well, duh, that is the point) and that means that a square contains other frequency components. A square wave at the frequency B will contain strong components at 2B, 4B, 6B, 8B, and so on to infinity (or at least a long way). That means, for our sampled-sine-that-looks-like-a-square at 20kHz, that it will have components at 40kHz, 80kHz, 120kHz, and so on. But! Our output filter removes all our components above the playback frequency, which means that those 2B, 4B, 6B, 8B components disappear. Which means that the only component of that very square looking wave form that actually gets played back is the B component - Which is just one pure component, and therefore is a sine. 

There are, of course, problems here, namely that if our sampling frequency is exactly double that of our sampled signal, that might mean that we capture not the top and the bottom samples (and thus get the correct intensity), but instead get the positive and negative zero crossing every time, resulting in the illusion that our signal has a zero intensity. Or, really, any other particular phase shift of the signal would get another incorrect intensity. That is a theoretical problem, though. The possibility that a natural sound will have that exact frequency and hold that unwaveringly is slim to say the least. But yes, that means that a signal on the exact half of the sampling frequency will sometimes not be reproduced at the correct intensity (unless I miss something important here - My mind is a bit slow after midnight). 

Does this help? Or did I misunderstand the question?
 
Last edited by a moderator:
Now I found your original post too :D
 

I just checked the Nyquist–Shannon sampling theorem and it says a wave (meeting certain criteria) is only /fully defined/ by more than twice the data points per time than the highest frequency contained in the wave.
I.e., yes mathematically you have the function for the wave and can compute it. So it doesn't make any sense to store more data than this (unless you want to save computing power on getting more dense sample points). But if you just send those data points to a loudspeaker, that's not the mathematically proven highest frequency which makes sense. The loudspeaker doesn't use those points to calculate any function after all, it just "plays" the data points. So it might possibly (I don't know) still be desirable to use a higher data point density for playback.
Yes, if the loudspeaker "played back the points" then that would be correct. However, what the loudspeaker plays is "the points filtered through the output filter" which is a very different thing (as I said above). And that is why the intutively appealing notion that the waveform that looks more right plays more right breaks down when we get close to the sampling frequency.
 

Same for recording, you might want to record at a higher rate and then do some post-processing computations to lower noise and such. That would be possible because you have more data points than you need to calculate the function, so you could use those data points to approximate that function more exactly (in essence averaging the data points) and then generate a purely synthetic new set of sample points (at any frequency you want) which reflect the original wave more closely than what you actually measured.
This is done all the time, though. Not necessarily to recalculate the wave better (although there are techniques similar to that, too - Look up "oversampling"), but digital recording today usually involves a lot of postprocessing in the digital domain - effects, compressors, mixing, tuning - which is a load of maths that will have to be done inexactly (because no matter where you put your limits when it comes to sampling, it still, in the end, is integers and integer intervals), and thus will accumulate rounding errors. If you record the sounds at a much higher resolution than necessary for final mastering, though, then it will mean that a rounding error of a few samples in this or that direction, or a few levels of intensity up or down, quite simply will disappear when the signal is downsampled to 44.1/16 for final mastering.
 
I am not an audio engineer, but to my thinking, there is no way that 44,1khz accurately reproduces high audible (18+ khz frequencies) -There are too few sample points.

In the worst case scenario, you could have a 22.05khz signal that gets sampled exactly at the zero crossings (instead of at peak and trough), yielding a waveform of zero amplitude when played-back.

Even lower frequencies must suffer significant distortion because the sample points will not capture their peak amplitudes reliably. 
 
In the worst case scenario, you could have a 22.05khz signal that gets sampled exactly at the zero crossings (instead of at peak and trough), yielding a waveform of zero amplitude when played-back.


Even lower frequencies must suffer significant distortion because the sample points will not capture their peak amplitudes reliably.
Yes, and no, as I understand it (and the long, long posts above). A 22.05KHz signal (being exactly half the sample frequency) would get samples at some point on the upswing of the wave and some sample 180 degrees later on the downswing - if, like you say they're both at 0 you get a 0 amplitude signal, but even if they're at +0.5 and -0.5 that's indistinguishable from a sine wave of any amplitude between 0.5 and 1, because you don't know where on the duty cycle those samples were taken.

That's why the theory works on samples *up to* half the sample frequency. At exactly half the theory breaks down, which is why the input filter will stop such frequencies getting encoded in the first place.


At lower frequencies, I understand there's not a significant problem. If the signal only persisted for a few cycles, it would be very hard to reconstruct, and indeed the cilia in our ears probably wouldn't detect such a short signal for similar reasons - even at a bassy 50Hz, three cycles is merely 60 milliseconds long. Longer duration notes will get sample points all along their curves so be recorded completely. I suppose higher frequency sampling would enable these short sounds to be recorded, even though we can't hear them.


I find it easier to consider a tuning fork attached somehow to your speakers. It will ring when there is a frequency present that it can sympathetically oscillate with. The maths works a little like that as I understand it, and works out which forks of which note would get excited by the signal at any moment - indeed that's how our ears work as previously mentioned. The maths, your ears, and a tuning fork can all pick out a specific frequency and it's amplitude from anything greater than a sample every half wave.


I suspect that's why some people suggest that recording higher frequencies than we can hear might be dangerous, as they introduce a wobble to the sample points that we don't have an oscillator that can dance to, and it might be enough to upset the oscillators lower down the order, though I don't really understand the maths myself I must admit.
 
I am not an audio engineer, but to my thinking, there is no way that 44,1khz accurately reproduces high audible (18+ khz frequencies) -There are too few sample points.
As previously mentioned, an audio signal (or any other analogue signal with similar characteristics) can be both described in a time domain and frequency domain. While the time domain pretty much represents the signal itself as you know it, the frequency domain describes the frequencies contained within the signal. If you generate a fitting sine curve for every frequency and combine them, you get the original signal within the time domain.
The process of converting between both domains is actually mathematically well defined, you probably already heard about the Fourier transformation. The whole point of Nyquist is: You don't need to have a highly detailed discreet representation of the signal to get a good clone of it, you only need to be able to extract the contained frequencies with the Fourier transformation, and you really only need about twice the sampling frequency to do so. If you know everything about the frequencies, you can basically just generate an identical signal out of sine curves.

Yes, the whole mathematical stuff behind this process is pretty much brainfuck, but it just works™
 
You can theoretically have a very nice 20 Megapixel camera, make a picture in broad daylight, and because of extremely bad luck have all the photons miss the sensors or just disappear in a puff of quantum magic just before they would have hit the camera, resulting in a completely black image. You could theoretically even have a 40 Megapixel camera and still get only a black picture. Or a 80 Megapixel camera. The chance would go down, but it would still be non-zero. Even if all photons could be measured perfectly, there's still a theoretical possibility that none of them actually get reflected by the object you're making a picture of. There's enough empty space between atoms to make anything look transparent with a sufficient amount of bad luck.

But in practice such astronomical bad luck does not occur, so you don't have to worry about it. Like you don't have to worry about suddenly getting teleported to Jupiter because of quantum fluctuations.

It's the same with sound. Yes, theoretically your samples could all be taken at exactly the "wrong" time, but in practice this is impossible enough not to have to care about it.

With images, you have to worry about Moiré patterns, and with sound you have to take the sampling theorem into account and apply a proper anti-aliasing filter (low-pass for audio, optical blur for video). But there's no reason to record and playback UV and infrared light when you're making a video intended for humans to watch, and there's no reason to record and playback ultrasound either. Except if you want to record a dog whistle or something.
 
Like you don't have to worry about suddenly getting teleported to Jupiter because of quantum fluctuations.
Oh. So I guess I can scrap my spacesuit then. :mellow:

I skimmed through these posts and all in all, it seems that 44.1 KHz is enough, considering that your playback device isn't completely dumb and will guess the wave correctly. Right ?
 
If the signal only persisted for a few cycles, it would be very hard to reconstruct, and indeed the cilia in our ears probably wouldn't detect such a short signal for similar reasons - even at a bassy 50Hz, three cycles is merely 60 milliseconds long. Longer duration notes will get sample points all along their curves so be recorded completely. I suppose higher frequency sampling would enable these short sounds to be recorded, even though we can't hear them.


Indeed - There is a whole Heisenberg uncertainty principle analogue thing going on here, in that we are talking about the spectral content (the frequency components) of a signal at a given time, but in order to actually measure that spectal content, we need to do it over a period of time in order to get enough sample points to do the transformation. Very much in the same vein as if you measure the speed of a particle, you can't know its location, and vice versa. There is a whole lot of theory and methods on how to overcome this as well, of course. However, luckily for the match betwen our theory and our perceptions, our ears share this condition too - In order to hear a sound right now, you'll need to hear it for long enough (a bunch of cycles) for it to excite the corresponding cilia.
 
So my question seems to have been about the output filter - that's the part I still don't understand, but now that I know what it's name is I guess I can look it up on Wikipedia.

All the math, and that we don't hear arbitrarily high and deep frequency, I knew before. :)

I guess I should have chosen another example, though, the polynomial was a bad one, admitted, should have taken an actual sum of sine waves and made the sample points equally spaced. That's just harder to do without consulting a calculator, while I could calculate the points of the polynomial easily in my head.

Thanks for the long answers.
 
I have a lot of respect for turtablists and the early tape splicers (Double Dee and Steinski FTW!) but I see software packages that sample as just refinements of the early solid state samplers - sampling's always been a digital skill, so I don't really care what people use these days. I kind of see what you mean regarding equalisers (a bunch of analogue filters and potentiometers beats a FFT and GUI sliders aesthetically any day), though I suspect you mean volume controls rather than amps - I can't even envisage how a software amp would work. And don't get me started on record players.


But once something is in the digital domain it should stay there until it's D2Aed into my ears in the end IMO. That last bit is where I'll spend money hence I'm happy with my purchase of a Pandora
 
Little though experiment:

  • Imagine your are on a swing
  • You push forward with your feet. Let's say you use +1 unit of force for 1 second.
  • You let yourself swing freely forward and then start moving back
  • You then push yourself backwards with -1 unit of force (opposite direction) for 1 second.
  • Swing back and then forwards
  • Repeat from step 2
A discreet application of force with your feet results in a smooth swinging action. The swing operates as a low pass filter of sorts to your force input using your feet.

This "push-pull" type technique can be used to generate a perfectly smooth sine wave from a square wave by varying the "push" and "pull" time periods, pulse width modulation it is called:
pwmCurve.jpg

Again a low pass filter turns the square wave signal into the smooth sine.
 
Last edited by a moderator:
speaking about the 'loadspeaker':

I like the ones the pandora has, but I would appreciate more powerfull speakers.

I noticed that I hardly understand the audio of common youtube videos during cooking my meal. Maybe I should attach my pandora to some active speakers to solve this problem.

:D
 
speaking about the 'loadspeaker':

I like the ones the pandora has, but I would appreciate more powerfull speakers.

I noticed that I hardly understand the audio of common youtube videos during cooking my meal. Maybe I should attach my pandora to some active speakers to solve this problem.

:D
It will have at least a more specialized space in the case, that will probably also make it sound louder.

Btw I have no doubt what so ever in the pyra sound department I think it's one thing ED and co have always cared about.
 
well dont take my point to serious ;)

I just wanted to post a low level comment to this technical debate  :rolleyes:
 
Last edited by a moderator:
Back
Top