{"id":73,"date":"2010-12-11T12:32:49","date_gmt":"2010-12-11T20:32:49","guid":{"rendered":"http:\/\/www.earlevel.com\/main\/?p=73"},"modified":"2016-12-08T17:43:21","modified_gmt":"2016-12-09T01:43:21","slug":"a-closer-look-at-upsampling-filters","status":"publish","type":"post","link":"https:\/\/www.earlevel.com\/main\/2010\/12\/11\/a-closer-look-at-upsampling-filters\/","title":{"rendered":"A closer look at upsampling filters"},"content":{"rendered":"<div id=\"container1-20101211\" style=\"width:600px; height:200px;\"><\/div>\n<div id=\"container2-20101211\" style=\"width:600px; height:200px;\"><\/div>\n<form name=params>\nInterpolation type:<select name=irType onchange=\"doIRTypeSelect()\" onmouseup=\"startSim();\"><option value=\"none\">None<\/option><option value=\"zoh\">Zero-order hold<\/option><option value=\"linear\">Linear<\/option><option value=\"sinc 1\">Sinc 1<\/option><option value=\"sinc 2\" selected>Sinc 2<\/option><option value=\"sinc 3\">Sinc 3<\/option><\/select><br \/>\n<input type=\"checkbox\" checked=\"checked\" name=showIR onchange=\"doShowCheckbox()\">&nbsp;Show impulse response<br \/>\n<\/form>\n<p><button onClick=\"startSim()\">Sweep!<\/button><\/p>\n<p>In this demonstration, we generate a sine wave sweep from low in the audio band to near the Nyquist Frequency, which is half the sample rate. You can view it in the upper chart.<\/p>\n<p>Next, we upsample by a factor of two, by inserting a zero between each sample, and view the frequency response using various forms of interpolation in the lower chart:<\/p>\n<ul>\n<li><strong>None<\/strong> is no interpolation\u2014you can see the sine samples alternating with zero in the upper chart, and a complete lack of stop-band rejection in the frequency response. (Note that inserting zeros lowers the average signal level by half, or 6dB, as you can see in the lower chart.)\n<\/li>\n<li><strong>Zero-order hold<\/strong> repeats the previous sample, in place of the zeros. This is the same as convolving the upsampled signal with filter coefficients  { 1.0, 1.0 }.\n<\/li>\n<li><strong>Linear<\/strong> replaces zero samples with the average of two adjacent original samples. This is the same as convolving the upsampled signal with { 0.5, 1.0, 0.5 }.\n<\/li>\n<li><strong>Sinc 1<\/strong> uses coefficients generated from a Kaiser-windowed sinc set to 0.5, or &#8220;half-band&#8221;. Half-band filters have the characteristic that every other coefficient is zero, making them much more efficient to implement, but at the expensive of poor aliasing characteristics near the Nyquist frequency. They are typically used in cases where subsequent steps, such as in multi-rate conversion, will clean up any response problems. This one uses 31 coefficients, 15 of which are zero and can be eliminated.\n<\/li>\n<li><strong>Sinc 2<\/strong> is a Kaiser-windowed sinc with a lower cutoff setting to minimize aliasing (also 31 coefficients).\n<\/li>\n<li><strong>Sinc 3<\/strong> is similar, but has better filter characteristics, due to using more coefficients (71).\n<\/ul>\n<\/li>\n<p><script type=\"text\/javascript\" src=\"\/scripts\/utils\/flotr2.min.js\"><\/script><script type=\"text\/javascript\" src=\"\/scripts\/utils\/dsputils.js\"><\/script><script type=\"text\/javascript\" src=\"\/scripts\/widgets\/20101211\/sweepSim.js\"><\/script><\/p>\n","protected":false},"excerpt":{"rendered":"<p>Interpolation type:NoneZero-order holdLinearSinc 1Sinc 2Sinc 3 &nbsp;Show impulse response Sweep! In this demonstration, we generate a sine wave sweep from low in the audio band to near the Nyquist Frequency, which is half the sample rate. You can view it &hellip; <a href=\"https:\/\/www.earlevel.com\/main\/2010\/12\/11\/a-closer-look-at-upsampling-filters\/\">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":[11,4,8,19,15,6,30],"tags":[],"_links":{"self":[{"href":"https:\/\/www.earlevel.com\/main\/wp-json\/wp\/v2\/posts\/73"}],"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=73"}],"version-history":[{"count":2,"href":"https:\/\/www.earlevel.com\/main\/wp-json\/wp\/v2\/posts\/73\/revisions"}],"predecessor-version":[{"id":567,"href":"https:\/\/www.earlevel.com\/main\/wp-json\/wp\/v2\/posts\/73\/revisions\/567"}],"wp:attachment":[{"href":"https:\/\/www.earlevel.com\/main\/wp-json\/wp\/v2\/media?parent=73"}],"wp:term":[{"taxonomy":"category","embeddable":true,"href":"https:\/\/www.earlevel.com\/main\/wp-json\/wp\/v2\/categories?post=73"},{"taxonomy":"post_tag","embeddable":true,"href":"https:\/\/www.earlevel.com\/main\/wp-json\/wp\/v2\/tags?post=73"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}