Hydrogenaudio Forums

Hydrogenaudio Forum => Scientific Discussion => Topic started by: FreaqyFrequency on 04 October, 2011, 04:36:27 PM

Title: Sampling/Time Resolution - In search of sources
Post by: FreaqyFrequency on 04 October, 2011, 04:36:27 PM
Greetings all,

I've been lurking on these forums for about the last year, and I finally signed up today to pick the brains of some of the more knowledgeable individuals here.

On Saturday, I'm giving an 8 minute informative speech on the essential elements of digital audio (PCM to be exact, leaving DSD out given the time limit), why it was a logical progression from analog recording and storage technology, and a brief sketch of lossy/lossless implementations of it.

My primary objective at this point is to get a rock solid source, stating that (and why) any sampling rate is able to capture a given bandlimited source with perfect time resolution (ignoring frequency response and filtering in this case, dealing only with time).  I was encouraged to touch upon this point in particular because of a presentation I found on YouTube a few months back, whose essential message was "Digital is bad because you hear the music as packets rather than as an analog waveform" and was advocating that everyone dispense with their digital media and go get a turntable and vinyls.  My intent is to disprove the "packets" notion, and this source is the closest I have seen to doing that as of now:

http://www.tonmeister.ca/main/textbook/node639.html (http://www.tonmeister.ca/main/textbook/node639.html)

If anyone could supply further documentation (or their own findings/conclusions on the matter), that would be most appreciated.  Thanks! 
Title: Sampling/Time Resolution - In search of sources
Post by: saratoga on 04 October, 2011, 04:40:02 PM
My primary objective at this point is to get a rock solid source, stating that (and why) any sampling rate is able to capture a given bandlimited source with perfect time resolution (ignoring frequency response and filtering in this case, dealing only with time).


Stop by the library, pick up any introductory DSP textbook.
Title: Sampling/Time Resolution - In search of sources
Post by: benski on 04 October, 2011, 04:41:11 PM
http://www.dspguide.com/ch3/3.htm (http://www.dspguide.com/ch3/3.htm)

Another good topic to start looking at is "intersample overs".  Basically, that since digital audio is able to reliably reproduce data points in between samples (up to the bandwidth limit, of course), it is possible to have analog output values over 0dBFS because the inter-sample data is preserved.  This is a product of the anti-aliasing filter (ADC) and the reconstruction filter (DAC).
Title: Sampling/Time Resolution - In search of sources
Post by: FreaqyFrequency on 04 October, 2011, 04:56:44 PM
Wow, you guys are quick on the draw!  Thoroughly appreciate the swift replies, the library is actually less than a 2 mile walk from me and it's gorgeous out today so that's a great idea.

Thanks for the link, benski.  Reading through it presently.
Title: Sampling/Time Resolution - In search of sources
Post by: C.R.Helmrich on 04 October, 2011, 05:19:22 PM
Was about to post the link that benski already posted  That book managed to explain to me how a DFT works.

People saying things like "Digital is bad because you hear the music as packets rather than as an analog waveform" obviously don't have a clue about digital sampling, especially about sinc interpolation. I just stumbled across the following page. Haven't tried it, but maybe it can help you visualize that, when listening to digital audio, we don't listen to packets.

demonstrations.wolfram.com/SincInterpolationForSignalReconstruction/ (http://demonstrations.wolfram.com/SincInterpolationForSignalReconstruction/)

Chris
Title: Sampling/Time Resolution - In search of sources
Post by: xnor on 04 October, 2011, 05:42:05 PM
Some introductory wiki pages:
Sampling (http://en.wikipedia.org/wiki/Sampling_%28signal_processing%29)
Nyquist-Shannon (http://en.wikipedia.org/wiki/Nyquist%E2%80%93Shannon_sampling_theorem)
Pulse-code modulation (http://en.wikipedia.org/wiki/Pulse-code_modulation)
Delta-sigma modulation (http://en.wikipedia.org/wiki/Sigma_delta)
...
Title: Sampling/Time Resolution - In search of sources
Post by: Speedskater on 04 October, 2011, 06:21:07 PM
You might look through member "woodinville"  (aka j.j.) 1100 posts, as he sometimes touches on the subject.

http://www.hydrogenaudio.org/forums/index.php?showuser=18957 (http://www.hydrogenaudio.org/forums/index.php?showuser=18957)

Some of his Power Point presentations.

http://www.aes.org/sections/pnw/ppt.htm (http://www.aes.org/sections/pnw/ppt.htm)
Title: Sampling/Time Resolution - In search of sources
Post by: knutinh on 04 October, 2011, 08:44:48 PM
It is called Shannon-Nyquist sampling theoreme, and says that any analog signal of bandwidth <B can be discretely recorded and recreated using a discrete-time sampler/playback device combined with hypothetically perfect (typically lowpass) filters.

Some transient, and the same transient delayed by 1e-9 seconds clearly can both be "any analog signal of bandwidth <B" if B is chosen large enough.

The sampling theoreme does not cover how to design those filters in practice, nor the effects of finite number of bits. Therefore, real-world ADC and DAC systems are only an approximation to the sampling theoreme, but measurements and listening tests indicate that they can be _really good_ approximations.

Assuming 16 perfect bits and a sin(x)/x filter, there is a finite number of "positions" that a pulse can have in-between t1=0 and t2=1/44100 seconds, but that is a large number that I dont feel like worrying about. (if it was not finite, one could "encode" an infinite amount of information - bits - into the placement of an impulse sampled by only 2 16-bit integers. Clearly that violates a bunch of information-theoretical theoremes). Then again, a sin(x)/x filter sort of assumes an infinite signal in the first place so perhaps I am just talking nonsense.

You should probably ask you audience about the effects of finite particle size in vinyl records, quantum effects in (analog) electronics, and whether they want to go down the slippery slope of "I am going to dizz technology X not based on its practical merits, but on some flawed, silly model that I developed myself because I was too lazy to spend 2 minutes on wikipedia" :-)

-k
Title: Sampling/Time Resolution - In search of sources
Post by: Axon on 04 October, 2011, 09:23:02 PM
All I can suggest is to read this section (https://en.wikipedia.org/wiki/Nyquist_theorem#Mathematical_reasoning_for_the_theorem) from the wikipedia page on the Shannon-Nyquist Theorem, and come back and ask us if you have any questions. I don't think you can make a truly ironclad argument for the theorem without essentially restating that information: understanding the Fourier transform (and convolution) is crucial, and provides a clear roadmap for how to analyze the various nonlinearities of sampling.

Note, I'm not seriously suggesting your audience would have a grasp of convolution -- what I'm saying is that, if you are considering making an ironclad proof here, you might want to consider presenting this by describing the proof by analogy, instead of discussing individual examples. (I'm worried that you'll run into some audiophile who will try to outwit you in a game of "anecdotal claims of sound quality which prove Nyquist was wrong".)
Title: Sampling/Time Resolution - In search of sources
Post by: FreaqyFrequency on 04 October, 2011, 10:14:56 PM
Again, many thanks for all the replies, extremely informative stuff.  The number of hits this has gotten in the time it's been up absolutely makes my jaw drop.  This doesn't happen on any other forum I actively participate in.

In light of the last two replies concerning my audience, it'd probably be prudent to note at this point that this is a basic college Public Speaking course.  My main objective is going to be capturing and holding the audience's attention on my topic; they will not (generally) have a clue about any of the technical details I'm going to be getting into, which is why I'm going for brevity and for concise information that is most effective to my end.  I may have one or two classmates ask me for further information on something (if I get massively lucky), but I highly doubt that any of them will have the expertise (or the desire) to challenge me on anything in particular.  This request for sources on this specific issue is mainly for preparedness, in case someone down the line tries to say "Well, CD isn't good enough because you only get 22.7 µs of resolution per sample; there must be information missing there."  I've seen this stuff on various audiophilia-centered forums, with other arguments coming in such as "Some instruments have rise times as low as 10 µs", yadda yadda...I'm sure you're all quite well aware of the type, so I won't go on.  ;)

All an attempt to arm myself with knowledge, especially when it is so readily available in this age.
Title: Sampling/Time Resolution - In search of sources
Post by: dhromed on 05 October, 2011, 04:25:42 AM
The number of hits this has gotten in the time it's been up absolutely makes my jaw drop.  This doesn't happen on any other forum I actively participate in.


HA is especially invested in providing extra cups to those mules/horses/whathaveyou who have led themselves to water and are obviously willing to drink.
Title: Sampling/Time Resolution - In search of sources
Post by: drewfx on 05 October, 2011, 12:38:53 PM
The critical piece of information to stress to "civilians" (where any mathematical explanation is likely to go either over their head, or in one ear and out the other) is this:

When the digital signal is converted back to a continuous analog wave, the stuff between the samples isn't "lost" or "averaged" or "guestimated"; it's calculated.
Title: Sampling/Time Resolution - In search of sources
Post by: benski on 05 October, 2011, 01:02:55 PM
The critical piece of information to stress to "civilians" (where any mathematical explanation is likely to go either over their head, or in one ear and out the other) is this:

When the digital signal is converted back to a continuous analog wave, the stuff between the samples isn't "lost" or "averaged" or "guestimated"; it's calculated.


One analogy I like to use, although it's not 100% scientifically correct.  Instead of thinking about the digital samples as "speaker position versus time", think of it as a series of pegs on a pegboard through which we will thread an analog "rope" through.  If there are nuances to the analog signal in between sample points, the pegs will be placed in positions that will force the rope to bend in such a way as to recreate that original waveform.
Title: Sampling/Time Resolution - In search of sources
Post by: FreaqyFrequency on 05 October, 2011, 02:02:19 PM
That is a great analogy, and analogies will be a source of reliance for me in this context.  The important thing will be to rid them of any notion that what we hear from a digital source is "pictures" or "frames" of the audio multiple times a second.  I will be stressing the function of the reconstruction filter in the DAC, to be sure.

I'm now confident that I have trustworthy sources to pull from for this issue, so the rest will be a straight shot of explaining the advantages and an abbreviated explanation of implementations of PCM today (taking mp3, AAC, WAV, FLAC and splitting those into Redbook CD, iTunes, YouTube, Spotify, Pandora, etc.), and how the coding mechanisms for the lossy codecs work.  Hopefully I have time to touch briefly on dither and noise shaping as well, as a further argument that the accuracy and precision of PCM greatly exceeds that of any analog storage medium today.

I just realized that I never included this in this thread.  This is the video which inspired me to select this topic for the class.

http://www.youtube.com/watch?v=E-0D8784zGA (http://www.youtube.com/watch?v=E-0D8784zGA)
Title: Sampling/Time Resolution - In search of sources
Post by: db1989 on 05 October, 2011, 02:54:04 PM
I, too, like that analogy—and dhromed’s!

This sounds like an interesting presentation that will clarify the issue and/or dispel myths for the audience, so I’m glad HA has helped you to find good sources, and I hope it goes well for you! recording or it didn’t happen
Title: Sampling/Time Resolution - In search of sources
Post by: DVDdoug on 05 October, 2011, 07:03:55 PM
Quote
When the digital signal is converted back to a continuous analog wave, the stuff between the samples isn't "lost" or "averaged" or "guestimated"; it's calculated.
And because of the required band-limiting before sampling, there isn't much happening between samples.
Title: Sampling/Time Resolution - In search of sources
Post by: krabapple on 05 October, 2011, 08:22:30 PM
If you want to see the sorts of trainwrecks that happen when 'audiophiles' try to wrap their heads around this (and the valiant HA member we know as Axon tries to
educate them), see this:

http://www.stevehoffman.tv/forums/showthread.php?t=85436 (http://www.stevehoffman.tv/forums/showthread.php?t=85436)

and concurrently, an HA thread on the topic, from the same era...with some of the same players (including the guy who thinks he's improved on Shannon/Nyquist)..plus Woodinville:

http://www.hydrogenaudio.org/forums/index....showtopic=49043 (http://www.hydrogenaudio.org/forums/index.php?showtopic=49043)
Title: Sampling/Time Resolution - In search of sources
Post by: dhromed on 06 October, 2011, 05:03:08 AM
When the digital signal is converted back to a continuous analog wave, the stuff between the samples isn't "lost" or "averaged" or "guestimated"; it's calculated.


Averaging and lerping are also calculations, but no sane reconstruction filter uses them.

What must be shown, I think, is that there are advanced mathematics and calculations that can easily obtain results beyond human perception. That it's not as simple as people think, but not as magical or subjective either.

You can attempt to explain complex idea, but as long as the person think it's gibberish rather than a internally consistent but complex thing that the person doesn't yet know about, you're not really educating him. In other words, first you have to make them understand that they don't understand, then make them understand that they could understand given time, and then explain it all.

If someone comes in saying "I know nothing!", that's your cue.
Title: Sampling/Time Resolution - In search of sources
Post by: 2Bdecided on 06 October, 2011, 07:42:41 AM
If you want to see the sorts of trainwrecks that happen when 'audiophiles' try to wrap their heads around this (and the valiant HA member we know as Axon tries to
educate them), see this:

http://www.stevehoffman.tv/forums/showthread.php?t=85436 (http://www.stevehoffman.tv/forums/showthread.php?t=85436)

and concurrently, an HA thread on the topic, from the same era...with some of the same players (including the guy who thinks he's improved on Shannon/Nyquist)..plus Woodinville:

http://www.hydrogenaudio.org/forums/index....showtopic=49043 (http://www.hydrogenaudio.org/forums/index.php?showtopic=49043)
Yeah, thanks for reminding me about that thread!
Title: Sampling/Time Resolution - In search of sources
Post by: Woodinville on 07 October, 2011, 10:12:09 PM
The time resolution of a PROPERLY reconstructed PCM signal (note, if you take away the antiimaging filter the time resolution GETS WORSE!!) is approximately

1/ (2 pi fs nlevels)

for CD that is 1/( 2 pi 44100 65536).

Time reconstruction can not be perfect, because noise from quantization (by the way, also look up dithering, it's the level issue that also gets abused phenominally stupidly) creates a slight phase jitter.

This is, however, very small, i.e. on the order of 6 picoseconds give or take.

You'll also see the idea that "the sound is turned into stairsteps". This mistake comes from the fallacy that one can look at the signal before the antimaging filter and have it make sense.  Somewhere out there I have a set of graphs to reply to that. Now let me see if I can find them.

(https://hydrogenaud.io/imgcache.php?id=b589a839d14f46a3fe43d590cac2f2bc" rel="cached" data-warn="External image, click to view at original size" data-url="http://i238.photobucket.com/albums/ff228/jj_0001/plots/imaging.jpg)

This, of course, takes some explanation. The first (top) is the sine wave that results when you have ONLY the output from the DAC taht is below FS/2.

The next line adds either 2 or 4 images, I forget which (the squiggly line) and adds them to the sine wave, giving the rather odd lookign waveform.
Third line adds more.
The last line adds the first 1000 images. Notice that the result when it is added to the original signal, is the "stairstep" people whine about.

Every bit of that 'stairstep' except the original sine wave, however, results from frequencies above half the sampling rate, showing, once again, that Shannon was right.

You are welcome to grab the plot if you like.
Title: Sampling/Time Resolution - In search of sources
Post by: FreaqyFrequency on 08 October, 2011, 12:33:26 PM
Thank you very much JJ, I've been following your work in particular for some time, between the thread at Skeptic back in 2005 and the Audio Myths Workshop at AES 2009.  Your level of expertise is invaluable, and I thoroughly appreciate your chiming in here.    In fact, I read the link which krabapple posted as I was making final preparations to my Powerpoint yesterday, and considered adding in the "accurate to 346 picoseconds" blurb, but as you're about to see below, it's rather lucky that I didn't attempt to do so.

I gave the speech today, and the result...well, I had to trim the fat significantly and STILL ended up four minutes over the time budget, which means that I only got to mention CD and PCM in passing, while I did still cover the fact that, in CD form, PCM represents frequencies beyond the range of human hearing, and that its dynamic range can be as high as 130 dB (I had to bend this one for the sake of leaving out technicalities; this is of course when dither and noise shaping are used properly, and only in certain bands).  My approach ended up being one focusing on the evolution of this technology (recording, manipulation, storage and playback that is) from the phonograph to PCM today.  My teacher and even a couple classmates commented that they were very impressed by my level of confidence in discussing the material, so that (kinda sorta?) made up for going over time.

No recording, sadly, but I will tell you that a good amount of the speech was based directly on the first 8 minutes or so of this video here.

http://xiph.org/video/vid1.shtml (http://xiph.org/video/vid1.shtml)

Monty is a far more eloquent/prepared speaker than I am, so if you haven't already seen this video, it's definitely worth it.  No new information, only the fact that he summarizes so much, so neatly.

Thank you all again for your participation in this thread, I look forward to my stay here.  I'm prepared to learn a whole lot more, since I know the end of the rabbit hole is a long way down from here. 

*Edit: I had missed the 2pi function in 1/(2pi*quant. levels*fs), so I guess that figure would actually be closer to 55 picoseconds.  Either way, pretty far below the ability of any human being to distinguish a timing difference.
Title: Sampling/Time Resolution - In search of sources
Post by: Woodinville on 08 October, 2011, 07:04:46 PM
The time resolution of a PROPERLY reconstructed PCM signal (note, if you take away the antiimaging filter the time resolution GETS WORSE!!) is approximately

1/ (2 pi fs nlevels)

for CD that is 1/( 2 pi 44100 65536).

Time reconstruction can not be perfect, because noise from quantization (by the way, also look up dithering, it's the level issue that also gets abused phenominally stupidly) creates a slight phase jitter.

This is, however, very small, i.e. on the order of 6 picoseconds give or take.

You'll also see the idea that "the sound is turned into stairsteps". This mistake comes from the fallacy that one can look at the signal before the antimaging filter and have it make sense.  Somewhere out there I have a set of graphs to reply to that. Now let me see if I can find them.

(https://hydrogenaud.io/imgcache.php?id=b589a839d14f46a3fe43d590cac2f2bc" rel="cached" data-warn="External image, click to view at original size" data-url="http://i238.photobucket.com/albums/ff228/jj_0001/plots/imaging.jpg)

This, of course, takes some explanation. The first (top) is the sine wave that results when you have ONLY the output from the DAC taht is below FS/2.

The next line adds either 2 or 4 images, I forget which (the squiggly line) and adds them to the sine wave, giving the rather odd lookign waveform.
Third line adds more.
The last line adds the first 1000 images. Notice that the result when it is added to the original signal, is the "stairstep" people whine about.

Every bit of that 'stairstep' except the original sine wave, however, results from frequencies above half the sampling rate, showing, once again, that Shannon was right.

You are welcome to grab the plot if you like.

Ugh, that's 6x10^-11, not 12 so it's circa 60 picoseconds.  I do math better than arithmetic, apparently.
Title: Sampling/Time Resolution - In search of sources
Post by: Northpack on 09 October, 2011, 06:28:36 AM
The time resolution of a PROPERLY reconstructed PCM signal (note, if you take away the antiimaging filter the time resolution GETS WORSE!!) is approximately

1/ (2 pi fs nlevels)

for CD that is 1/( 2 pi 44100 65536).

Time reconstruction can not be perfect, because noise from quantization (by the way, also look up dithering, it's the level issue that also gets abused phenominally stupidly) creates a slight phase jitter.

That's very interesting. I never realized that it actually can't be infinite as some textbooks say oversimplifying - but of course you would run into the paradox described by knutinh if it were. Another example that everything in nature and thus in our means to represent nature has to be quantized at some level.
Quote
I had missed the 2pi function in 1/(2pi*quant. levels*fs), so I guess that figure would actually be closer to 55 picoseconds. Either way, pretty far below the ability of any human being to distinguish a timing difference.

That's what you think. I bet there are some audiophiles living on a quantum time scale... oh, wait, then they couldn't claim that digital is bad because it's discrete
Title: Sampling/Time Resolution - In search of sources
Post by: Woodinville on 09 October, 2011, 06:45:58 AM
That's very interesting. I never realized that it actually can't be infinite as some textbooks say oversimplifying.


Well, consider, there is always noise, and the signal slope is not infinite, there has to be some error. Not much, maybe, but some.

Having infinite slope means having infinite frequency, and that last quantum that takes up the mass-energy of the entire universe kinda gets to be a problem, and that's still not infinite.

So, in the real world, nothing is perfect, including "nothing".
Title: Sampling/Time Resolution - In search of sources
Post by: FreaqyFrequency on 12 February, 2012, 05:47:57 PM
So I was flipping through some of my documents as I was working on another assignment today, and I realized that I had saved the original outline from this speech.  For anyone who is interested, here it is:

https://docs.google.com/document/d/1QmlxQ-L...jJGk6-ocak/edit (https://docs.google.com/document/d/1QmlxQ-LQC01_1j6z_GJH4Qm9K7FPK8WdijJGk6-ocak/edit)

I didn't get to cover all of the points in it for the aforementioned reason that I was grossly overtime by the time I got to the end, but that was my blueprint for it.
Title: Sampling/Time Resolution - In search of sources
Post by: MichaelW on 12 February, 2012, 07:48:42 PM
As the thread has been resurrected, and as the misconception it addresses is not likely to go away, it occurs to me (alas, mathematically illiterate) that a way to explain the basic point to the mathematically illiterate would be to start with the way that two points define a straight line and its extensions, three points a circle.

That should help to get over the difference between little bursts, as opposed to points defining a signal. You need to explain that first, you have to know the form of the line before you know how many points define it; but luckily, thanks to M. Fourier, we know we can work with sine waves.

Then on to frequency limits and the real stuff.

I hope I have got that right. My point in posting is that most people here know so much (but don't normally teach) that they find it hard to think their way back to just how basic you have to make things for beginners.

HTH
Title: Sampling/Time Resolution - In search of sources
Post by: 2Bdecided on 13 February, 2012, 10:12:36 AM
two points define a straight line
...but an audiophile would prefer to use ten points, and to put them in an oxygen-free listening room, illuminated by the warm glow of valves/tubes - otherwise the straight line might look too "digital"

Sorry, couldn't resist. But you make a good point. Problem is, people who don't "believe" in digital, don't "believe" that the maths behind it is just as correct, and just as applicable to music reproduction, as the maths behind straight lines, circles etc.

Once it gets beyond the point where they understand it, they don't trust it.

Cheers,
David.
Title: Sampling/Time Resolution - In search of sources
Post by: knutinh on 13 February, 2012, 04:21:51 PM
Once it gets beyond the point where they understand it, they don't trust it.

The combination of not understanding/believing in mathematics and not understanding/trusting in blind listening tests is a strong one.

-k
Title: Sampling/Time Resolution - In search of sources
Post by: MichaelW on 13 February, 2012, 05:02:31 PM
Problem is, people who don't "believe" in digital, don't "believe" that the maths behind it is just as correct, and just as applicable to music reproduction, as the maths behind straight lines, circles etc.


Yes indeed, you're not going to persuade the ideologically committed. But there must be a lot of people who could have the basics explained to them. People who would run a mile rather than read the Wikipedia entry on FFT, who think of an analogy with pixelated digital images, and who are swayed by the persona of digitrolls. That persona is worth analysing: they come on, mostly, as real tweed-heads, with a rather old fashioned, mannered, scholarly way of pushing their stuff, and more importantly, using a language that actually makes sense in describing music performance. If someone talks about warmth of tone in a violin performance, I know what it means (compared, say, to the purity of Hilary Hahn or the edgy scrape of some Baroque original instrument players); it's subjective, of course, but that's right, because the whole point is the subjective effect on the listener. Analysis of wave-forms would be less informative to most listeners (though doubtless of real value to luthiers).

If it is worth while to help people save a bunch of money on useless electronics, there needs to be an appropriate rhetoric, that meets the nonsense with a rather tired amusement, rather than outrage, and that explains that music reproduction, actually, is an engineering issue, not an artistic one ("Do you want to leave the interpretation of The Quartet for the End of Time to a bunch of firebottles?"), and that the fundamental principles can be understood well enough to be happily ignored ever after.

Or, alternatively, what do you expect on the Internet?