{"id":699,"date":"2017-08-25T17:02:11","date_gmt":"2017-08-26T00:02:11","guid":{"rendered":"http:\/\/www.earlevel.com\/main\/?p=699"},"modified":"2019-02-24T15:14:28","modified_gmt":"2019-02-24T23:14:28","slug":"sampling-theory-the-best-explanation-youve-ever-heard-part-3","status":"publish","type":"post","link":"https:\/\/www.earlevel.com\/main\/2017\/08\/25\/sampling-theory-the-best-explanation-youve-ever-heard-part-3\/","title":{"rendered":"Sampling theory, the best explanation you\u2019ve ever heard\u2014Part 3"},"content":{"rendered":"<p><em>We look at what Pulse Amplitude Modulation added to our analog source audio.<\/em><\/p>\n<h3>What did PAM add?<\/h3>\n<p>Earlier, we noted that the PAM signal represents the the source signal plus some additional high frequency content that we need to remove with a lowpass filter before we listen back.<\/p>\n<p>Again, PAM is amplitude modulation of the source signal with a pulse train. Mathematically, we know precisely what amplitude modulation produces\u2014the sums and differences of every frequency component between the two input signals. That is, if you you multiply a 100 Hz sine wave by a 6 Hz sine wave, the result is the sum of 106 Hz and 94 Hz sine waves. For signals with more frequency components, there are more sums and differences in the result.<\/p>\n<p><a href=\"\/main\/wp-content\/uploads\/2017\/08\/AM.png\"><img loading=\"lazy\" decoding=\"async\" class=\"alignnone size-full wp-image-719\" src=\"\/main\/wp-content\/uploads\/2017\/08\/AM.png\" alt=\"\" width=\"640\" height=\"140\" srcset=\"https:\/\/www.earlevel.com\/main\/wp-content\/uploads\/2017\/08\/AM.png 640w, https:\/\/www.earlevel.com\/main\/wp-content\/uploads\/2017\/08\/AM-300x66.png 300w\" sizes=\"(max-width: 640px) 100vw, 640px\" \/><\/a>To answer our question, \u201cWhat got added?\u201d, we need to understand the frequency content of a pulse train. One way to know that would be to use an Fourier Transform on the pulse train. But I want to use intuitive reasoning to eliminate as much math as possible. Fortunately, I already know what the extra frequency content is\u2014it\u2019s the spectral images in sampled systems, as described in classic DSP textbooks. That coupled with knowledge of amplitude modulation tips me off that we\u2019ll need a frequency component at 0 Hz (DC\u2014we need that to keep our original source band), at the sample rate, and at every integer multiple of the sample rate. Through infinity.<\/p>\n<p>OK, we\u2019ll lighten up on the infinity requirement. We can\u2019t produce a perfect impulse in the analog world anyway. And we don\u2019t need to. However, once in the digital domain, samples represent perfect impulses. While their values may have deviated slightly from a perfect representation of the analog signal, due to sampling time jitter and quantization, any math we do to them is \u201cperfect\u201d (again, subject to quantization and any other approximations). In the digital realm, the images do go to infinity.<\/p>\n<p>Indeed, as you add cosine waves of 0, 1, 2, 3, 4\u2026times the sample rate, the result gets closer and closer to the shape of an impulse. (Cosine instead of sine so that the peaks of the different frequencies line up.)<\/p>\n<p><video controls=\"controls\" width=\"418\" height=\"138\"><source src=\"\/main\/wp-content\/uploads\/2017\/08\/Impulse%20train%20cosine%20animation.mp4\" type=\"video\/mp4\" \/>Your browser does not support the video tag.<\/video><\/p>\n<p>And that means we\u2019ll have a copy of the source signal mirrored around 0 Hz, around the sample rate, twice the sample rate, three times the sample rate\u2026to infinity. (In both directions, but we can ignore negative frequencies\u2014for real signals, the negative spectrum mirrors the positive.)<\/p>\n<p><a href=\"\/main\/wp-content\/uploads\/2017\/08\/aliased freqs.png\"><img loading=\"lazy\" decoding=\"async\" class=\"alignnone size-full wp-image-686\" src=\"\/main\/wp-content\/uploads\/2017\/08\/aliased freqs.png\" alt=\"\" width=\"600\" height=\"90\" \/><\/a><\/p>\n<h3>What we\u2019ve learned<\/h3>\n<p>Revisiting my \u201csecrets\u201d, with added comments:<\/p>\n<p><em>1. Individual digital samples are impulses. Not bandlimited impulses, ideal ones.<\/em><\/p>\n<p>Bothered that ideal impulses are impossible? Only in the physical world. There, we accept limitations. For instance, gather together infinity of something. Anything\u2014I\u2019ll wait. Meanwhile, in the mathematical world, infinity fits easily on this page: \u221e<\/p>\n<p><em>2. We know what lies between samples\u2014virtual zero samples.<\/em><\/p>\n<p>Think there\u2019s really a continuous wave, implied, between samples? If so, you probably think it&#8217;s because samples represent a bandlimited impulse. No\u2014you\u2019re getting confused with what will come out of the DAC\u2019s lowpass filter later, when we play back audio.<\/p>\n<p><em>3. Audio samples don\u2019t represent the source audio. They represent a modulated version of the audio. We modulated the audio to ensure points #1 and #2.<\/em><\/p>\n<p>This is a frequency-domain observation that follows from the first two points, which are time domain. If you understand this point, you\u2019ll never be confused about sample rate conversion.<\/p>\n","protected":false},"excerpt":{"rendered":"<p>We look at what Pulse Amplitude Modulation added to our analog source audio. What did PAM add? Earlier, we noted that the PAM signal represents the the source signal plus some additional high frequency content that we need to remove &hellip; <a href=\"https:\/\/www.earlevel.com\/main\/2017\/08\/25\/sampling-theory-the-best-explanation-youve-ever-heard-part-3\/\">Continue reading <span class=\"meta-nav\">&rarr;<\/span><\/a><\/p>\n","protected":false},"author":1,"featured_media":0,"comment_status":"open","ping_status":"open","sticky":false,"template":"","format":"standard","meta":{"footnotes":""},"categories":[4,7],"tags":[37],"_links":{"self":[{"href":"https:\/\/www.earlevel.com\/main\/wp-json\/wp\/v2\/posts\/699"}],"collection":[{"href":"https:\/\/www.earlevel.com\/main\/wp-json\/wp\/v2\/posts"}],"about":[{"href":"https:\/\/www.earlevel.com\/main\/wp-json\/wp\/v2\/types\/post"}],"author":[{"embeddable":true,"href":"https:\/\/www.earlevel.com\/main\/wp-json\/wp\/v2\/users\/1"}],"replies":[{"embeddable":true,"href":"https:\/\/www.earlevel.com\/main\/wp-json\/wp\/v2\/comments?post=699"}],"version-history":[{"count":19,"href":"https:\/\/www.earlevel.com\/main\/wp-json\/wp\/v2\/posts\/699\/revisions"}],"predecessor-version":[{"id":839,"href":"https:\/\/www.earlevel.com\/main\/wp-json\/wp\/v2\/posts\/699\/revisions\/839"}],"wp:attachment":[{"href":"https:\/\/www.earlevel.com\/main\/wp-json\/wp\/v2\/media?parent=699"}],"wp:term":[{"taxonomy":"category","embeddable":true,"href":"https:\/\/www.earlevel.com\/main\/wp-json\/wp\/v2\/categories?post=699"},{"taxonomy":"post_tag","embeddable":true,"href":"https:\/\/www.earlevel.com\/main\/wp-json\/wp\/v2\/tags?post=699"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}