@ -276,10 +276,7 @@
"cell_type": "markdown",
"cell_type": "markdown",
"metadata": {},
"metadata": {},
"source": [
"source": [
"As promised, the rest of the RBJ designs. Note that in this version, for all types other then the shelf filters, the calculation\n",
"As promised, the rest of the RBJ designs."
"of a1, a2, a3 has been reworked a bit to be done directly in terms of sine and cosine of the frequency, rather than tangent in\n",
"Simper's derivation (but should be mathematically equivalent). This version should be slightly faster to compute and also more\n",
"numerically robust."
]
]
},
},
{
{
@ -288,18 +285,10 @@
"input": [
"input": [
"def svf_core(f, res, m, shelfA = 1):\n",
"def svf_core(f, res, m, shelfA = 1):\n",
" k = 2 - 2 * res\n",
" k = 2 - 2 * res\n",
" if shelfA == 1:\n",
" g = tan(pi * f) * shelfA\n",
" s = sin(2 * pi * f)\n",
" a1 = 1/(1 + g * (g + k))\n",
" rs = 1 / (2 + k * s)\n",
" a2 = g * a1\n",
" rc = rs * cos(2 * pi * f)\n",
" a3 = g * a2\n",
" a1 = rs + rc\n",
" a2 = s * rs\n",
" a3 = rs - rc\n",
" else:\n",
" g = tan(pi * f) * shelfA\n",
" a1 = 1/(1 + g * (g + k))\n",
" a2 = g * a1\n",
" a3 = g * a2\n",
" A = array([[2*a1 - 1, -2*a2],\n",
" A = array([[2*a1 - 1, -2*a2],\n",
" [2*a2, 1 - 2*a3]])\n",
" [2*a2, 1 - 2*a3]])\n",
" B = array([2 * a2, 2 * a3])\n",
" B = array([2 * a2, 2 * a3])\n",