{"id":1101,"date":"2021-09-02T00:11:51","date_gmt":"2021-09-02T07:11:51","guid":{"rendered":"https:\/\/www.earlevel.com\/main\/?p=1101"},"modified":"2021-09-04T20:39:55","modified_gmt":"2021-09-05T03:39:55","slug":"biquad-calculator-v3","status":"publish","type":"post","link":"https:\/\/www.earlevel.com\/main\/2021\/09\/02\/biquad-calculator-v3\/","title":{"rendered":"Biquad calculator v3"},"content":{"rendered":"\n<p>The latest version of the biquad calculator. It also takes on the functionality of the <a href=\"\/main\/2016\/12\/08\/filter-frequency-response-grapher\/\">frequency response grapher<\/a>:<\/p>\n\n\n\n<style type=\"text\/css\">\n#content table {\n\tborder: none;\n\tmargin: 0 0 0 0;\n}\n\n#content tr td {\n\tborder: none;\n\tpadding: 4px 4px;\n}\n<\/style>\n\n\n\n<form id=\"biquad_params3\">\n<table>\n<tr>\n<td colspan=\"4\">\n<div id=\"magnitude_20210825\" style=\"width:660px; height:400px;\"\"><\/div>\n<\/td>\n<\/tr>\n<tr>\n<td>\n<label for=\"Type_20210825\">Type:<\/label>\n<select id=\"Type_20210825\" onchange=\"drawIt_biquad3()\" onfocus=\"this.selectedIndex = switchBack_biquad3(this.selectedIndex)\">\n<option value=\"lowpass\">lowpass<\/option>Type\n<option value=\"highpass\">highpass<\/option>\n<option value=\"bandpass\">bandpass<\/option>\n<option value=\"notch\">notch<\/option>\n<option value=\"allpass\">allpass<\/option>\n<option value=\"peak\">peak<\/option>\n<option value=\"lowShelf\">low shelf<\/option>\n<option value=\"highShelf\">high shelf<\/option>\n<option value=\"\" disabled>&#8211; first order &#8211;<\/option>\n<option value=\"lowpass 1p1z\">lowpass<\/option>\n<option value=\"highpass 1p1z\">highpass<\/option>\n<option value=\"allpass 1st\">allpass<\/option>\n<option value=\"lowShelf 1st\">low shelf<\/option>\n<option value=\"highShelf 1st\">high shelf<\/option>\n<option value=\"one-pole lp\">one-pole lp<\/option>\n<option value=\"one-pole hp\">one-pole hp<\/option>\n<\/select>\n<\/td>\n<td>\n<label for=\"plotType_20210825\">Plot:<\/label>\n<select id=\"plotType_20210825\" onchange='updateFreqRes_biquad3();'>\n<option value=\"linear\">linear<\/option>\n<option value=\"log 10\" selected=\"selected\">log 10<\/option>\n<option value=\"log 2\">log 2<\/option>\n<\/select>\n<\/td>\n<td>\n<label for=\"max_20210825\">Max:<\/label>\n<select id=\"max_20210825\" onchange='updateFreqRes_biquad3();'>\n<option value=\"auto\">auto<\/option>\n<option value=\"centered\">centered<\/option>\n<option value=\"40\">40 dB<\/option>\n<option value=\"30\">30 dB<\/option>\n<option value=\"20\">20 dB<\/option>\n<option value=\"10\">10 dB<\/option>\n<option value=\"0\">0 dB<\/option>\n<option value=\"-10\">-10 dB<\/option>\n<option value=\"-20\">-20 dB<\/option>\n<option value=\"-30\">-30 dB<\/option>\n<option value=\"-40\">-40 dB<\/option>\n<\/select>\n<\/td>\n<td>\n<label for=\"range_20210825\">Range:<\/label>\n<select id=\"range_20210825\" onchange='updateFreqRes_biquad3();'>\n<option value=\"20\">20 dB<\/option>\n<option value=\"40\">40 dB<\/option>\n<option value=\"60\">60 dB<\/option>\n<option value=\"80\" selected=\"selected\">80 dB<\/option>\n<option value=\"100\">100 dB<\/option>\n<option value=\"120\">120 dB<\/option>\n<option value=\"140\">140 dB<\/option>\n<option value=\"160\">160 dB<\/option>\n<option value=\"180\">180 dB<\/option>\n<\/select>\n<\/td>\n<\/tr>\n<tr>\n<td colspan=\"2\">\n<input id=\"biquad_Fs\" style=\"text-align: right; width: 4em; margin: 0 6px 6px 0;\" type=\"text\" value=\"44100\" onchange=\"drawIt_biquad3()\"\/>Sample rate (Hz)\n<\/td>\n<td colspan=\"2\" id=\"display_status_20210825\">\n<\/td>\n<\/tr>\n<tr>\n<td colspan=\"2\">\n<input id=\"biquad_Fc\" style=\"text-align: right; width: 4em; margin: 0 6px 6px 0;\" type=\"text\" value=\"100\" onchange=\"drawIt_biquad3()\"\/>Fc (Hz)\n<\/td>\n<td colspan=\"2\">\n<input id=\"sliderFc\" max=\"22049\" min=\"1\" type=\"range\" value=\"100\" oninput='setSlider_biquad3(\"sliderFc\", \"biquad_Fc\")'>\n<\/td>\n<\/tr>\n<tr>\n<td colspan=\"2\">\n<input id=\"biquad_Q\" style=\"text-align: right; width: 4em; margin: 0 6px 6px 0;\" type=\"text\" value=\"0.7071\" onchange=\"drawIt_biquad3()\"\/>Q\n<\/td>\n<td colspan=\"2\">\n<input id=\"sliderQ\" type=\"range\" max=\"20.0\" min=\"0.01\" step= 0.01 value=\"0.707\" oninput='setSlider_biquad3(\"sliderQ\", \"biquad_Q\")'>\n<\/td><\/tr>\n<tr>\n<td colspan=\"2\">\n<input id=\"biquad_Gain\" style=\"text-align: right; width: 4em; margin: 0 6px 6px 0;\" type=\"text\" value=\"6.0\" onchange=\"drawIt_biquad3()\"\/>Gain (dB)\n<\/td>\n<td colspan=\"2\">\n<input id=\"sliderGain\" max=\"30\" min=\"-30\" type=\"range\" value=\"0\" oninput='setSlider_biquad3(\"sliderGain\", \"biquad_Gain\")'>\n<\/td>\n<\/tr>\n<tr>\n<td colspan=\"2\">\n<em>a<\/em> coefficients (zeros)<br>\n<textarea id=\"zeroCoefs_20210825\" rows=\"8\" cols=\"36\" onChange=\"coefsEdited_biquad3()\">\n<\/textarea>\n<\/td>\n<td colspan=\"2\">\n<em>b<\/em> coefficients (poles)<br>\n<textarea id=\"poleCoefs_20210825\" rows=\"8\" cols=\"36\" onChange=\"coefsEdited_biquad3()\">\n<\/textarea>\n<\/td>\n<\/tr>\n<\/table>\n<\/form>\n\n\n\n<script type=\"text\/javascript\" src=\"\/scripts\/utils\/flotr2.min.js\"><\/script>\n<script type=\"text\/javascript\" src=\"\/scripts\/utils\/math.js\"><\/script>\n<script type=\"text\/javascript\" src=\"\/scripts\/widgets\/20210825\/biquads3.js\"><\/script>\n\n\n\n<br>\n\n\n\n<p><strong>bigger:<\/strong> Yes.<\/p>\n\n\n\n<p><strong>more filters:<\/strong> I probably won&#8217;t go deep into allpass filters, but people ask about calculating their coefficients from time to time, so here it is. And added first order filters for comparison.<\/p>\n\n\n\n<p><strong>phase plot:<\/strong> In earlier versions of the calculator, phase wasn&#8217;t important, we&#8217;re interested in an amplitude response and live with the phase response. But in adding the allpass filter type, phase is everything. It&#8217;s also good to know for other filter types, and for plotting arbitrary coefficients.<\/p>\n\n\n\n<p><strong>frequency response grapher:<\/strong> Edit or paste in coefficients and complete the edit with tab or a click outside the editing field to plot it. You can change the plot controls, but if you change a filter control then the calculator will resume as a biquad calculator.<\/p>\n\n\n\n<p>For instance, clear the <em>b<\/em> coefficients, and place this sequence into the a coefficients: 1,0,0,0,0,1. Then click on the graph or anywhere outside the edit field to graph it. That&#8217;s the response of summing a signal with a copy of it delayed by five samples, a simple FIR filter\u2014a comb filter.<\/p>\n\n\n\n<p>Because the calculator can also plot the response of arbitrary coefficients, the biquad calculator now displays the normalized b0 coefficient (1.0)\u2014which you can ignore in a typical biquad implementation.<\/p>\n\n\n\n<p>The coefficients fields accept values separated by almost anything\u2014commas, spaces, new lines, for instance. And they ignore letters and values followed by &#8220;=&#8221;. You can use &#8220;a0 = 0.971, a1 = 0.215&#8230;&#8221;, for instance. Even scientific notation is accepted (&#8220;1.03e4&#8221;,).<\/p>\n","protected":false},"excerpt":{"rendered":"<p>The latest version of the biquad calculator. It also takes on the functionality of the frequency response grapher:<\/p>\n","protected":false},"author":1,"featured_media":0,"comment_status":"open","ping_status":"open","sticky":false,"template":"","format":"standard","meta":{"footnotes":""},"categories":[21,4,8,30],"tags":[40],"_links":{"self":[{"href":"https:\/\/www.earlevel.com\/main\/wp-json\/wp\/v2\/posts\/1101"}],"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=1101"}],"version-history":[{"count":184,"href":"https:\/\/www.earlevel.com\/main\/wp-json\/wp\/v2\/posts\/1101\/revisions"}],"predecessor-version":[{"id":1290,"href":"https:\/\/www.earlevel.com\/main\/wp-json\/wp\/v2\/posts\/1101\/revisions\/1290"}],"wp:attachment":[{"href":"https:\/\/www.earlevel.com\/main\/wp-json\/wp\/v2\/media?parent=1101"}],"wp:term":[{"taxonomy":"category","embeddable":true,"href":"https:\/\/www.earlevel.com\/main\/wp-json\/wp\/v2\/categories?post=1101"},{"taxonomy":"post_tag","embeddable":true,"href":"https:\/\/www.earlevel.com\/main\/wp-json\/wp\/v2\/tags?post=1101"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}