{"id":67,"date":"2010-12-05T12:06:53","date_gmt":"2010-12-05T20:06:53","guid":{"rendered":"http:\/\/www.earlevel.com\/main\/?p=67"},"modified":"2016-12-08T17:50:47","modified_gmt":"2016-12-09T01:50:47","slug":"building-a-windowed-sinc-filter","status":"publish","type":"post","link":"https:\/\/www.earlevel.com\/main\/2010\/12\/05\/building-a-windowed-sinc-filter\/","title":{"rendered":"Building a windowed sinc filter"},"content":{"rendered":"<p>As <a href=\"http:\/\/www.earlevel.com\/main\/2010\/11\/23\/towards-a-practical-oversampling-filter\">promised<\/a>, here&#8217;s our windowed sinc calculator for building a 2x oversampling filter:<\/p>\n<div id=\"container1-20101205\" style=\"width:600px; height:200px;\"><\/div>\n<div id=\"container2-20101205\" style=\"width:600px; height:200px;\"><\/div>\n<div id=\"container3-20101205\" style=\"width:600px; height:200px;\"><\/div>\n<div><input id=\"factor\" name=\"factor\" value=\".47\" style=\"text-align:right;width:4em;margin:0 0 6px 0\" type=\"text\" onchange=\"drawIt()\" \/>&nbsp;Factor<\/div>\n<div><input id=\"windowLen\" name=\"windowLen\" value=\"199\" style=\"text-align:right;width:4em;margin:0 0 6px 0\" type=\"text\" onchange=\"drawIt()\" \/>&nbsp;Length<\/div>\n<div><input id=\"rejection\" name=\"rejection\" value=\"90\" style=\"text-align:right;width:4em;margin:0 0 6px 0\" type=\"text\" onchange=\"drawIt()\" \/>&nbsp;Rejection<\/div>\n<p><input name=\"calc\" value=\"Calculate\" onclick=\"drawIt();\" type=\"button\" style=\"width:8em\" \/><\/p>\n<div><textarea id=\"coeffsList\" rows=\"8\" cols=\"100\" readonly=\"readonly\" style=\"font-size:12px;line-height:14px\"><\/textarea><\/div>\n<p><input id=\"gain\" name=\"gain\" value=\"2\" style=\"text-align:right;width:4em;margin:0 0 4px 0\" type=\"text\" onchange=\"drawIt()\" \/>&nbsp;Gain<\/p>\n<h3>Notes:<\/h3>\n<ul>\n<li>Use the Tab or Enter keys to effect changes (most browsers), or press Calculate.<\/li>\n<li>The frequency axis is in multiples of the Nyquist frequency.<\/li>\n<li>This page is designed specifically to generate and view filters for the current sample rate doubling tutorial, hence the view of 0.50 of the original sample rate with folded frequency components and default gain value. However, you can use it to generate an arbitrary windowed-sinc lowpass. (The folded frequency components in the lower view are there to help you keep an eye on the results\u2014they are not alias components at this point.)<\/li>\n<li>For example, a 2x upsampling filter: Set <em>Rejection<\/em> to the stop-band rejection is dB. Set <em>Length<\/em> to the number of taps you want to use (more taps for a steeper filter, but higher processing cost). Set <em>Factor<\/em> to a value less than 0.5, but as close to 0.5 as possible in order to get the maxmimum bandwidth while avoiding foldback (aliasing). Set <em>Gain<\/em> to 2.<\/li>\n<li>Tip: You can copy and paste the coefficients into a text file, and save with an extension of &#8220;.csv&#8221; if you want to read the values into a spreadsheet for further manipulation.<\/li>\n<\/ul>\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\/20101205\/sincCalc2x.js\"><\/script><\/p>\n","protected":false},"excerpt":{"rendered":"<p>As promised, here&#8217;s our windowed sinc calculator for building a 2x oversampling filter: &nbsp;Factor &nbsp;Length &nbsp;Rejection &nbsp;Gain Notes: Use the Tab or Enter keys to effect changes (most browsers), or press Calculate. The frequency axis is in multiples of the &hellip; <a href=\"https:\/\/www.earlevel.com\/main\/2010\/12\/05\/building-a-windowed-sinc-filter\/\">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,8,19,15,6,30],"tags":[],"_links":{"self":[{"href":"https:\/\/www.earlevel.com\/main\/wp-json\/wp\/v2\/posts\/67"}],"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=67"}],"version-history":[{"count":3,"href":"https:\/\/www.earlevel.com\/main\/wp-json\/wp\/v2\/posts\/67\/revisions"}],"predecessor-version":[{"id":568,"href":"https:\/\/www.earlevel.com\/main\/wp-json\/wp\/v2\/posts\/67\/revisions\/568"}],"wp:attachment":[{"href":"https:\/\/www.earlevel.com\/main\/wp-json\/wp\/v2\/media?parent=67"}],"wp:term":[{"taxonomy":"category","embeddable":true,"href":"https:\/\/www.earlevel.com\/main\/wp-json\/wp\/v2\/categories?post=67"},{"taxonomy":"post_tag","embeddable":true,"href":"https:\/\/www.earlevel.com\/main\/wp-json\/wp\/v2\/tags?post=67"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}