Files
healing-soundscapes/patchers/Audio Modules/8-chan_EQ.gendsp
2025-12-09 23:06:01 +01:00

4518 lines
261 KiB
Plaintext
Raw Blame History

This file contains ambiguous Unicode characters
This file contains Unicode characters that might be confused with other characters. If you think that this is intentional, you can safely ignore this warning. Use the Escape button to reveal them.
{
"patcher": {
"fileversion": 1,
"appversion": {
"major": 9,
"minor": 1,
"revision": 0,
"architecture": "x64",
"modernui": 1
},
"classnamespace": "dsp.gen",
"rect": [ 486.0, 193.0, 645.0, 868.0 ],
"boxes": [
{
"box": {
"id": "obj-54",
"maxclass": "newobj",
"numinlets": 2,
"numoutlets": 1,
"outlettype": [ "" ],
"patcher": {
"fileversion": 1,
"appversion": {
"major": 9,
"minor": 1,
"revision": 0,
"architecture": "x64",
"modernui": 1
},
"classnamespace": "dsp.gen",
"rect": [ 59.0, 125.0, 356.0, 453.0 ],
"boxes": [
{
"box": {
"id": "obj-4",
"maxclass": "newobj",
"numinlets": 0,
"numoutlets": 1,
"outlettype": [ "" ],
"patching_rect": [ 186.5, 223.0, 69.0, 22.0 ],
"text": "param q2 1"
}
},
{
"box": {
"id": "obj-1",
"maxclass": "newobj",
"numinlets": 0,
"numoutlets": 1,
"outlettype": [ "" ],
"patching_rect": [ 77.5, 223.0, 79.0, 22.0 ],
"text": "param f2 200"
}
},
{
"box": {
"id": "obj-36",
"maxclass": "newobj",
"numinlets": 1,
"numoutlets": 1,
"outlettype": [ "" ],
"patcher": {
"fileversion": 1,
"appversion": {
"major": 9,
"minor": 1,
"revision": 0,
"architecture": "x64",
"modernui": 1
},
"classnamespace": "dsp.gen",
"rect": [ 0.0, 0.0, 1000.0, 780.0 ],
"boxes": [
{
"box": {
"code": "// gen~ codebox version\nParam time(10); // ramp time in ms\nHistory state(0);\n\n// compute smoothing coefficient\n// gen~ uses samples, so we convert ms to coeff\ncoeff = exp(-1 / (time * samplerate * 0.001));\n\n// smooth toward input\nout = mix(in1, state, coeff);\nstate = out;",
"fontface": 0,
"fontname": "Menlo Regular",
"fontsize": 12.0,
"id": "obj-242",
"maxclass": "codebox",
"numinlets": 1,
"numoutlets": 1,
"outlettype": [ "" ],
"patching_rect": [ 50.0, 100.0, 441.0, 207.0 ]
}
},
{
"box": {
"id": "obj-34",
"maxclass": "newobj",
"numinlets": 0,
"numoutlets": 1,
"outlettype": [ "" ],
"patching_rect": [ 50.0, 40.0, 28.0, 22.0 ],
"text": "in 1"
}
},
{
"box": {
"id": "obj-35",
"maxclass": "newobj",
"numinlets": 1,
"numoutlets": 0,
"patching_rect": [ 50.0, 367.0, 35.0, 22.0 ],
"text": "out 1"
}
}
],
"lines": [
{
"patchline": {
"destination": [ "obj-35", 0 ],
"source": [ "obj-242", 0 ]
}
},
{
"patchline": {
"destination": [ "obj-242", 0 ],
"source": [ "obj-34", 0 ]
}
}
]
},
"patching_rect": [ 132.0, 175.0, 89.0, 22.0 ],
"text": "gen @title fade"
}
},
{
"box": {
"id": "obj-25",
"maxclass": "newobj",
"numinlets": 1,
"numoutlets": 1,
"outlettype": [ "" ],
"patching_rect": [ 132.0, 100.0, 151.0, 22.0 ],
"text": "scale -100. 100. -18. 18. 1."
}
},
{
"box": {
"id": "obj-31",
"maxclass": "newobj",
"numinlets": 1,
"numoutlets": 1,
"outlettype": [ "" ],
"patching_rect": [ 132.0, 139.0, 39.0, 22.0 ],
"text": "dbtoa"
}
},
{
"box": {
"id": "obj-29",
"maxclass": "newobj",
"numinlets": 3,
"numoutlets": 5,
"outlettype": [ "", "", "", "", "" ],
"patcher": {
"fileversion": 1,
"appversion": {
"major": 9,
"minor": 1,
"revision": 0,
"architecture": "x64",
"modernui": 1
},
"classnamespace": "dsp.gen",
"rect": [ 134.0, 157.0, 1078.0, 978.0 ],
"boxes": [
{
"box": {
"code": "// -----------------------------------------------------\n// Peak/Notch (Peaking EQ) biquad coefficient generator\n//\n// Inlets:\n// in1 = frequency (Hz)\n// in2 = gain (dB, boost/cut)\n// in3 = Q\n//\n// Outlets:\n// out1 = b0\n// out2 = b1\n// out3 = b2\n// out4 = a1\n// out5 = a2\n// -----------------------------------------------------\n\nfreq = max(1, in1);\n//gainDB = in2;\ngain = in2;\r\nQ = max(0.0001, in3);\n\n// Convert gain from dB → amplitude ratio\n//A = pow(10, gainDB / 40);\nA = sqrt(gain);\r\n\n// Angular frequency\nw0 = twopi * freq / samplerate;\ncosw = cos(w0);\nsinw = sin(w0);\n\n// alpha controls the bandwidth\nalpha = sinw / (2 * Q);\n\n// -----------------------------------------------------\n// RBJ Peaking EQ formulas\n//\n// b0 = 1 + alpha*A\n// b1 = -2*cos(w0)\n// b2 = 1 - alpha*A\n//\n// a0 = 1 + alpha/A\n// a1 = -2*cos(w0)\n// a2 = 1 - alpha/A\n// -----------------------------------------------------\n\nb0 = 1 + alpha * A;\nb1 = -2 * cosw;\nb2 = 1 - alpha * A;\n\na0 = 1 + alpha / A;\na1 = -2 * cosw;\na2 = 1 - alpha / A;\n\n// Normalize by a0\nb0 /= a0;\nb1 /= a0;\nb2 /= a0;\na1 /= a0;\na2 /= a0;\n\n// Outputs\nout1 = b0;\nout2 = b1;\nout3 = b2;\nout4 = a1;\nout5 = a2;\n",
"fontface": 0,
"fontname": "Menlo Regular",
"fontsize": 12.0,
"id": "obj-17",
"maxclass": "codebox",
"numinlets": 3,
"numoutlets": 5,
"outlettype": [ "", "", "", "", "" ],
"patching_rect": [ 50.0, 118.0, 356.0, 794.0 ]
}
},
{
"box": {
"id": "obj-21",
"maxclass": "newobj",
"numinlets": 0,
"numoutlets": 1,
"outlettype": [ "" ],
"patching_rect": [ 50.0, 13.0, 269.0, 22.0 ],
"text": "in 1 @comment frequency @default 100 @min 0"
}
},
{
"box": {
"id": "obj-22",
"maxclass": "newobj",
"numinlets": 0,
"numoutlets": 1,
"outlettype": [ "" ],
"patching_rect": [ 218.5, 47.0, 225.0, 22.0 ],
"text": "in 2 @comment gain @default 1 @min 0"
}
},
{
"box": {
"id": "obj-23",
"maxclass": "newobj",
"numinlets": 0,
"numoutlets": 1,
"outlettype": [ "" ],
"patching_rect": [ 387.0, 76.0, 178.0, 22.0 ],
"text": "in 3 @default 1 @min 0.000001"
}
},
{
"box": {
"id": "obj-24",
"maxclass": "newobj",
"numinlets": 1,
"numoutlets": 0,
"patching_rect": [ 50.0, 947.0, 35.0, 22.0 ],
"text": "out 1"
}
},
{
"box": {
"id": "obj-25",
"maxclass": "newobj",
"numinlets": 1,
"numoutlets": 0,
"patching_rect": [ 303.0, 947.0, 35.0, 22.0 ],
"text": "out 4"
}
},
{
"box": {
"id": "obj-26",
"maxclass": "newobj",
"numinlets": 1,
"numoutlets": 0,
"patching_rect": [ 387.0, 947.0, 35.0, 22.0 ],
"text": "out 5"
}
},
{
"box": {
"id": "obj-27",
"maxclass": "newobj",
"numinlets": 1,
"numoutlets": 0,
"patching_rect": [ 134.0, 947.0, 35.0, 22.0 ],
"text": "out 2"
}
},
{
"box": {
"id": "obj-28",
"maxclass": "newobj",
"numinlets": 1,
"numoutlets": 0,
"patching_rect": [ 218.0, 947.0, 35.0, 22.0 ],
"text": "out 3"
}
}
],
"lines": [
{
"patchline": {
"destination": [ "obj-24", 0 ],
"source": [ "obj-17", 0 ]
}
},
{
"patchline": {
"destination": [ "obj-25", 0 ],
"source": [ "obj-17", 3 ]
}
},
{
"patchline": {
"destination": [ "obj-26", 0 ],
"source": [ "obj-17", 4 ]
}
},
{
"patchline": {
"destination": [ "obj-27", 0 ],
"source": [ "obj-17", 1 ]
}
},
{
"patchline": {
"destination": [ "obj-28", 0 ],
"source": [ "obj-17", 2 ]
}
},
{
"patchline": {
"destination": [ "obj-17", 0 ],
"source": [ "obj-21", 0 ]
}
},
{
"patchline": {
"destination": [ "obj-17", 1 ],
"source": [ "obj-22", 0 ]
}
},
{
"patchline": {
"destination": [ "obj-17", 2 ],
"source": [ "obj-23", 0 ]
}
}
]
},
"patching_rect": [ 77.0, 261.0, 128.60000000000002, 22.0 ],
"text": "gen @title filtercoeff"
}
},
{
"box": {
"id": "obj-16",
"maxclass": "newobj",
"numinlets": 6,
"numoutlets": 1,
"outlettype": [ "" ],
"patcher": {
"fileversion": 1,
"appversion": {
"major": 9,
"minor": 1,
"revision": 0,
"architecture": "x64",
"modernui": 1
},
"classnamespace": "dsp.gen",
"rect": [ 59.0, 125.0, 1000.0, 780.0 ],
"boxes": [
{
"box": {
"code": "// ----- state (delay memory) -----\nHistory x1(0); // x[n-1]\nHistory x2(0); // x[n-2]\nHistory y1(0); // y[n-1]\nHistory y2(0); // y[n-2]\n\n// ----- per-sample processing -----\ninSig = in1;\n\n// coefficients from inlets\nb0 = in2;\nb1 = in3;\nb2 = in4;\na1 = in5;\na2 = in6;\n\n// difference equation:\n// y[n] = b0*x[n] + b1*x[n-1] + b2*x[n-2] - a1*y[n-1] - a2*y[n-2]\ny = b0 * inSig\n + b1 * x1\n + b2 * x2\n - a1 * y1\n - a2 * y2;\n\n// update state for next sample\nx2 = x1;\nx1 = inSig;\ny2 = y1;\ny1 = y;\n\n// output\nout1 = y;\n",
"fontface": 0,
"fontname": "Menlo Regular",
"fontsize": 12.0,
"id": "obj-3",
"maxclass": "codebox",
"numinlets": 6,
"numoutlets": 1,
"outlettype": [ "" ],
"patching_rect": [ 50.0, 100.0, 444.0, 391.0 ]
}
},
{
"box": {
"id": "obj-9",
"maxclass": "newobj",
"numinlets": 0,
"numoutlets": 1,
"outlettype": [ "" ],
"patching_rect": [ 50.0, 40.0, 28.0, 22.0 ],
"text": "in 1"
}
},
{
"box": {
"id": "obj-10",
"maxclass": "newobj",
"numinlets": 0,
"numoutlets": 1,
"outlettype": [ "" ],
"patching_rect": [ 135.0, 40.0, 28.0, 22.0 ],
"text": "in 2"
}
},
{
"box": {
"id": "obj-11",
"maxclass": "newobj",
"numinlets": 0,
"numoutlets": 1,
"outlettype": [ "" ],
"patching_rect": [ 220.0, 40.0, 28.0, 22.0 ],
"text": "in 3"
}
},
{
"box": {
"id": "obj-12",
"maxclass": "newobj",
"numinlets": 0,
"numoutlets": 1,
"outlettype": [ "" ],
"patching_rect": [ 305.0, 40.0, 28.0, 22.0 ],
"text": "in 4"
}
},
{
"box": {
"id": "obj-13",
"maxclass": "newobj",
"numinlets": 0,
"numoutlets": 1,
"outlettype": [ "" ],
"patching_rect": [ 390.0, 40.0, 28.0, 22.0 ],
"text": "in 5"
}
},
{
"box": {
"id": "obj-14",
"maxclass": "newobj",
"numinlets": 0,
"numoutlets": 1,
"outlettype": [ "" ],
"patching_rect": [ 475.0, 40.0, 28.0, 22.0 ],
"text": "in 6"
}
},
{
"box": {
"id": "obj-15",
"maxclass": "newobj",
"numinlets": 1,
"numoutlets": 0,
"patching_rect": [ 50.0, 551.0, 35.0, 22.0 ],
"text": "out 1"
}
}
],
"lines": [
{
"patchline": {
"destination": [ "obj-3", 1 ],
"source": [ "obj-10", 0 ]
}
},
{
"patchline": {
"destination": [ "obj-3", 2 ],
"source": [ "obj-11", 0 ]
}
},
{
"patchline": {
"destination": [ "obj-3", 3 ],
"source": [ "obj-12", 0 ]
}
},
{
"patchline": {
"destination": [ "obj-3", 4 ],
"source": [ "obj-13", 0 ]
}
},
{
"patchline": {
"destination": [ "obj-3", 5 ],
"source": [ "obj-14", 0 ]
}
},
{
"patchline": {
"destination": [ "obj-15", 0 ],
"source": [ "obj-3", 0 ]
}
},
{
"patchline": {
"destination": [ "obj-3", 0 ],
"source": [ "obj-9", 0 ]
}
}
]
},
"patching_rect": [ 50.0, 305.0, 155.0, 22.0 ],
"text": "gen @title biquad"
}
},
{
"box": {
"id": "obj-37",
"maxclass": "newobj",
"numinlets": 0,
"numoutlets": 1,
"outlettype": [ "" ],
"patching_rect": [ 50.0, 40.0, 28.0, 22.0 ],
"text": "in 1"
}
},
{
"box": {
"id": "obj-38",
"maxclass": "newobj",
"numinlets": 0,
"numoutlets": 1,
"outlettype": [ "" ],
"patching_rect": [ 132.0, 40.0, 28.0, 22.0 ],
"text": "in 2"
}
},
{
"box": {
"id": "obj-39",
"maxclass": "newobj",
"numinlets": 1,
"numoutlets": 0,
"patching_rect": [ 50.0, 346.0, 35.0, 22.0 ],
"text": "out 1"
}
}
],
"lines": [
{
"patchline": {
"destination": [ "obj-29", 0 ],
"source": [ "obj-1", 0 ]
}
},
{
"patchline": {
"destination": [ "obj-39", 0 ],
"source": [ "obj-16", 0 ]
}
},
{
"patchline": {
"destination": [ "obj-31", 0 ],
"source": [ "obj-25", 0 ]
}
},
{
"patchline": {
"destination": [ "obj-16", 5 ],
"source": [ "obj-29", 4 ]
}
},
{
"patchline": {
"destination": [ "obj-16", 4 ],
"source": [ "obj-29", 3 ]
}
},
{
"patchline": {
"destination": [ "obj-16", 3 ],
"source": [ "obj-29", 2 ]
}
},
{
"patchline": {
"destination": [ "obj-16", 2 ],
"source": [ "obj-29", 1 ]
}
},
{
"patchline": {
"destination": [ "obj-16", 1 ],
"source": [ "obj-29", 0 ]
}
},
{
"patchline": {
"destination": [ "obj-36", 0 ],
"source": [ "obj-31", 0 ]
}
},
{
"patchline": {
"destination": [ "obj-29", 1 ],
"source": [ "obj-36", 0 ]
}
},
{
"patchline": {
"destination": [ "obj-16", 0 ],
"source": [ "obj-37", 0 ]
}
},
{
"patchline": {
"destination": [ "obj-25", 0 ],
"source": [ "obj-38", 0 ]
}
},
{
"patchline": {
"destination": [ "obj-29", 2 ],
"source": [ "obj-4", 0 ]
}
}
]
},
"patching_rect": [ 53.0, 192.0, 233.0, 22.0 ],
"text": "gen @title 200Hz~"
}
},
{
"box": {
"id": "obj-53",
"maxclass": "newobj",
"numinlets": 2,
"numoutlets": 1,
"outlettype": [ "" ],
"patcher": {
"fileversion": 1,
"appversion": {
"major": 9,
"minor": 1,
"revision": 0,
"architecture": "x64",
"modernui": 1
},
"classnamespace": "dsp.gen",
"rect": [ 424.0, 478.0, 397.0, 415.0 ],
"boxes": [
{
"box": {
"id": "obj-10",
"maxclass": "newobj",
"numinlets": 1,
"numoutlets": 1,
"outlettype": [ "" ],
"patching_rect": [ 115.0, 100.0, 151.0, 22.0 ],
"text": "scale -100. 100. -18. 18. 1."
}
},
{
"box": {
"id": "obj-3",
"maxclass": "newobj",
"numinlets": 1,
"numoutlets": 1,
"outlettype": [ "" ],
"patching_rect": [ 115.0, 136.0, 39.0, 22.0 ],
"text": "dbtoa"
}
},
{
"box": {
"id": "obj-33",
"maxclass": "newobj",
"numinlets": 1,
"numoutlets": 1,
"outlettype": [ "" ],
"patcher": {
"fileversion": 1,
"appversion": {
"major": 9,
"minor": 1,
"revision": 0,
"architecture": "x64",
"modernui": 1
},
"classnamespace": "dsp.gen",
"rect": [ 0.0, 0.0, 1000.0, 780.0 ],
"boxes": [
{
"box": {
"code": "// gen~ codebox version\nParam time(10); // ramp time in ms\nHistory state(0);\n\n// compute smoothing coefficient\n// gen~ uses samples, so we convert ms to coeff\ncoeff = exp(-1 / (time * samplerate * 0.001));\n\n// smooth toward input\nout = mix(in1, state, coeff);\nstate = out;",
"fontface": 0,
"fontname": "Menlo Regular",
"fontsize": 12.0,
"id": "obj-242",
"maxclass": "codebox",
"numinlets": 1,
"numoutlets": 1,
"outlettype": [ "" ],
"patching_rect": [ 50.0, 100.0, 441.0, 207.0 ]
}
},
{
"box": {
"id": "obj-34",
"maxclass": "newobj",
"numinlets": 0,
"numoutlets": 1,
"outlettype": [ "" ],
"patching_rect": [ 50.0, 40.0, 28.0, 22.0 ],
"text": "in 1"
}
},
{
"box": {
"id": "obj-35",
"maxclass": "newobj",
"numinlets": 1,
"numoutlets": 0,
"patching_rect": [ 50.0, 367.0, 35.0, 22.0 ],
"text": "out 1"
}
}
],
"lines": [
{
"patchline": {
"destination": [ "obj-35", 0 ],
"source": [ "obj-242", 0 ]
}
},
{
"patchline": {
"destination": [ "obj-242", 0 ],
"source": [ "obj-34", 0 ]
}
}
]
},
"patching_rect": [ 115.0, 178.0, 89.0, 22.0 ],
"text": "gen @title fade"
}
},
{
"box": {
"id": "obj-49",
"maxclass": "newobj",
"numinlets": 2,
"numoutlets": 1,
"outlettype": [ "" ],
"patching_rect": [ 50.0, 228.0, 29.5, 22.0 ],
"text": "*"
}
},
{
"box": {
"id": "obj-50",
"maxclass": "newobj",
"numinlets": 0,
"numoutlets": 1,
"outlettype": [ "" ],
"patching_rect": [ 50.0, 40.0, 28.0, 22.0 ],
"text": "in 1"
}
},
{
"box": {
"id": "obj-51",
"maxclass": "newobj",
"numinlets": 0,
"numoutlets": 1,
"outlettype": [ "" ],
"patching_rect": [ 115.0, 40.0, 28.0, 22.0 ],
"text": "in 2"
}
},
{
"box": {
"id": "obj-52",
"maxclass": "newobj",
"numinlets": 1,
"numoutlets": 0,
"patching_rect": [ 50.0, 291.284302, 35.0, 22.0 ],
"text": "out 1"
}
}
],
"lines": [
{
"patchline": {
"destination": [ "obj-3", 0 ],
"source": [ "obj-10", 0 ]
}
},
{
"patchline": {
"destination": [ "obj-33", 0 ],
"source": [ "obj-3", 0 ]
}
},
{
"patchline": {
"destination": [ "obj-49", 1 ],
"source": [ "obj-33", 0 ]
}
},
{
"patchline": {
"destination": [ "obj-52", 0 ],
"source": [ "obj-49", 0 ]
}
},
{
"patchline": {
"destination": [ "obj-49", 0 ],
"source": [ "obj-50", 0 ]
}
},
{
"patchline": {
"destination": [ "obj-10", 0 ],
"source": [ "obj-51", 0 ]
}
}
]
},
"patching_rect": [ 53.0, 782.0, 233.0, 22.0 ],
"text": "gen @title Level~"
}
},
{
"box": {
"id": "obj-47",
"maxclass": "newobj",
"numinlets": 2,
"numoutlets": 1,
"outlettype": [ "" ],
"patcher": {
"fileversion": 1,
"appversion": {
"major": 9,
"minor": 1,
"revision": 0,
"architecture": "x64",
"modernui": 1
},
"classnamespace": "dsp.gen",
"rect": [ 459.0, 291.0, 400.0, 471.0 ],
"boxes": [
{
"box": {
"id": "obj-4",
"maxclass": "newobj",
"numinlets": 0,
"numoutlets": 1,
"outlettype": [ "" ],
"patching_rect": [ 186.5, 223.0, 69.0, 22.0 ],
"text": "param q7 1"
}
},
{
"box": {
"id": "obj-1",
"maxclass": "newobj",
"numinlets": 0,
"numoutlets": 1,
"outlettype": [ "" ],
"patching_rect": [ 77.5, 223.0, 86.0, 22.0 ],
"text": "param f7 6400"
}
},
{
"box": {
"id": "obj-36",
"maxclass": "newobj",
"numinlets": 1,
"numoutlets": 1,
"outlettype": [ "" ],
"patcher": {
"fileversion": 1,
"appversion": {
"major": 9,
"minor": 1,
"revision": 0,
"architecture": "x64",
"modernui": 1
},
"classnamespace": "dsp.gen",
"rect": [ 0.0, 0.0, 1000.0, 780.0 ],
"boxes": [
{
"box": {
"code": "// gen~ codebox version\nParam time(10); // ramp time in ms\nHistory state(0);\n\n// compute smoothing coefficient\n// gen~ uses samples, so we convert ms to coeff\ncoeff = exp(-1 / (time * samplerate * 0.001));\n\n// smooth toward input\nout = mix(in1, state, coeff);\nstate = out;",
"fontface": 0,
"fontname": "Menlo Regular",
"fontsize": 12.0,
"id": "obj-242",
"maxclass": "codebox",
"numinlets": 1,
"numoutlets": 1,
"outlettype": [ "" ],
"patching_rect": [ 50.0, 100.0, 441.0, 207.0 ]
}
},
{
"box": {
"id": "obj-34",
"maxclass": "newobj",
"numinlets": 0,
"numoutlets": 1,
"outlettype": [ "" ],
"patching_rect": [ 50.0, 40.0, 28.0, 22.0 ],
"text": "in 1"
}
},
{
"box": {
"id": "obj-35",
"maxclass": "newobj",
"numinlets": 1,
"numoutlets": 0,
"patching_rect": [ 50.0, 367.0, 35.0, 22.0 ],
"text": "out 1"
}
}
],
"lines": [
{
"patchline": {
"destination": [ "obj-35", 0 ],
"source": [ "obj-242", 0 ]
}
},
{
"patchline": {
"destination": [ "obj-242", 0 ],
"source": [ "obj-34", 0 ]
}
}
]
},
"patching_rect": [ 132.0, 175.0, 89.0, 22.0 ],
"text": "gen @title fade"
}
},
{
"box": {
"id": "obj-25",
"maxclass": "newobj",
"numinlets": 1,
"numoutlets": 1,
"outlettype": [ "" ],
"patching_rect": [ 132.0, 100.0, 151.0, 22.0 ],
"text": "scale -100. 100. -18. 18. 1."
}
},
{
"box": {
"id": "obj-31",
"maxclass": "newobj",
"numinlets": 1,
"numoutlets": 1,
"outlettype": [ "" ],
"patching_rect": [ 132.0, 139.0, 39.0, 22.0 ],
"text": "dbtoa"
}
},
{
"box": {
"id": "obj-29",
"maxclass": "newobj",
"numinlets": 3,
"numoutlets": 5,
"outlettype": [ "", "", "", "", "" ],
"patcher": {
"fileversion": 1,
"appversion": {
"major": 9,
"minor": 1,
"revision": 0,
"architecture": "x64",
"modernui": 1
},
"classnamespace": "dsp.gen",
"rect": [ 134.0, 157.0, 1078.0, 978.0 ],
"boxes": [
{
"box": {
"code": "// -----------------------------------------------------\n// High-Shelf biquad coefficient generator (RBJ Cookbook)\n//\n// Inlets:\n// in1 = frequency (Hz)\n// in2 = gain (dB)\n// in3 = Q (slope)\n//\n// Outputs:\n// out1 = b0\n// out2 = b1\n// out3 = b2\n// out4 = a1\n// out5 = a2\n// -----------------------------------------------------\n\nfreq = max(1, in1); // avoid 0 Hz\n//gainDB = in2;\ngain = in2;\nQ = max(0.0001, in3); // avoid divide by zero\n\n// Convert gain from dB → amplitude ratio\n//A = pow(10, gainDB / 40);\r\nA = sqrt(gain);\n\n// Angular frequency\nw0 = twopi * freq / samplerate;\ncosw = cos(w0);\nsinw = sin(w0);\n\n// RBJ alpha definition for shelving EQs\nalpha = sinw / (2 * Q) * sqrt( (A + 1/A) );\n\n// Helper\ntwosqrtAalpha = 2 * sqrt(A) * alpha;\n\nAplus = A + 1;\nAminus = A - 1;\n\n// -----------------------------------------------------\n// High-Shelf formulas\n//\n// b0 = A[(A+1) + (A1)cos(w0) + twosqrtAalpha]\n// b1 = -2A[(A1) + (A+1)cos(w0)]\n// b2 = A[(A+1) + (A1)cos(w0) - twosqrtAalpha]\n//\n// a0 = (A+1) - (A1)cos(w0) + twosqrtAalpha\n// a1 = 2[(A1) - (A+1)cos(w0)]\n// a2 = (A+1) - (A1)cos(w0) - twosqrtAalpha\n// -----------------------------------------------------\n\nb0 = A * ( Aplus + Aminus * cosw + twosqrtAalpha );\nb1 = -2 * A * ( Aminus + Aplus * cosw );\nb2 = A * ( Aplus + Aminus * cosw - twosqrtAalpha );\n\na0 = ( Aplus - Aminus * cosw + twosqrtAalpha );\na1 = 2 * ( Aminus - Aplus * cosw );\na2 = ( Aplus - Aminus * cosw - twosqrtAalpha );\n\n// Normalize by a0\nb0 /= a0;\nb1 /= a0;\nb2 /= a0;\na1 /= a0;\na2 /= a0;\n\n// Outputs\nout1 = b0;\nout2 = b1;\nout3 = b2;\nout4 = a1;\nout5 = a2;\n",
"fontface": 0,
"fontname": "Menlo Regular",
"fontsize": 12.0,
"id": "obj-17",
"maxclass": "codebox",
"numinlets": 3,
"numoutlets": 5,
"outlettype": [ "", "", "", "", "" ],
"patching_rect": [ 50.0, 118.0, 713.0, 783.0 ]
}
},
{
"box": {
"id": "obj-21",
"maxclass": "newobj",
"numinlets": 0,
"numoutlets": 1,
"outlettype": [ "" ],
"patching_rect": [ 50.0, 13.0, 269.0, 22.0 ],
"text": "in 1 @comment frequency @default 100 @min 0"
}
},
{
"box": {
"id": "obj-22",
"maxclass": "newobj",
"numinlets": 0,
"numoutlets": 1,
"outlettype": [ "" ],
"patching_rect": [ 218.5, 47.0, 225.0, 22.0 ],
"text": "in 2 @comment gain @default 1 @min 0"
}
},
{
"box": {
"id": "obj-23",
"maxclass": "newobj",
"numinlets": 0,
"numoutlets": 1,
"outlettype": [ "" ],
"patching_rect": [ 387.0, 76.0, 178.0, 22.0 ],
"text": "in 3 @default 1 @min 0.000001"
}
},
{
"box": {
"id": "obj-24",
"maxclass": "newobj",
"numinlets": 1,
"numoutlets": 0,
"patching_rect": [ 50.0, 947.0, 35.0, 22.0 ],
"text": "out 1"
}
},
{
"box": {
"id": "obj-25",
"maxclass": "newobj",
"numinlets": 1,
"numoutlets": 0,
"patching_rect": [ 303.0, 947.0, 35.0, 22.0 ],
"text": "out 4"
}
},
{
"box": {
"id": "obj-26",
"maxclass": "newobj",
"numinlets": 1,
"numoutlets": 0,
"patching_rect": [ 387.0, 947.0, 35.0, 22.0 ],
"text": "out 5"
}
},
{
"box": {
"id": "obj-27",
"maxclass": "newobj",
"numinlets": 1,
"numoutlets": 0,
"patching_rect": [ 134.0, 947.0, 35.0, 22.0 ],
"text": "out 2"
}
},
{
"box": {
"id": "obj-28",
"maxclass": "newobj",
"numinlets": 1,
"numoutlets": 0,
"patching_rect": [ 218.0, 947.0, 35.0, 22.0 ],
"text": "out 3"
}
}
],
"lines": [
{
"patchline": {
"destination": [ "obj-24", 0 ],
"source": [ "obj-17", 0 ]
}
},
{
"patchline": {
"destination": [ "obj-17", 0 ],
"source": [ "obj-21", 0 ]
}
},
{
"patchline": {
"destination": [ "obj-17", 1 ],
"source": [ "obj-22", 0 ]
}
},
{
"patchline": {
"destination": [ "obj-17", 2 ],
"source": [ "obj-23", 0 ]
}
}
]
},
"patching_rect": [ 77.0, 262.0, 128.60000000000002, 22.0 ],
"text": "gen @title filtercoeff"
}
},
{
"box": {
"id": "obj-16",
"maxclass": "newobj",
"numinlets": 6,
"numoutlets": 1,
"outlettype": [ "" ],
"patcher": {
"fileversion": 1,
"appversion": {
"major": 9,
"minor": 1,
"revision": 0,
"architecture": "x64",
"modernui": 1
},
"classnamespace": "dsp.gen",
"rect": [ 59.0, 125.0, 1000.0, 780.0 ],
"boxes": [
{
"box": {
"code": "// ----- state (delay memory) -----\nHistory x1(0); // x[n-1]\nHistory x2(0); // x[n-2]\nHistory y1(0); // y[n-1]\nHistory y2(0); // y[n-2]\n\n// ----- per-sample processing -----\ninSig = in1;\n\n// coefficients from inlets\nb0 = in2;\nb1 = in3;\nb2 = in4;\na1 = in5;\na2 = in6;\n\n// difference equation:\n// y[n] = b0*x[n] + b1*x[n-1] + b2*x[n-2] - a1*y[n-1] - a2*y[n-2]\ny = b0 * inSig\n + b1 * x1\n + b2 * x2\n - a1 * y1\n - a2 * y2;\n\n// update state for next sample\nx2 = x1;\nx1 = inSig;\ny2 = y1;\ny1 = y;\n\n// output\nout1 = y;\n",
"fontface": 0,
"fontname": "Menlo Regular",
"fontsize": 12.0,
"id": "obj-3",
"maxclass": "codebox",
"numinlets": 6,
"numoutlets": 1,
"outlettype": [ "" ],
"patching_rect": [ 50.0, 100.0, 444.0, 391.0 ]
}
},
{
"box": {
"id": "obj-9",
"maxclass": "newobj",
"numinlets": 0,
"numoutlets": 1,
"outlettype": [ "" ],
"patching_rect": [ 50.0, 40.0, 28.0, 22.0 ],
"text": "in 1"
}
},
{
"box": {
"id": "obj-10",
"maxclass": "newobj",
"numinlets": 0,
"numoutlets": 1,
"outlettype": [ "" ],
"patching_rect": [ 135.0, 40.0, 28.0, 22.0 ],
"text": "in 2"
}
},
{
"box": {
"id": "obj-11",
"maxclass": "newobj",
"numinlets": 0,
"numoutlets": 1,
"outlettype": [ "" ],
"patching_rect": [ 220.0, 40.0, 28.0, 22.0 ],
"text": "in 3"
}
},
{
"box": {
"id": "obj-12",
"maxclass": "newobj",
"numinlets": 0,
"numoutlets": 1,
"outlettype": [ "" ],
"patching_rect": [ 305.0, 40.0, 28.0, 22.0 ],
"text": "in 4"
}
},
{
"box": {
"id": "obj-13",
"maxclass": "newobj",
"numinlets": 0,
"numoutlets": 1,
"outlettype": [ "" ],
"patching_rect": [ 390.0, 40.0, 28.0, 22.0 ],
"text": "in 5"
}
},
{
"box": {
"id": "obj-14",
"maxclass": "newobj",
"numinlets": 0,
"numoutlets": 1,
"outlettype": [ "" ],
"patching_rect": [ 475.0, 40.0, 28.0, 22.0 ],
"text": "in 6"
}
},
{
"box": {
"id": "obj-15",
"maxclass": "newobj",
"numinlets": 1,
"numoutlets": 0,
"patching_rect": [ 50.0, 551.0, 35.0, 22.0 ],
"text": "out 1"
}
}
],
"lines": [
{
"patchline": {
"destination": [ "obj-3", 1 ],
"source": [ "obj-10", 0 ]
}
},
{
"patchline": {
"destination": [ "obj-3", 2 ],
"source": [ "obj-11", 0 ]
}
},
{
"patchline": {
"destination": [ "obj-3", 3 ],
"source": [ "obj-12", 0 ]
}
},
{
"patchline": {
"destination": [ "obj-3", 4 ],
"source": [ "obj-13", 0 ]
}
},
{
"patchline": {
"destination": [ "obj-3", 5 ],
"source": [ "obj-14", 0 ]
}
},
{
"patchline": {
"destination": [ "obj-15", 0 ],
"source": [ "obj-3", 0 ]
}
},
{
"patchline": {
"destination": [ "obj-3", 0 ],
"source": [ "obj-9", 0 ]
}
}
]
},
"patching_rect": [ 50.0, 306.0, 155.0, 22.0 ],
"text": "gen @title biquad"
}
},
{
"box": {
"id": "obj-37",
"maxclass": "newobj",
"numinlets": 0,
"numoutlets": 1,
"outlettype": [ "" ],
"patching_rect": [ 50.0, 40.0, 28.0, 22.0 ],
"text": "in 1"
}
},
{
"box": {
"id": "obj-38",
"maxclass": "newobj",
"numinlets": 0,
"numoutlets": 1,
"outlettype": [ "" ],
"patching_rect": [ 132.0, 40.0, 28.0, 22.0 ],
"text": "in 2"
}
},
{
"box": {
"id": "obj-39",
"maxclass": "newobj",
"numinlets": 1,
"numoutlets": 0,
"patching_rect": [ 50.0, 346.0, 35.0, 22.0 ],
"text": "out 1"
}
}
],
"lines": [
{
"patchline": {
"destination": [ "obj-29", 0 ],
"source": [ "obj-1", 0 ]
}
},
{
"patchline": {
"destination": [ "obj-39", 0 ],
"source": [ "obj-16", 0 ]
}
},
{
"patchline": {
"destination": [ "obj-31", 0 ],
"source": [ "obj-25", 0 ]
}
},
{
"patchline": {
"destination": [ "obj-16", 5 ],
"source": [ "obj-29", 4 ]
}
},
{
"patchline": {
"destination": [ "obj-16", 4 ],
"source": [ "obj-29", 3 ]
}
},
{
"patchline": {
"destination": [ "obj-16", 3 ],
"source": [ "obj-29", 2 ]
}
},
{
"patchline": {
"destination": [ "obj-16", 2 ],
"source": [ "obj-29", 1 ]
}
},
{
"patchline": {
"destination": [ "obj-16", 1 ],
"source": [ "obj-29", 0 ]
}
},
{
"patchline": {
"destination": [ "obj-36", 0 ],
"source": [ "obj-31", 0 ]
}
},
{
"patchline": {
"destination": [ "obj-29", 1 ],
"source": [ "obj-36", 0 ]
}
},
{
"patchline": {
"destination": [ "obj-16", 0 ],
"source": [ "obj-37", 0 ]
}
},
{
"patchline": {
"destination": [ "obj-25", 0 ],
"source": [ "obj-38", 0 ]
}
},
{
"patchline": {
"destination": [ "obj-29", 2 ],
"source": [ "obj-4", 0 ]
}
}
]
},
"patching_rect": [ 53.0, 687.0, 233.0, 22.0 ],
"text": "gen @title 6.4kHz~"
}
},
{
"box": {
"id": "obj-46",
"maxclass": "newobj",
"numinlets": 2,
"numoutlets": 1,
"outlettype": [ "" ],
"patcher": {
"fileversion": 1,
"appversion": {
"major": 9,
"minor": 1,
"revision": 0,
"architecture": "x64",
"modernui": 1
},
"classnamespace": "dsp.gen",
"rect": [ 59.0, 125.0, 358.0, 451.0 ],
"boxes": [
{
"box": {
"id": "obj-4",
"maxclass": "newobj",
"numinlets": 0,
"numoutlets": 1,
"outlettype": [ "" ],
"patching_rect": [ 186.5, 223.0, 69.0, 22.0 ],
"text": "param q6 1"
}
},
{
"box": {
"id": "obj-1",
"maxclass": "newobj",
"numinlets": 0,
"numoutlets": 1,
"outlettype": [ "" ],
"patching_rect": [ 77.5, 223.0, 86.0, 22.0 ],
"text": "param f6 3200"
}
},
{
"box": {
"id": "obj-36",
"maxclass": "newobj",
"numinlets": 1,
"numoutlets": 1,
"outlettype": [ "" ],
"patcher": {
"fileversion": 1,
"appversion": {
"major": 9,
"minor": 1,
"revision": 0,
"architecture": "x64",
"modernui": 1
},
"classnamespace": "dsp.gen",
"rect": [ 0.0, 0.0, 1000.0, 780.0 ],
"boxes": [
{
"box": {
"code": "// gen~ codebox version\nParam time(10); // ramp time in ms\nHistory state(0);\n\n// compute smoothing coefficient\n// gen~ uses samples, so we convert ms to coeff\ncoeff = exp(-1 / (time * samplerate * 0.001));\n\n// smooth toward input\nout = mix(in1, state, coeff);\nstate = out;",
"fontface": 0,
"fontname": "Menlo Regular",
"fontsize": 12.0,
"id": "obj-242",
"maxclass": "codebox",
"numinlets": 1,
"numoutlets": 1,
"outlettype": [ "" ],
"patching_rect": [ 50.0, 100.0, 441.0, 207.0 ]
}
},
{
"box": {
"id": "obj-34",
"maxclass": "newobj",
"numinlets": 0,
"numoutlets": 1,
"outlettype": [ "" ],
"patching_rect": [ 50.0, 40.0, 28.0, 22.0 ],
"text": "in 1"
}
},
{
"box": {
"id": "obj-35",
"maxclass": "newobj",
"numinlets": 1,
"numoutlets": 0,
"patching_rect": [ 50.0, 367.0, 35.0, 22.0 ],
"text": "out 1"
}
}
],
"lines": [
{
"patchline": {
"destination": [ "obj-35", 0 ],
"source": [ "obj-242", 0 ]
}
},
{
"patchline": {
"destination": [ "obj-242", 0 ],
"source": [ "obj-34", 0 ]
}
}
]
},
"patching_rect": [ 132.0, 175.0, 89.0, 22.0 ],
"text": "gen @title fade"
}
},
{
"box": {
"id": "obj-25",
"maxclass": "newobj",
"numinlets": 1,
"numoutlets": 1,
"outlettype": [ "" ],
"patching_rect": [ 132.0, 100.0, 151.0, 22.0 ],
"text": "scale -100. 100. -18. 18. 1."
}
},
{
"box": {
"id": "obj-31",
"maxclass": "newobj",
"numinlets": 1,
"numoutlets": 1,
"outlettype": [ "" ],
"patching_rect": [ 132.0, 139.0, 39.0, 22.0 ],
"text": "dbtoa"
}
},
{
"box": {
"id": "obj-29",
"maxclass": "newobj",
"numinlets": 3,
"numoutlets": 5,
"outlettype": [ "", "", "", "", "" ],
"patcher": {
"fileversion": 1,
"appversion": {
"major": 9,
"minor": 1,
"revision": 0,
"architecture": "x64",
"modernui": 1
},
"classnamespace": "dsp.gen",
"rect": [ 134.0, 157.0, 1078.0, 978.0 ],
"boxes": [
{
"box": {
"code": "// -----------------------------------------------------\n// Peak/Notch (Peaking EQ) biquad coefficient generator\n//\n// Inlets:\n// in1 = frequency (Hz)\n// in2 = gain (dB, boost/cut)\n// in3 = Q\n//\n// Outlets:\n// out1 = b0\n// out2 = b1\n// out3 = b2\n// out4 = a1\n// out5 = a2\n// -----------------------------------------------------\n\nfreq = max(1, in1);\n//gainDB = in2;\ngain = in2;\r\nQ = max(0.0001, in3);\n\n// Convert gain from dB → amplitude ratio\n//A = pow(10, gainDB / 40);\nA = sqrt(gain);\r\n\n// Angular frequency\nw0 = twopi * freq / samplerate;\ncosw = cos(w0);\nsinw = sin(w0);\n\n// alpha controls the bandwidth\nalpha = sinw / (2 * Q);\n\n// -----------------------------------------------------\n// RBJ Peaking EQ formulas\n//\n// b0 = 1 + alpha*A\n// b1 = -2*cos(w0)\n// b2 = 1 - alpha*A\n//\n// a0 = 1 + alpha/A\n// a1 = -2*cos(w0)\n// a2 = 1 - alpha/A\n// -----------------------------------------------------\n\nb0 = 1 + alpha * A;\nb1 = -2 * cosw;\nb2 = 1 - alpha * A;\n\na0 = 1 + alpha / A;\na1 = -2 * cosw;\na2 = 1 - alpha / A;\n\n// Normalize by a0\nb0 /= a0;\nb1 /= a0;\nb2 /= a0;\na1 /= a0;\na2 /= a0;\n\n// Outputs\nout1 = b0;\nout2 = b1;\nout3 = b2;\nout4 = a1;\nout5 = a2;\n",
"fontface": 0,
"fontname": "Menlo Regular",
"fontsize": 12.0,
"id": "obj-17",
"maxclass": "codebox",
"numinlets": 3,
"numoutlets": 5,
"outlettype": [ "", "", "", "", "" ],
"patching_rect": [ 50.0, 118.0, 356.0, 794.0 ]
}
},
{
"box": {
"id": "obj-21",
"maxclass": "newobj",
"numinlets": 0,
"numoutlets": 1,
"outlettype": [ "" ],
"patching_rect": [ 50.0, 13.0, 269.0, 22.0 ],
"text": "in 1 @comment frequency @default 100 @min 0"
}
},
{
"box": {
"id": "obj-22",
"maxclass": "newobj",
"numinlets": 0,
"numoutlets": 1,
"outlettype": [ "" ],
"patching_rect": [ 218.5, 47.0, 225.0, 22.0 ],
"text": "in 2 @comment gain @default 1 @min 0"
}
},
{
"box": {
"id": "obj-23",
"maxclass": "newobj",
"numinlets": 0,
"numoutlets": 1,
"outlettype": [ "" ],
"patching_rect": [ 387.0, 76.0, 178.0, 22.0 ],
"text": "in 3 @default 1 @min 0.000001"
}
},
{
"box": {
"id": "obj-24",
"maxclass": "newobj",
"numinlets": 1,
"numoutlets": 0,
"patching_rect": [ 50.0, 947.0, 35.0, 22.0 ],
"text": "out 1"
}
},
{
"box": {
"id": "obj-25",
"maxclass": "newobj",
"numinlets": 1,
"numoutlets": 0,
"patching_rect": [ 303.0, 947.0, 35.0, 22.0 ],
"text": "out 4"
}
},
{
"box": {
"id": "obj-26",
"maxclass": "newobj",
"numinlets": 1,
"numoutlets": 0,
"patching_rect": [ 387.0, 947.0, 35.0, 22.0 ],
"text": "out 5"
}
},
{
"box": {
"id": "obj-27",
"maxclass": "newobj",
"numinlets": 1,
"numoutlets": 0,
"patching_rect": [ 134.0, 947.0, 35.0, 22.0 ],
"text": "out 2"
}
},
{
"box": {
"id": "obj-28",
"maxclass": "newobj",
"numinlets": 1,
"numoutlets": 0,
"patching_rect": [ 218.0, 947.0, 35.0, 22.0 ],
"text": "out 3"
}
}
],
"lines": [
{
"patchline": {
"destination": [ "obj-24", 0 ],
"source": [ "obj-17", 0 ]
}
},
{
"patchline": {
"destination": [ "obj-25", 0 ],
"source": [ "obj-17", 3 ]
}
},
{
"patchline": {
"destination": [ "obj-26", 0 ],
"source": [ "obj-17", 4 ]
}
},
{
"patchline": {
"destination": [ "obj-27", 0 ],
"source": [ "obj-17", 1 ]
}
},
{
"patchline": {
"destination": [ "obj-28", 0 ],
"source": [ "obj-17", 2 ]
}
},
{
"patchline": {
"destination": [ "obj-17", 0 ],
"source": [ "obj-21", 0 ]
}
},
{
"patchline": {
"destination": [ "obj-17", 1 ],
"source": [ "obj-22", 0 ]
}
},
{
"patchline": {
"destination": [ "obj-17", 2 ],
"source": [ "obj-23", 0 ]
}
}
]
},
"patching_rect": [ 77.0, 263.0, 128.60000000000002, 22.0 ],
"text": "gen @title filtercoeff"
}
},
{
"box": {
"id": "obj-16",
"maxclass": "newobj",
"numinlets": 6,
"numoutlets": 1,
"outlettype": [ "" ],
"patcher": {
"fileversion": 1,
"appversion": {
"major": 9,
"minor": 1,
"revision": 0,
"architecture": "x64",
"modernui": 1
},
"classnamespace": "dsp.gen",
"rect": [ 0.0, 0.0, 1000.0, 780.0 ],
"boxes": [
{
"box": {
"code": "// ----- state (delay memory) -----\nHistory x1(0); // x[n-1]\nHistory x2(0); // x[n-2]\nHistory y1(0); // y[n-1]\nHistory y2(0); // y[n-2]\n\n// ----- per-sample processing -----\ninSig = in1;\n\n// coefficients from inlets\nb0 = in2;\nb1 = in3;\nb2 = in4;\na1 = in5;\na2 = in6;\n\n// difference equation:\n// y[n] = b0*x[n] + b1*x[n-1] + b2*x[n-2] - a1*y[n-1] - a2*y[n-2]\ny = b0 * inSig\n + b1 * x1\n + b2 * x2\n - a1 * y1\n - a2 * y2;\n\n// update state for next sample\nx2 = x1;\nx1 = inSig;\ny2 = y1;\ny1 = y;\n\n// output\nout1 = y;\n",
"fontface": 0,
"fontname": "Menlo Regular",
"fontsize": 12.0,
"id": "obj-3",
"maxclass": "codebox",
"numinlets": 6,
"numoutlets": 1,
"outlettype": [ "" ],
"patching_rect": [ 50.0, 100.0, 444.0, 391.0 ]
}
},
{
"box": {
"id": "obj-9",
"maxclass": "newobj",
"numinlets": 0,
"numoutlets": 1,
"outlettype": [ "" ],
"patching_rect": [ 50.0, 40.0, 28.0, 22.0 ],
"text": "in 1"
}
},
{
"box": {
"id": "obj-10",
"maxclass": "newobj",
"numinlets": 0,
"numoutlets": 1,
"outlettype": [ "" ],
"patching_rect": [ 135.0, 40.0, 28.0, 22.0 ],
"text": "in 2"
}
},
{
"box": {
"id": "obj-11",
"maxclass": "newobj",
"numinlets": 0,
"numoutlets": 1,
"outlettype": [ "" ],
"patching_rect": [ 220.0, 40.0, 28.0, 22.0 ],
"text": "in 3"
}
},
{
"box": {
"id": "obj-12",
"maxclass": "newobj",
"numinlets": 0,
"numoutlets": 1,
"outlettype": [ "" ],
"patching_rect": [ 305.0, 40.0, 28.0, 22.0 ],
"text": "in 4"
}
},
{
"box": {
"id": "obj-13",
"maxclass": "newobj",
"numinlets": 0,
"numoutlets": 1,
"outlettype": [ "" ],
"patching_rect": [ 390.0, 40.0, 28.0, 22.0 ],
"text": "in 5"
}
},
{
"box": {
"id": "obj-14",
"maxclass": "newobj",
"numinlets": 0,
"numoutlets": 1,
"outlettype": [ "" ],
"patching_rect": [ 475.0, 40.0, 28.0, 22.0 ],
"text": "in 6"
}
},
{
"box": {
"id": "obj-15",
"maxclass": "newobj",
"numinlets": 1,
"numoutlets": 0,
"patching_rect": [ 50.0, 551.0, 35.0, 22.0 ],
"text": "out 1"
}
}
],
"lines": [
{
"patchline": {
"destination": [ "obj-3", 1 ],
"source": [ "obj-10", 0 ]
}
},
{
"patchline": {
"destination": [ "obj-3", 2 ],
"source": [ "obj-11", 0 ]
}
},
{
"patchline": {
"destination": [ "obj-3", 3 ],
"source": [ "obj-12", 0 ]
}
},
{
"patchline": {
"destination": [ "obj-3", 4 ],
"source": [ "obj-13", 0 ]
}
},
{
"patchline": {
"destination": [ "obj-3", 5 ],
"source": [ "obj-14", 0 ]
}
},
{
"patchline": {
"destination": [ "obj-15", 0 ],
"source": [ "obj-3", 0 ]
}
},
{
"patchline": {
"destination": [ "obj-3", 0 ],
"source": [ "obj-9", 0 ]
}
}
]
},
"patching_rect": [ 50.0, 307.0, 155.0, 22.0 ],
"text": "gen @title biquad"
}
},
{
"box": {
"id": "obj-37",
"maxclass": "newobj",
"numinlets": 0,
"numoutlets": 1,
"outlettype": [ "" ],
"patching_rect": [ 50.0, 40.0, 28.0, 22.0 ],
"text": "in 1"
}
},
{
"box": {
"id": "obj-38",
"maxclass": "newobj",
"numinlets": 0,
"numoutlets": 1,
"outlettype": [ "" ],
"patching_rect": [ 132.0, 40.0, 28.0, 22.0 ],
"text": "in 2"
}
},
{
"box": {
"id": "obj-39",
"maxclass": "newobj",
"numinlets": 1,
"numoutlets": 0,
"patching_rect": [ 50.0, 346.0, 35.0, 22.0 ],
"text": "out 1"
}
}
],
"lines": [
{
"patchline": {
"destination": [ "obj-29", 0 ],
"source": [ "obj-1", 0 ]
}
},
{
"patchline": {
"destination": [ "obj-39", 0 ],
"source": [ "obj-16", 0 ]
}
},
{
"patchline": {
"destination": [ "obj-31", 0 ],
"source": [ "obj-25", 0 ]
}
},
{
"patchline": {
"destination": [ "obj-16", 5 ],
"source": [ "obj-29", 4 ]
}
},
{
"patchline": {
"destination": [ "obj-16", 4 ],
"source": [ "obj-29", 3 ]
}
},
{
"patchline": {
"destination": [ "obj-16", 3 ],
"source": [ "obj-29", 2 ]
}
},
{
"patchline": {
"destination": [ "obj-16", 2 ],
"source": [ "obj-29", 1 ]
}
},
{
"patchline": {
"destination": [ "obj-16", 1 ],
"source": [ "obj-29", 0 ]
}
},
{
"patchline": {
"destination": [ "obj-36", 0 ],
"source": [ "obj-31", 0 ]
}
},
{
"patchline": {
"destination": [ "obj-29", 1 ],
"source": [ "obj-36", 0 ]
}
},
{
"patchline": {
"destination": [ "obj-16", 0 ],
"source": [ "obj-37", 0 ]
}
},
{
"patchline": {
"destination": [ "obj-25", 0 ],
"source": [ "obj-38", 0 ]
}
},
{
"patchline": {
"destination": [ "obj-29", 2 ],
"source": [ "obj-4", 0 ]
}
}
]
},
"patching_rect": [ 53.0, 593.0, 233.0, 22.0 ],
"text": "gen @title 3.2kHz~"
}
},
{
"box": {
"id": "obj-45",
"maxclass": "newobj",
"numinlets": 2,
"numoutlets": 1,
"outlettype": [ "" ],
"patcher": {
"fileversion": 1,
"appversion": {
"major": 9,
"minor": 1,
"revision": 0,
"architecture": "x64",
"modernui": 1
},
"classnamespace": "dsp.gen",
"rect": [ 59.0, 125.0, 399.0, 423.0 ],
"boxes": [
{
"box": {
"id": "obj-4",
"maxclass": "newobj",
"numinlets": 0,
"numoutlets": 1,
"outlettype": [ "" ],
"patching_rect": [ 186.5, 223.0, 69.0, 22.0 ],
"text": "param q5 1"
}
},
{
"box": {
"id": "obj-1",
"maxclass": "newobj",
"numinlets": 0,
"numoutlets": 1,
"outlettype": [ "" ],
"patching_rect": [ 77.5, 223.0, 86.0, 22.0 ],
"text": "param f5 1600"
}
},
{
"box": {
"id": "obj-36",
"maxclass": "newobj",
"numinlets": 1,
"numoutlets": 1,
"outlettype": [ "" ],
"patcher": {
"fileversion": 1,
"appversion": {
"major": 9,
"minor": 1,
"revision": 0,
"architecture": "x64",
"modernui": 1
},
"classnamespace": "dsp.gen",
"rect": [ 0.0, 0.0, 1000.0, 780.0 ],
"boxes": [
{
"box": {
"code": "// gen~ codebox version\nParam time(10); // ramp time in ms\nHistory state(0);\n\n// compute smoothing coefficient\n// gen~ uses samples, so we convert ms to coeff\ncoeff = exp(-1 / (time * samplerate * 0.001));\n\n// smooth toward input\nout = mix(in1, state, coeff);\nstate = out;",
"fontface": 0,
"fontname": "Menlo Regular",
"fontsize": 12.0,
"id": "obj-242",
"maxclass": "codebox",
"numinlets": 1,
"numoutlets": 1,
"outlettype": [ "" ],
"patching_rect": [ 50.0, 100.0, 441.0, 207.0 ]
}
},
{
"box": {
"id": "obj-34",
"maxclass": "newobj",
"numinlets": 0,
"numoutlets": 1,
"outlettype": [ "" ],
"patching_rect": [ 50.0, 40.0, 28.0, 22.0 ],
"text": "in 1"
}
},
{
"box": {
"id": "obj-35",
"maxclass": "newobj",
"numinlets": 1,
"numoutlets": 0,
"patching_rect": [ 50.0, 367.0, 35.0, 22.0 ],
"text": "out 1"
}
}
],
"lines": [
{
"patchline": {
"destination": [ "obj-35", 0 ],
"source": [ "obj-242", 0 ]
}
},
{
"patchline": {
"destination": [ "obj-242", 0 ],
"source": [ "obj-34", 0 ]
}
}
]
},
"patching_rect": [ 132.0, 175.0, 89.0, 22.0 ],
"text": "gen @title fade"
}
},
{
"box": {
"id": "obj-25",
"maxclass": "newobj",
"numinlets": 1,
"numoutlets": 1,
"outlettype": [ "" ],
"patching_rect": [ 132.0, 100.0, 151.0, 22.0 ],
"text": "scale -100. 100. -18. 18. 1."
}
},
{
"box": {
"id": "obj-31",
"maxclass": "newobj",
"numinlets": 1,
"numoutlets": 1,
"outlettype": [ "" ],
"patching_rect": [ 132.0, 139.0, 39.0, 22.0 ],
"text": "dbtoa"
}
},
{
"box": {
"id": "obj-29",
"maxclass": "newobj",
"numinlets": 3,
"numoutlets": 5,
"outlettype": [ "", "", "", "", "" ],
"patcher": {
"fileversion": 1,
"appversion": {
"major": 9,
"minor": 1,
"revision": 0,
"architecture": "x64",
"modernui": 1
},
"classnamespace": "dsp.gen",
"rect": [ 134.0, 157.0, 1078.0, 978.0 ],
"boxes": [
{
"box": {
"code": "// -----------------------------------------------------\n// Peak/Notch (Peaking EQ) biquad coefficient generator\n//\n// Inlets:\n// in1 = frequency (Hz)\n// in2 = gain (dB, boost/cut)\n// in3 = Q\n//\n// Outlets:\n// out1 = b0\n// out2 = b1\n// out3 = b2\n// out4 = a1\n// out5 = a2\n// -----------------------------------------------------\n\nfreq = max(1, in1);\n//gainDB = in2;\ngain = in2;\r\nQ = max(0.0001, in3);\n\n// Convert gain from dB → amplitude ratio\n//A = pow(10, gainDB / 40);\nA = sqrt(gain);\r\n\n// Angular frequency\nw0 = twopi * freq / samplerate;\ncosw = cos(w0);\nsinw = sin(w0);\n\n// alpha controls the bandwidth\nalpha = sinw / (2 * Q);\n\n// -----------------------------------------------------\n// RBJ Peaking EQ formulas\n//\n// b0 = 1 + alpha*A\n// b1 = -2*cos(w0)\n// b2 = 1 - alpha*A\n//\n// a0 = 1 + alpha/A\n// a1 = -2*cos(w0)\n// a2 = 1 - alpha/A\n// -----------------------------------------------------\n\nb0 = 1 + alpha * A;\nb1 = -2 * cosw;\nb2 = 1 - alpha * A;\n\na0 = 1 + alpha / A;\na1 = -2 * cosw;\na2 = 1 - alpha / A;\n\n// Normalize by a0\nb0 /= a0;\nb1 /= a0;\nb2 /= a0;\na1 /= a0;\na2 /= a0;\n\n// Outputs\nout1 = b0;\nout2 = b1;\nout3 = b2;\nout4 = a1;\nout5 = a2;\n",
"fontface": 0,
"fontname": "Menlo Regular",
"fontsize": 12.0,
"id": "obj-17",
"maxclass": "codebox",
"numinlets": 3,
"numoutlets": 5,
"outlettype": [ "", "", "", "", "" ],
"patching_rect": [ 50.0, 118.0, 356.0, 794.0 ]
}
},
{
"box": {
"id": "obj-21",
"maxclass": "newobj",
"numinlets": 0,
"numoutlets": 1,
"outlettype": [ "" ],
"patching_rect": [ 50.0, 13.0, 269.0, 22.0 ],
"text": "in 1 @comment frequency @default 100 @min 0"
}
},
{
"box": {
"id": "obj-22",
"maxclass": "newobj",
"numinlets": 0,
"numoutlets": 1,
"outlettype": [ "" ],
"patching_rect": [ 218.5, 47.0, 225.0, 22.0 ],
"text": "in 2 @comment gain @default 1 @min 0"
}
},
{
"box": {
"id": "obj-23",
"maxclass": "newobj",
"numinlets": 0,
"numoutlets": 1,
"outlettype": [ "" ],
"patching_rect": [ 387.0, 76.0, 178.0, 22.0 ],
"text": "in 3 @default 1 @min 0.000001"
}
},
{
"box": {
"id": "obj-24",
"maxclass": "newobj",
"numinlets": 1,
"numoutlets": 0,
"patching_rect": [ 50.0, 947.0, 35.0, 22.0 ],
"text": "out 1"
}
},
{
"box": {
"id": "obj-25",
"maxclass": "newobj",
"numinlets": 1,
"numoutlets": 0,
"patching_rect": [ 303.0, 947.0, 35.0, 22.0 ],
"text": "out 4"
}
},
{
"box": {
"id": "obj-26",
"maxclass": "newobj",
"numinlets": 1,
"numoutlets": 0,
"patching_rect": [ 387.0, 947.0, 35.0, 22.0 ],
"text": "out 5"
}
},
{
"box": {
"id": "obj-27",
"maxclass": "newobj",
"numinlets": 1,
"numoutlets": 0,
"patching_rect": [ 134.0, 947.0, 35.0, 22.0 ],
"text": "out 2"
}
},
{
"box": {
"id": "obj-28",
"maxclass": "newobj",
"numinlets": 1,
"numoutlets": 0,
"patching_rect": [ 218.0, 947.0, 35.0, 22.0 ],
"text": "out 3"
}
}
],
"lines": [
{
"patchline": {
"destination": [ "obj-24", 0 ],
"source": [ "obj-17", 0 ]
}
},
{
"patchline": {
"destination": [ "obj-25", 0 ],
"source": [ "obj-17", 3 ]
}
},
{
"patchline": {
"destination": [ "obj-26", 0 ],
"source": [ "obj-17", 4 ]
}
},
{
"patchline": {
"destination": [ "obj-27", 0 ],
"source": [ "obj-17", 1 ]
}
},
{
"patchline": {
"destination": [ "obj-28", 0 ],
"source": [ "obj-17", 2 ]
}
},
{
"patchline": {
"destination": [ "obj-17", 0 ],
"source": [ "obj-21", 0 ]
}
},
{
"patchline": {
"destination": [ "obj-17", 1 ],
"source": [ "obj-22", 0 ]
}
},
{
"patchline": {
"destination": [ "obj-17", 2 ],
"source": [ "obj-23", 0 ]
}
}
]
},
"patching_rect": [ 77.0, 258.0, 128.60000000000002, 22.0 ],
"text": "gen @title filtercoeff"
}
},
{
"box": {
"id": "obj-16",
"maxclass": "newobj",
"numinlets": 6,
"numoutlets": 1,
"outlettype": [ "" ],
"patcher": {
"fileversion": 1,
"appversion": {
"major": 9,
"minor": 1,
"revision": 0,
"architecture": "x64",
"modernui": 1
},
"classnamespace": "dsp.gen",
"rect": [ 59.0, 125.0, 1000.0, 780.0 ],
"boxes": [
{
"box": {
"code": "// ----- state (delay memory) -----\nHistory x1(0); // x[n-1]\nHistory x2(0); // x[n-2]\nHistory y1(0); // y[n-1]\nHistory y2(0); // y[n-2]\n\n// ----- per-sample processing -----\ninSig = in1;\n\n// coefficients from inlets\nb0 = in2;\nb1 = in3;\nb2 = in4;\na1 = in5;\na2 = in6;\n\n// difference equation:\n// y[n] = b0*x[n] + b1*x[n-1] + b2*x[n-2] - a1*y[n-1] - a2*y[n-2]\ny = b0 * inSig\n + b1 * x1\n + b2 * x2\n - a1 * y1\n - a2 * y2;\n\n// update state for next sample\nx2 = x1;\nx1 = inSig;\ny2 = y1;\ny1 = y;\n\n// output\nout1 = y;\n",
"fontface": 0,
"fontname": "Menlo Regular",
"fontsize": 12.0,
"id": "obj-3",
"maxclass": "codebox",
"numinlets": 6,
"numoutlets": 1,
"outlettype": [ "" ],
"patching_rect": [ 50.0, 100.0, 444.0, 391.0 ]
}
},
{
"box": {
"id": "obj-9",
"maxclass": "newobj",
"numinlets": 0,
"numoutlets": 1,
"outlettype": [ "" ],
"patching_rect": [ 50.0, 40.0, 28.0, 22.0 ],
"text": "in 1"
}
},
{
"box": {
"id": "obj-10",
"maxclass": "newobj",
"numinlets": 0,
"numoutlets": 1,
"outlettype": [ "" ],
"patching_rect": [ 135.0, 40.0, 28.0, 22.0 ],
"text": "in 2"
}
},
{
"box": {
"id": "obj-11",
"maxclass": "newobj",
"numinlets": 0,
"numoutlets": 1,
"outlettype": [ "" ],
"patching_rect": [ 220.0, 40.0, 28.0, 22.0 ],
"text": "in 3"
}
},
{
"box": {
"id": "obj-12",
"maxclass": "newobj",
"numinlets": 0,
"numoutlets": 1,
"outlettype": [ "" ],
"patching_rect": [ 305.0, 40.0, 28.0, 22.0 ],
"text": "in 4"
}
},
{
"box": {
"id": "obj-13",
"maxclass": "newobj",
"numinlets": 0,
"numoutlets": 1,
"outlettype": [ "" ],
"patching_rect": [ 390.0, 40.0, 28.0, 22.0 ],
"text": "in 5"
}
},
{
"box": {
"id": "obj-14",
"maxclass": "newobj",
"numinlets": 0,
"numoutlets": 1,
"outlettype": [ "" ],
"patching_rect": [ 475.0, 40.0, 28.0, 22.0 ],
"text": "in 6"
}
},
{
"box": {
"id": "obj-15",
"maxclass": "newobj",
"numinlets": 1,
"numoutlets": 0,
"patching_rect": [ 50.0, 551.0, 35.0, 22.0 ],
"text": "out 1"
}
}
],
"lines": [
{
"patchline": {
"destination": [ "obj-3", 1 ],
"source": [ "obj-10", 0 ]
}
},
{
"patchline": {
"destination": [ "obj-3", 2 ],
"source": [ "obj-11", 0 ]
}
},
{
"patchline": {
"destination": [ "obj-3", 3 ],
"source": [ "obj-12", 0 ]
}
},
{
"patchline": {
"destination": [ "obj-3", 4 ],
"source": [ "obj-13", 0 ]
}
},
{
"patchline": {
"destination": [ "obj-3", 5 ],
"source": [ "obj-14", 0 ]
}
},
{
"patchline": {
"destination": [ "obj-15", 0 ],
"source": [ "obj-3", 0 ]
}
},
{
"patchline": {
"destination": [ "obj-3", 0 ],
"source": [ "obj-9", 0 ]
}
}
]
},
"patching_rect": [ 50.0, 302.0, 155.0, 22.0 ],
"text": "gen @title biquad"
}
},
{
"box": {
"id": "obj-37",
"maxclass": "newobj",
"numinlets": 0,
"numoutlets": 1,
"outlettype": [ "" ],
"patching_rect": [ 50.0, 40.0, 28.0, 22.0 ],
"text": "in 1"
}
},
{
"box": {
"id": "obj-38",
"maxclass": "newobj",
"numinlets": 0,
"numoutlets": 1,
"outlettype": [ "" ],
"patching_rect": [ 132.0, 40.0, 28.0, 22.0 ],
"text": "in 2"
}
},
{
"box": {
"id": "obj-39",
"maxclass": "newobj",
"numinlets": 1,
"numoutlets": 0,
"patching_rect": [ 50.0, 346.0, 35.0, 22.0 ],
"text": "out 1"
}
}
],
"lines": [
{
"patchline": {
"destination": [ "obj-29", 0 ],
"source": [ "obj-1", 0 ]
}
},
{
"patchline": {
"destination": [ "obj-39", 0 ],
"source": [ "obj-16", 0 ]
}
},
{
"patchline": {
"destination": [ "obj-31", 0 ],
"source": [ "obj-25", 0 ]
}
},
{
"patchline": {
"destination": [ "obj-16", 5 ],
"source": [ "obj-29", 4 ]
}
},
{
"patchline": {
"destination": [ "obj-16", 4 ],
"source": [ "obj-29", 3 ]
}
},
{
"patchline": {
"destination": [ "obj-16", 3 ],
"source": [ "obj-29", 2 ]
}
},
{
"patchline": {
"destination": [ "obj-16", 2 ],
"source": [ "obj-29", 1 ]
}
},
{
"patchline": {
"destination": [ "obj-16", 1 ],
"source": [ "obj-29", 0 ]
}
},
{
"patchline": {
"destination": [ "obj-36", 0 ],
"source": [ "obj-31", 0 ]
}
},
{
"patchline": {
"destination": [ "obj-29", 1 ],
"source": [ "obj-36", 0 ]
}
},
{
"patchline": {
"destination": [ "obj-16", 0 ],
"source": [ "obj-37", 0 ]
}
},
{
"patchline": {
"destination": [ "obj-25", 0 ],
"source": [ "obj-38", 0 ]
}
},
{
"patchline": {
"destination": [ "obj-29", 2 ],
"source": [ "obj-4", 0 ]
}
}
]
},
"patching_rect": [ 53.0, 488.0, 233.0, 22.0 ],
"text": "gen @title 1.6kHz~"
}
},
{
"box": {
"id": "obj-44",
"maxclass": "newobj",
"numinlets": 2,
"numoutlets": 1,
"outlettype": [ "" ],
"patcher": {
"fileversion": 1,
"appversion": {
"major": 9,
"minor": 1,
"revision": 0,
"architecture": "x64",
"modernui": 1
},
"classnamespace": "dsp.gen",
"rect": [ 59.0, 125.0, 387.0, 506.0 ],
"boxes": [
{
"box": {
"id": "obj-4",
"maxclass": "newobj",
"numinlets": 0,
"numoutlets": 1,
"outlettype": [ "" ],
"patching_rect": [ 186.5, 223.0, 69.0, 22.0 ],
"text": "param q4 1"
}
},
{
"box": {
"id": "obj-1",
"maxclass": "newobj",
"numinlets": 0,
"numoutlets": 1,
"outlettype": [ "" ],
"patching_rect": [ 77.5, 223.0, 79.0, 22.0 ],
"text": "param f4 800"
}
},
{
"box": {
"id": "obj-36",
"maxclass": "newobj",
"numinlets": 1,
"numoutlets": 1,
"outlettype": [ "" ],
"patcher": {
"fileversion": 1,
"appversion": {
"major": 9,
"minor": 1,
"revision": 0,
"architecture": "x64",
"modernui": 1
},
"classnamespace": "dsp.gen",
"rect": [ 0.0, 0.0, 1000.0, 780.0 ],
"boxes": [
{
"box": {
"code": "// gen~ codebox version\nParam time(10); // ramp time in ms\nHistory state(0);\n\n// compute smoothing coefficient\n// gen~ uses samples, so we convert ms to coeff\ncoeff = exp(-1 / (time * samplerate * 0.001));\n\n// smooth toward input\nout = mix(in1, state, coeff);\nstate = out;",
"fontface": 0,
"fontname": "Menlo Regular",
"fontsize": 12.0,
"id": "obj-242",
"maxclass": "codebox",
"numinlets": 1,
"numoutlets": 1,
"outlettype": [ "" ],
"patching_rect": [ 50.0, 100.0, 441.0, 207.0 ]
}
},
{
"box": {
"id": "obj-34",
"maxclass": "newobj",
"numinlets": 0,
"numoutlets": 1,
"outlettype": [ "" ],
"patching_rect": [ 50.0, 40.0, 28.0, 22.0 ],
"text": "in 1"
}
},
{
"box": {
"id": "obj-35",
"maxclass": "newobj",
"numinlets": 1,
"numoutlets": 0,
"patching_rect": [ 50.0, 367.0, 35.0, 22.0 ],
"text": "out 1"
}
}
],
"lines": [
{
"patchline": {
"destination": [ "obj-35", 0 ],
"source": [ "obj-242", 0 ]
}
},
{
"patchline": {
"destination": [ "obj-242", 0 ],
"source": [ "obj-34", 0 ]
}
}
]
},
"patching_rect": [ 132.0, 175.0, 89.0, 22.0 ],
"text": "gen @title fade"
}
},
{
"box": {
"id": "obj-25",
"maxclass": "newobj",
"numinlets": 1,
"numoutlets": 1,
"outlettype": [ "" ],
"patching_rect": [ 132.0, 100.0, 151.0, 22.0 ],
"text": "scale -100. 100. -18. 18. 1."
}
},
{
"box": {
"id": "obj-31",
"maxclass": "newobj",
"numinlets": 1,
"numoutlets": 1,
"outlettype": [ "" ],
"patching_rect": [ 132.0, 139.0, 39.0, 22.0 ],
"text": "dbtoa"
}
},
{
"box": {
"id": "obj-29",
"maxclass": "newobj",
"numinlets": 3,
"numoutlets": 5,
"outlettype": [ "", "", "", "", "" ],
"patcher": {
"fileversion": 1,
"appversion": {
"major": 9,
"minor": 1,
"revision": 0,
"architecture": "x64",
"modernui": 1
},
"classnamespace": "dsp.gen",
"rect": [ 134.0, 157.0, 1078.0, 978.0 ],
"boxes": [
{
"box": {
"code": "// -----------------------------------------------------\n// Peak/Notch (Peaking EQ) biquad coefficient generator\n//\n// Inlets:\n// in1 = frequency (Hz)\n// in2 = gain (dB, boost/cut)\n// in3 = Q\n//\n// Outlets:\n// out1 = b0\n// out2 = b1\n// out3 = b2\n// out4 = a1\n// out5 = a2\n// -----------------------------------------------------\n\nfreq = max(1, in1);\n//gainDB = in2;\ngain = in2;\r\nQ = max(0.0001, in3);\n\n// Convert gain from dB → amplitude ratio\n//A = pow(10, gainDB / 40);\nA = sqrt(gain);\r\n\n// Angular frequency\nw0 = twopi * freq / samplerate;\ncosw = cos(w0);\nsinw = sin(w0);\n\n// alpha controls the bandwidth\nalpha = sinw / (2 * Q);\n\n// -----------------------------------------------------\n// RBJ Peaking EQ formulas\n//\n// b0 = 1 + alpha*A\n// b1 = -2*cos(w0)\n// b2 = 1 - alpha*A\n//\n// a0 = 1 + alpha/A\n// a1 = -2*cos(w0)\n// a2 = 1 - alpha/A\n// -----------------------------------------------------\n\nb0 = 1 + alpha * A;\nb1 = -2 * cosw;\nb2 = 1 - alpha * A;\n\na0 = 1 + alpha / A;\na1 = -2 * cosw;\na2 = 1 - alpha / A;\n\n// Normalize by a0\nb0 /= a0;\nb1 /= a0;\nb2 /= a0;\na1 /= a0;\na2 /= a0;\n\n// Outputs\nout1 = b0;\nout2 = b1;\nout3 = b2;\nout4 = a1;\nout5 = a2;\n",
"fontface": 0,
"fontname": "Menlo Regular",
"fontsize": 12.0,
"id": "obj-17",
"maxclass": "codebox",
"numinlets": 3,
"numoutlets": 5,
"outlettype": [ "", "", "", "", "" ],
"patching_rect": [ 50.0, 118.0, 356.0, 794.0 ]
}
},
{
"box": {
"id": "obj-21",
"maxclass": "newobj",
"numinlets": 0,
"numoutlets": 1,
"outlettype": [ "" ],
"patching_rect": [ 50.0, 13.0, 269.0, 22.0 ],
"text": "in 1 @comment frequency @default 100 @min 0"
}
},
{
"box": {
"id": "obj-22",
"maxclass": "newobj",
"numinlets": 0,
"numoutlets": 1,
"outlettype": [ "" ],
"patching_rect": [ 218.5, 47.0, 225.0, 22.0 ],
"text": "in 2 @comment gain @default 1 @min 0"
}
},
{
"box": {
"id": "obj-23",
"maxclass": "newobj",
"numinlets": 0,
"numoutlets": 1,
"outlettype": [ "" ],
"patching_rect": [ 387.0, 76.0, 178.0, 22.0 ],
"text": "in 3 @default 1 @min 0.000001"
}
},
{
"box": {
"id": "obj-24",
"maxclass": "newobj",
"numinlets": 1,
"numoutlets": 0,
"patching_rect": [ 50.0, 947.0, 35.0, 22.0 ],
"text": "out 1"
}
},
{
"box": {
"id": "obj-25",
"maxclass": "newobj",
"numinlets": 1,
"numoutlets": 0,
"patching_rect": [ 303.0, 947.0, 35.0, 22.0 ],
"text": "out 4"
}
},
{
"box": {
"id": "obj-26",
"maxclass": "newobj",
"numinlets": 1,
"numoutlets": 0,
"patching_rect": [ 387.0, 947.0, 35.0, 22.0 ],
"text": "out 5"
}
},
{
"box": {
"id": "obj-27",
"maxclass": "newobj",
"numinlets": 1,
"numoutlets": 0,
"patching_rect": [ 134.0, 947.0, 35.0, 22.0 ],
"text": "out 2"
}
},
{
"box": {
"id": "obj-28",
"maxclass": "newobj",
"numinlets": 1,
"numoutlets": 0,
"patching_rect": [ 218.0, 947.0, 35.0, 22.0 ],
"text": "out 3"
}
}
],
"lines": [
{
"patchline": {
"destination": [ "obj-24", 0 ],
"source": [ "obj-17", 0 ]
}
},
{
"patchline": {
"destination": [ "obj-25", 0 ],
"source": [ "obj-17", 3 ]
}
},
{
"patchline": {
"destination": [ "obj-26", 0 ],
"source": [ "obj-17", 4 ]
}
},
{
"patchline": {
"destination": [ "obj-27", 0 ],
"source": [ "obj-17", 1 ]
}
},
{
"patchline": {
"destination": [ "obj-28", 0 ],
"source": [ "obj-17", 2 ]
}
},
{
"patchline": {
"destination": [ "obj-17", 0 ],
"source": [ "obj-21", 0 ]
}
},
{
"patchline": {
"destination": [ "obj-17", 1 ],
"source": [ "obj-22", 0 ]
}
},
{
"patchline": {
"destination": [ "obj-17", 2 ],
"source": [ "obj-23", 0 ]
}
}
]
},
"patching_rect": [ 77.0, 261.0, 128.60000000000002, 22.0 ],
"text": "gen @title filtercoeff"
}
},
{
"box": {
"id": "obj-16",
"maxclass": "newobj",
"numinlets": 6,
"numoutlets": 1,
"outlettype": [ "" ],
"patcher": {
"fileversion": 1,
"appversion": {
"major": 9,
"minor": 1,
"revision": 0,
"architecture": "x64",
"modernui": 1
},
"classnamespace": "dsp.gen",
"rect": [ 59.0, 125.0, 1000.0, 780.0 ],
"boxes": [
{
"box": {
"code": "// ----- state (delay memory) -----\nHistory x1(0); // x[n-1]\nHistory x2(0); // x[n-2]\nHistory y1(0); // y[n-1]\nHistory y2(0); // y[n-2]\n\n// ----- per-sample processing -----\ninSig = in1;\n\n// coefficients from inlets\nb0 = in2;\nb1 = in3;\nb2 = in4;\na1 = in5;\na2 = in6;\n\n// difference equation:\n// y[n] = b0*x[n] + b1*x[n-1] + b2*x[n-2] - a1*y[n-1] - a2*y[n-2]\ny = b0 * inSig\n + b1 * x1\n + b2 * x2\n - a1 * y1\n - a2 * y2;\n\n// update state for next sample\nx2 = x1;\nx1 = inSig;\ny2 = y1;\ny1 = y;\n\n// output\nout1 = y;\n",
"fontface": 0,
"fontname": "Menlo Regular",
"fontsize": 12.0,
"id": "obj-3",
"maxclass": "codebox",
"numinlets": 6,
"numoutlets": 1,
"outlettype": [ "" ],
"patching_rect": [ 50.0, 100.0, 444.0, 391.0 ]
}
},
{
"box": {
"id": "obj-9",
"maxclass": "newobj",
"numinlets": 0,
"numoutlets": 1,
"outlettype": [ "" ],
"patching_rect": [ 50.0, 40.0, 28.0, 22.0 ],
"text": "in 1"
}
},
{
"box": {
"id": "obj-10",
"maxclass": "newobj",
"numinlets": 0,
"numoutlets": 1,
"outlettype": [ "" ],
"patching_rect": [ 135.0, 40.0, 28.0, 22.0 ],
"text": "in 2"
}
},
{
"box": {
"id": "obj-11",
"maxclass": "newobj",
"numinlets": 0,
"numoutlets": 1,
"outlettype": [ "" ],
"patching_rect": [ 220.0, 40.0, 28.0, 22.0 ],
"text": "in 3"
}
},
{
"box": {
"id": "obj-12",
"maxclass": "newobj",
"numinlets": 0,
"numoutlets": 1,
"outlettype": [ "" ],
"patching_rect": [ 305.0, 40.0, 28.0, 22.0 ],
"text": "in 4"
}
},
{
"box": {
"id": "obj-13",
"maxclass": "newobj",
"numinlets": 0,
"numoutlets": 1,
"outlettype": [ "" ],
"patching_rect": [ 390.0, 40.0, 28.0, 22.0 ],
"text": "in 5"
}
},
{
"box": {
"id": "obj-14",
"maxclass": "newobj",
"numinlets": 0,
"numoutlets": 1,
"outlettype": [ "" ],
"patching_rect": [ 475.0, 40.0, 28.0, 22.0 ],
"text": "in 6"
}
},
{
"box": {
"id": "obj-15",
"maxclass": "newobj",
"numinlets": 1,
"numoutlets": 0,
"patching_rect": [ 50.0, 551.0, 35.0, 22.0 ],
"text": "out 1"
}
}
],
"lines": [
{
"patchline": {
"destination": [ "obj-3", 1 ],
"source": [ "obj-10", 0 ]
}
},
{
"patchline": {
"destination": [ "obj-3", 2 ],
"source": [ "obj-11", 0 ]
}
},
{
"patchline": {
"destination": [ "obj-3", 3 ],
"source": [ "obj-12", 0 ]
}
},
{
"patchline": {
"destination": [ "obj-3", 4 ],
"source": [ "obj-13", 0 ]
}
},
{
"patchline": {
"destination": [ "obj-3", 5 ],
"source": [ "obj-14", 0 ]
}
},
{
"patchline": {
"destination": [ "obj-15", 0 ],
"source": [ "obj-3", 0 ]
}
},
{
"patchline": {
"destination": [ "obj-3", 0 ],
"source": [ "obj-9", 0 ]
}
}
]
},
"patching_rect": [ 50.0, 305.0, 155.0, 22.0 ],
"text": "gen @title biquad"
}
},
{
"box": {
"id": "obj-37",
"maxclass": "newobj",
"numinlets": 0,
"numoutlets": 1,
"outlettype": [ "" ],
"patching_rect": [ 50.0, 40.0, 28.0, 22.0 ],
"text": "in 1"
}
},
{
"box": {
"id": "obj-38",
"maxclass": "newobj",
"numinlets": 0,
"numoutlets": 1,
"outlettype": [ "" ],
"patching_rect": [ 132.0, 40.0, 28.0, 22.0 ],
"text": "in 2"
}
},
{
"box": {
"id": "obj-39",
"maxclass": "newobj",
"numinlets": 1,
"numoutlets": 0,
"patching_rect": [ 50.0, 346.0, 35.0, 22.0 ],
"text": "out 1"
}
}
],
"lines": [
{
"patchline": {
"destination": [ "obj-29", 0 ],
"source": [ "obj-1", 0 ]
}
},
{
"patchline": {
"destination": [ "obj-39", 0 ],
"source": [ "obj-16", 0 ]
}
},
{
"patchline": {
"destination": [ "obj-31", 0 ],
"source": [ "obj-25", 0 ]
}
},
{
"patchline": {
"destination": [ "obj-16", 5 ],
"source": [ "obj-29", 4 ]
}
},
{
"patchline": {
"destination": [ "obj-16", 4 ],
"source": [ "obj-29", 3 ]
}
},
{
"patchline": {
"destination": [ "obj-16", 3 ],
"source": [ "obj-29", 2 ]
}
},
{
"patchline": {
"destination": [ "obj-16", 2 ],
"source": [ "obj-29", 1 ]
}
},
{
"patchline": {
"destination": [ "obj-16", 1 ],
"source": [ "obj-29", 0 ]
}
},
{
"patchline": {
"destination": [ "obj-36", 0 ],
"source": [ "obj-31", 0 ]
}
},
{
"patchline": {
"destination": [ "obj-29", 1 ],
"source": [ "obj-36", 0 ]
}
},
{
"patchline": {
"destination": [ "obj-16", 0 ],
"source": [ "obj-37", 0 ]
}
},
{
"patchline": {
"destination": [ "obj-25", 0 ],
"source": [ "obj-38", 0 ]
}
},
{
"patchline": {
"destination": [ "obj-29", 2 ],
"source": [ "obj-4", 0 ]
}
}
]
},
"patching_rect": [ 53.0, 391.0, 233.0, 22.0 ],
"text": "gen @title 800Hz~"
}
},
{
"box": {
"id": "obj-43",
"maxclass": "newobj",
"numinlets": 2,
"numoutlets": 1,
"outlettype": [ "" ],
"patcher": {
"fileversion": 1,
"appversion": {
"major": 9,
"minor": 1,
"revision": 0,
"architecture": "x64",
"modernui": 1
},
"classnamespace": "dsp.gen",
"rect": [ 59.0, 125.0, 415.0, 463.0 ],
"boxes": [
{
"box": {
"id": "obj-4",
"maxclass": "newobj",
"numinlets": 0,
"numoutlets": 1,
"outlettype": [ "" ],
"patching_rect": [ 186.5, 223.0, 69.0, 22.0 ],
"text": "param q3 1"
}
},
{
"box": {
"id": "obj-1",
"maxclass": "newobj",
"numinlets": 0,
"numoutlets": 1,
"outlettype": [ "" ],
"patching_rect": [ 77.0, 223.0, 79.0, 22.0 ],
"text": "param f3 400"
}
},
{
"box": {
"id": "obj-36",
"maxclass": "newobj",
"numinlets": 1,
"numoutlets": 1,
"outlettype": [ "" ],
"patcher": {
"fileversion": 1,
"appversion": {
"major": 9,
"minor": 1,
"revision": 0,
"architecture": "x64",
"modernui": 1
},
"classnamespace": "dsp.gen",
"rect": [ 0.0, 0.0, 1000.0, 780.0 ],
"boxes": [
{
"box": {
"code": "// gen~ codebox version\nParam time(10); // ramp time in ms\nHistory state(0);\n\n// compute smoothing coefficient\n// gen~ uses samples, so we convert ms to coeff\ncoeff = exp(-1 / (time * samplerate * 0.001));\n\n// smooth toward input\nout = mix(in1, state, coeff);\nstate = out;",
"fontface": 0,
"fontname": "Menlo Regular",
"fontsize": 12.0,
"id": "obj-242",
"maxclass": "codebox",
"numinlets": 1,
"numoutlets": 1,
"outlettype": [ "" ],
"patching_rect": [ 50.0, 100.0, 441.0, 207.0 ]
}
},
{
"box": {
"id": "obj-34",
"maxclass": "newobj",
"numinlets": 0,
"numoutlets": 1,
"outlettype": [ "" ],
"patching_rect": [ 50.0, 40.0, 28.0, 22.0 ],
"text": "in 1"
}
},
{
"box": {
"id": "obj-35",
"maxclass": "newobj",
"numinlets": 1,
"numoutlets": 0,
"patching_rect": [ 50.0, 367.0, 35.0, 22.0 ],
"text": "out 1"
}
}
],
"lines": [
{
"patchline": {
"destination": [ "obj-35", 0 ],
"source": [ "obj-242", 0 ]
}
},
{
"patchline": {
"destination": [ "obj-242", 0 ],
"source": [ "obj-34", 0 ]
}
}
]
},
"patching_rect": [ 132.0, 175.0, 89.0, 22.0 ],
"text": "gen @title fade"
}
},
{
"box": {
"id": "obj-25",
"maxclass": "newobj",
"numinlets": 1,
"numoutlets": 1,
"outlettype": [ "" ],
"patching_rect": [ 132.0, 100.0, 151.0, 22.0 ],
"text": "scale -100. 100. -18. 18. 1."
}
},
{
"box": {
"id": "obj-31",
"maxclass": "newobj",
"numinlets": 1,
"numoutlets": 1,
"outlettype": [ "" ],
"patching_rect": [ 132.0, 139.0, 39.0, 22.0 ],
"text": "dbtoa"
}
},
{
"box": {
"id": "obj-29",
"maxclass": "newobj",
"numinlets": 3,
"numoutlets": 5,
"outlettype": [ "", "", "", "", "" ],
"patcher": {
"fileversion": 1,
"appversion": {
"major": 9,
"minor": 1,
"revision": 0,
"architecture": "x64",
"modernui": 1
},
"classnamespace": "dsp.gen",
"rect": [ 134.0, 157.0, 1078.0, 978.0 ],
"boxes": [
{
"box": {
"code": "// -----------------------------------------------------\n// Peak/Notch (Peaking EQ) biquad coefficient generator\n//\n// Inlets:\n// in1 = frequency (Hz)\n// in2 = gain (dB, boost/cut)\n// in3 = Q\n//\n// Outlets:\n// out1 = b0\n// out2 = b1\n// out3 = b2\n// out4 = a1\n// out5 = a2\n// -----------------------------------------------------\n\nfreq = max(1, in1);\n//gainDB = in2;\ngain = in2;\r\nQ = max(0.0001, in3);\n\n// Convert gain from dB → amplitude ratio\n//A = pow(10, gainDB / 40);\nA = sqrt(gain);\r\n\n// Angular frequency\nw0 = twopi * freq / samplerate;\ncosw = cos(w0);\nsinw = sin(w0);\n\n// alpha controls the bandwidth\nalpha = sinw / (2 * Q);\n\n// -----------------------------------------------------\n// RBJ Peaking EQ formulas\n//\n// b0 = 1 + alpha*A\n// b1 = -2*cos(w0)\n// b2 = 1 - alpha*A\n//\n// a0 = 1 + alpha/A\n// a1 = -2*cos(w0)\n// a2 = 1 - alpha/A\n// -----------------------------------------------------\n\nb0 = 1 + alpha * A;\nb1 = -2 * cosw;\nb2 = 1 - alpha * A;\n\na0 = 1 + alpha / A;\na1 = -2 * cosw;\na2 = 1 - alpha / A;\n\n// Normalize by a0\nb0 /= a0;\nb1 /= a0;\nb2 /= a0;\na1 /= a0;\na2 /= a0;\n\n// Outputs\nout1 = b0;\nout2 = b1;\nout3 = b2;\nout4 = a1;\nout5 = a2;\n",
"fontface": 0,
"fontname": "Menlo Regular",
"fontsize": 12.0,
"id": "obj-17",
"maxclass": "codebox",
"numinlets": 3,
"numoutlets": 5,
"outlettype": [ "", "", "", "", "" ],
"patching_rect": [ 50.0, 118.0, 356.0, 794.0 ]
}
},
{
"box": {
"id": "obj-21",
"maxclass": "newobj",
"numinlets": 0,
"numoutlets": 1,
"outlettype": [ "" ],
"patching_rect": [ 50.0, 13.0, 269.0, 22.0 ],
"text": "in 1 @comment frequency @default 100 @min 0"
}
},
{
"box": {
"id": "obj-22",
"maxclass": "newobj",
"numinlets": 0,
"numoutlets": 1,
"outlettype": [ "" ],
"patching_rect": [ 218.5, 47.0, 225.0, 22.0 ],
"text": "in 2 @comment gain @default 1 @min 0"
}
},
{
"box": {
"id": "obj-23",
"maxclass": "newobj",
"numinlets": 0,
"numoutlets": 1,
"outlettype": [ "" ],
"patching_rect": [ 387.0, 76.0, 178.0, 22.0 ],
"text": "in 3 @default 1 @min 0.000001"
}
},
{
"box": {
"id": "obj-24",
"maxclass": "newobj",
"numinlets": 1,
"numoutlets": 0,
"patching_rect": [ 50.0, 947.0, 35.0, 22.0 ],
"text": "out 1"
}
},
{
"box": {
"id": "obj-25",
"maxclass": "newobj",
"numinlets": 1,
"numoutlets": 0,
"patching_rect": [ 303.0, 947.0, 35.0, 22.0 ],
"text": "out 4"
}
},
{
"box": {
"id": "obj-26",
"maxclass": "newobj",
"numinlets": 1,
"numoutlets": 0,
"patching_rect": [ 387.0, 947.0, 35.0, 22.0 ],
"text": "out 5"
}
},
{
"box": {
"id": "obj-27",
"maxclass": "newobj",
"numinlets": 1,
"numoutlets": 0,
"patching_rect": [ 134.0, 947.0, 35.0, 22.0 ],
"text": "out 2"
}
},
{
"box": {
"id": "obj-28",
"maxclass": "newobj",
"numinlets": 1,
"numoutlets": 0,
"patching_rect": [ 218.0, 947.0, 35.0, 22.0 ],
"text": "out 3"
}
}
],
"lines": [
{
"patchline": {
"destination": [ "obj-24", 0 ],
"source": [ "obj-17", 0 ]
}
},
{
"patchline": {
"destination": [ "obj-25", 0 ],
"source": [ "obj-17", 3 ]
}
},
{
"patchline": {
"destination": [ "obj-26", 0 ],
"source": [ "obj-17", 4 ]
}
},
{
"patchline": {
"destination": [ "obj-27", 0 ],
"source": [ "obj-17", 1 ]
}
},
{
"patchline": {
"destination": [ "obj-28", 0 ],
"source": [ "obj-17", 2 ]
}
},
{
"patchline": {
"destination": [ "obj-17", 0 ],
"source": [ "obj-21", 0 ]
}
},
{
"patchline": {
"destination": [ "obj-17", 1 ],
"source": [ "obj-22", 0 ]
}
},
{
"patchline": {
"destination": [ "obj-17", 2 ],
"source": [ "obj-23", 0 ]
}
}
]
},
"patching_rect": [ 77.0, 264.0, 128.60000000000002, 22.0 ],
"text": "gen @title filtercoeff"
}
},
{
"box": {
"id": "obj-16",
"maxclass": "newobj",
"numinlets": 6,
"numoutlets": 1,
"outlettype": [ "" ],
"patcher": {
"fileversion": 1,
"appversion": {
"major": 9,
"minor": 1,
"revision": 0,
"architecture": "x64",
"modernui": 1
},
"classnamespace": "dsp.gen",
"rect": [ 0.0, 0.0, 1000.0, 780.0 ],
"boxes": [
{
"box": {
"code": "// ----- state (delay memory) -----\nHistory x1(0); // x[n-1]\nHistory x2(0); // x[n-2]\nHistory y1(0); // y[n-1]\nHistory y2(0); // y[n-2]\n\n// ----- per-sample processing -----\ninSig = in1;\n\n// coefficients from inlets\nb0 = in2;\nb1 = in3;\nb2 = in4;\na1 = in5;\na2 = in6;\n\n// difference equation:\n// y[n] = b0*x[n] + b1*x[n-1] + b2*x[n-2] - a1*y[n-1] - a2*y[n-2]\ny = b0 * inSig\n + b1 * x1\n + b2 * x2\n - a1 * y1\n - a2 * y2;\n\n// update state for next sample\nx2 = x1;\nx1 = inSig;\ny2 = y1;\ny1 = y;\n\n// output\nout1 = y;\n",
"fontface": 0,
"fontname": "Menlo Regular",
"fontsize": 12.0,
"id": "obj-3",
"maxclass": "codebox",
"numinlets": 6,
"numoutlets": 1,
"outlettype": [ "" ],
"patching_rect": [ 50.0, 100.0, 444.0, 391.0 ]
}
},
{
"box": {
"id": "obj-9",
"maxclass": "newobj",
"numinlets": 0,
"numoutlets": 1,
"outlettype": [ "" ],
"patching_rect": [ 50.0, 40.0, 28.0, 22.0 ],
"text": "in 1"
}
},
{
"box": {
"id": "obj-10",
"maxclass": "newobj",
"numinlets": 0,
"numoutlets": 1,
"outlettype": [ "" ],
"patching_rect": [ 135.0, 40.0, 28.0, 22.0 ],
"text": "in 2"
}
},
{
"box": {
"id": "obj-11",
"maxclass": "newobj",
"numinlets": 0,
"numoutlets": 1,
"outlettype": [ "" ],
"patching_rect": [ 220.0, 40.0, 28.0, 22.0 ],
"text": "in 3"
}
},
{
"box": {
"id": "obj-12",
"maxclass": "newobj",
"numinlets": 0,
"numoutlets": 1,
"outlettype": [ "" ],
"patching_rect": [ 305.0, 40.0, 28.0, 22.0 ],
"text": "in 4"
}
},
{
"box": {
"id": "obj-13",
"maxclass": "newobj",
"numinlets": 0,
"numoutlets": 1,
"outlettype": [ "" ],
"patching_rect": [ 390.0, 40.0, 28.0, 22.0 ],
"text": "in 5"
}
},
{
"box": {
"id": "obj-14",
"maxclass": "newobj",
"numinlets": 0,
"numoutlets": 1,
"outlettype": [ "" ],
"patching_rect": [ 475.0, 40.0, 28.0, 22.0 ],
"text": "in 6"
}
},
{
"box": {
"id": "obj-15",
"maxclass": "newobj",
"numinlets": 1,
"numoutlets": 0,
"patching_rect": [ 50.0, 551.0, 35.0, 22.0 ],
"text": "out 1"
}
}
],
"lines": [
{
"patchline": {
"destination": [ "obj-3", 1 ],
"source": [ "obj-10", 0 ]
}
},
{
"patchline": {
"destination": [ "obj-3", 2 ],
"source": [ "obj-11", 0 ]
}
},
{
"patchline": {
"destination": [ "obj-3", 3 ],
"source": [ "obj-12", 0 ]
}
},
{
"patchline": {
"destination": [ "obj-3", 4 ],
"source": [ "obj-13", 0 ]
}
},
{
"patchline": {
"destination": [ "obj-3", 5 ],
"source": [ "obj-14", 0 ]
}
},
{
"patchline": {
"destination": [ "obj-15", 0 ],
"source": [ "obj-3", 0 ]
}
},
{
"patchline": {
"destination": [ "obj-3", 0 ],
"source": [ "obj-9", 0 ]
}
}
]
},
"patching_rect": [ 50.0, 308.0, 155.0, 22.0 ],
"text": "gen @title biquad"
}
},
{
"box": {
"id": "obj-37",
"maxclass": "newobj",
"numinlets": 0,
"numoutlets": 1,
"outlettype": [ "" ],
"patching_rect": [ 50.0, 40.0, 28.0, 22.0 ],
"text": "in 1"
}
},
{
"box": {
"id": "obj-38",
"maxclass": "newobj",
"numinlets": 0,
"numoutlets": 1,
"outlettype": [ "" ],
"patching_rect": [ 132.0, 40.0, 28.0, 22.0 ],
"text": "in 2"
}
},
{
"box": {
"id": "obj-39",
"maxclass": "newobj",
"numinlets": 1,
"numoutlets": 0,
"patching_rect": [ 50.0, 346.0, 35.0, 22.0 ],
"text": "out 1"
}
}
],
"lines": [
{
"patchline": {
"destination": [ "obj-29", 0 ],
"source": [ "obj-1", 0 ]
}
},
{
"patchline": {
"destination": [ "obj-39", 0 ],
"source": [ "obj-16", 0 ]
}
},
{
"patchline": {
"destination": [ "obj-31", 0 ],
"source": [ "obj-25", 0 ]
}
},
{
"patchline": {
"destination": [ "obj-16", 5 ],
"source": [ "obj-29", 4 ]
}
},
{
"patchline": {
"destination": [ "obj-16", 4 ],
"source": [ "obj-29", 3 ]
}
},
{
"patchline": {
"destination": [ "obj-16", 3 ],
"source": [ "obj-29", 2 ]
}
},
{
"patchline": {
"destination": [ "obj-16", 2 ],
"source": [ "obj-29", 1 ]
}
},
{
"patchline": {
"destination": [ "obj-16", 1 ],
"source": [ "obj-29", 0 ]
}
},
{
"patchline": {
"destination": [ "obj-36", 0 ],
"source": [ "obj-31", 0 ]
}
},
{
"patchline": {
"destination": [ "obj-29", 1 ],
"source": [ "obj-36", 0 ]
}
},
{
"patchline": {
"destination": [ "obj-16", 0 ],
"source": [ "obj-37", 0 ]
}
},
{
"patchline": {
"destination": [ "obj-25", 0 ],
"source": [ "obj-38", 0 ]
}
},
{
"patchline": {
"destination": [ "obj-29", 2 ],
"source": [ "obj-4", 0 ]
}
}
]
},
"patching_rect": [ 53.0, 293.0, 233.0, 22.0 ],
"text": "gen @title 400Hz~"
}
},
{
"box": {
"id": "obj-38",
"maxclass": "newobj",
"numinlets": 0,
"numoutlets": 1,
"outlettype": [ "" ],
"patching_rect": [ 267.0, 638.0, 279.0, 22.0 ],
"text": "param _6400Hz @default 0 @min -100 @max 100",
"varname": "6.4kHz"
}
},
{
"box": {
"id": "obj-41",
"maxclass": "newobj",
"numinlets": 0,
"numoutlets": 1,
"outlettype": [ "" ],
"patching_rect": [ 267.0, 542.0, 279.0, 22.0 ],
"text": "param _3200Hz @default 0 @min -100 @max 100",
"varname": "3.2kHz"
}
},
{
"box": {
"id": "obj-42",
"maxclass": "newobj",
"numinlets": 0,
"numoutlets": 1,
"outlettype": [ "" ],
"patching_rect": [ 267.0, 432.0, 279.0, 22.0 ],
"text": "param _1600Hz @default 0 @min -100 @max 100",
"varname": "1.6kHz"
}
},
{
"box": {
"id": "obj-34",
"maxclass": "newobj",
"numinlets": 0,
"numoutlets": 1,
"outlettype": [ "" ],
"patching_rect": [ 267.0, 338.0, 273.0, 22.0 ],
"text": "param _800Hz @default 0 @min -100 @max 100",
"varname": "800Hz"
}
},
{
"box": {
"id": "obj-30",
"maxclass": "newobj",
"numinlets": 0,
"numoutlets": 1,
"outlettype": [ "" ],
"patching_rect": [ 267.0, 239.0, 273.0, 22.0 ],
"text": "param _400Hz @default 0 @min -100 @max 100",
"varname": "400Hz"
}
},
{
"box": {
"id": "obj-23",
"maxclass": "newobj",
"numinlets": 0,
"numoutlets": 1,
"outlettype": [ "" ],
"patching_rect": [ 267.0, 132.0, 273.0, 22.0 ],
"text": "param _200Hz @default 0 @min -100 @max 100",
"varname": "200Hz"
}
},
{
"box": {
"id": "obj-18",
"maxclass": "newobj",
"numinlets": 0,
"numoutlets": 1,
"outlettype": [ "" ],
"patching_rect": [ 267.0, 32.0, 273.0, 22.0 ],
"text": "param _100Hz @default 0 @min -100 @max 100",
"varname": "100Hz"
}
},
{
"box": {
"id": "obj-69",
"maxclass": "newobj",
"numinlets": 0,
"numoutlets": 1,
"outlettype": [ "" ],
"patching_rect": [ 267.0, 732.0, 256.0, 22.0 ],
"text": "param level @default 0 @min -100 @max 100",
"varname": "level"
}
},
{
"box": {
"id": "obj-40",
"maxclass": "newobj",
"numinlets": 2,
"numoutlets": 1,
"outlettype": [ "" ],
"patcher": {
"fileversion": 1,
"appversion": {
"major": 9,
"minor": 1,
"revision": 0,
"architecture": "x64",
"modernui": 1
},
"classnamespace": "dsp.gen",
"rect": [ 399.0, 338.0, 610.0, 484.0 ],
"boxes": [
{
"box": {
"id": "obj-4",
"maxclass": "newobj",
"numinlets": 0,
"numoutlets": 1,
"outlettype": [ "" ],
"patching_rect": [ 186.5, 223.0, 69.0, 22.0 ],
"text": "param q1 1"
}
},
{
"box": {
"id": "obj-1",
"maxclass": "newobj",
"numinlets": 0,
"numoutlets": 1,
"outlettype": [ "" ],
"patching_rect": [ 77.5, 223.0, 79.0, 22.0 ],
"text": "param f1 100"
}
},
{
"box": {
"id": "obj-36",
"maxclass": "newobj",
"numinlets": 1,
"numoutlets": 1,
"outlettype": [ "" ],
"patcher": {
"fileversion": 1,
"appversion": {
"major": 9,
"minor": 1,
"revision": 0,
"architecture": "x64",
"modernui": 1
},
"classnamespace": "dsp.gen",
"rect": [ 0.0, 0.0, 1000.0, 780.0 ],
"boxes": [
{
"box": {
"code": "// gen~ codebox version\nParam time(10); // ramp time in ms\nHistory state(0);\n\n// compute smoothing coefficient\n// gen~ uses samples, so we convert ms to coeff\ncoeff = exp(-1 / (time * samplerate * 0.001));\n\n// smooth toward input\nout = mix(in1, state, coeff);\nstate = out;",
"fontface": 0,
"fontname": "Menlo Regular",
"fontsize": 12.0,
"id": "obj-242",
"maxclass": "codebox",
"numinlets": 1,
"numoutlets": 1,
"outlettype": [ "" ],
"patching_rect": [ 50.0, 100.0, 441.0, 207.0 ]
}
},
{
"box": {
"id": "obj-34",
"maxclass": "newobj",
"numinlets": 0,
"numoutlets": 1,
"outlettype": [ "" ],
"patching_rect": [ 50.0, 40.0, 28.0, 22.0 ],
"text": "in 1"
}
},
{
"box": {
"id": "obj-35",
"maxclass": "newobj",
"numinlets": 1,
"numoutlets": 0,
"patching_rect": [ 50.0, 367.0, 35.0, 22.0 ],
"text": "out 1"
}
}
],
"lines": [
{
"patchline": {
"destination": [ "obj-35", 0 ],
"source": [ "obj-242", 0 ]
}
},
{
"patchline": {
"destination": [ "obj-242", 0 ],
"source": [ "obj-34", 0 ]
}
}
]
},
"patching_rect": [ 132.0, 175.0, 89.0, 22.0 ],
"text": "gen @title fade"
}
},
{
"box": {
"id": "obj-25",
"maxclass": "newobj",
"numinlets": 1,
"numoutlets": 1,
"outlettype": [ "" ],
"patching_rect": [ 132.0, 100.0, 151.0, 22.0 ],
"text": "scale -100. 100. -18. 18. 1."
}
},
{
"box": {
"id": "obj-31",
"maxclass": "newobj",
"numinlets": 1,
"numoutlets": 1,
"outlettype": [ "" ],
"patching_rect": [ 132.0, 139.0, 39.0, 22.0 ],
"text": "dbtoa"
}
},
{
"box": {
"id": "obj-29",
"maxclass": "newobj",
"numinlets": 3,
"numoutlets": 5,
"outlettype": [ "", "", "", "", "" ],
"patcher": {
"fileversion": 1,
"appversion": {
"major": 9,
"minor": 1,
"revision": 0,
"architecture": "x64",
"modernui": 1
},
"classnamespace": "dsp.gen",
"rect": [ 134.0, 157.0, 1078.0, 978.0 ],
"boxes": [
{
"box": {
"code": "// -------------------------------\n// LOWSHELF biquad coefficient generator\n// Inputs:\n// in1 = frequency (Hz)\n// in2 = gain (dB)\n// in3 = Q (slope / quality)\n//\n// Outputs:\n// out1 = b0\n// out2 = b1\n// out3 = b2\n// out4 = a1\n// out5 = a2\n// -------------------------------\n\n// ensure safe values\nfreq = max(1, in1);\n//gainDB = in2;\r\ngain = in2;\r\nQ = max(0.0001, in3);\n\n// convert gain from dB → linear amplitude\n//A = pow(10, gainDB / 40);\nA = sqrt(gain); \n\n// core omega values\nw0 = twopi * freq / samplerate;\ncosw = cos(w0);\nsinw = sin(w0);\n\n// RBJ definition of \"alpha\" for shelving EQs:\n// alpha = sin(w0) / (2*Q) * sqrt( (A + 1/A) )\nalpha = sinw / (2 * Q) * sqrt(A + 1/A);\n\n// precompute helpers\ntwosqrtAalpha = 2 * sqrt(A) * alpha;\n\n// -------------------------------\n// raw (unnormalized) coefficients\n//\n// Reference: RBJ Audio EQ Cookbook — Low Shelf\n//\n// b0 = A[(A+1) - (A1)cos(w0) + twosqrtAalpha]\n// b1 = 2A[(A1) - (A+1)cos(w0)]\n// b2 = A[(A+1) - (A1)cos(w0) - twosqrtAalpha]\n// a0 = (A+1) + (A1)cos(w0) + twosqrtAalpha\n// a1 = -2[(A1) + (A+1)cos(w0)]\n// a2 = (A+1) + (A1)cos(w0) - twosqrtAalpha\n// -------------------------------\n\nAplus = A + 1;\nAminus = A - 1;\n\nb0 = A * ( Aplus - Aminus * cosw + twosqrtAalpha );\nb1 = 2 * A * ( Aminus - Aplus * cosw );\nb2 = A * ( Aplus - Aminus * cosw - twosqrtAalpha );\n\na0 = ( Aplus + Aminus * cosw + twosqrtAalpha );\na1 = -2 * ( Aminus + Aplus * cosw );\na2 = ( Aplus + Aminus * cosw - twosqrtAalpha );\n\n// -------------------------------\n// normalize coefficients (divide all by a0)\nb0 /= a0;\nb1 /= a0;\nb2 /= a0;\na1 /= a0;\na2 /= a0;\n\n// -------------------------------\n// outputs\nout1 = b0;\nout2 = b1;\nout3 = b2;\nout4 = a1;\nout5 = a2;",
"fontface": 0,
"fontname": "Menlo Regular",
"fontsize": 12.0,
"id": "obj-17",
"maxclass": "codebox",
"numinlets": 3,
"numoutlets": 5,
"outlettype": [ "", "", "", "", "" ],
"patching_rect": [ 50.0, 118.0, 356.0, 794.0 ]
}
},
{
"box": {
"id": "obj-21",
"maxclass": "newobj",
"numinlets": 0,
"numoutlets": 1,
"outlettype": [ "" ],
"patching_rect": [ 50.0, 13.0, 269.0, 22.0 ],
"text": "in 1 @comment frequency @default 100 @min 0"
}
},
{
"box": {
"id": "obj-22",
"maxclass": "newobj",
"numinlets": 0,
"numoutlets": 1,
"outlettype": [ "" ],
"patching_rect": [ 218.5, 47.0, 225.0, 22.0 ],
"text": "in 2 @comment gain @default 1 @min 0"
}
},
{
"box": {
"id": "obj-23",
"maxclass": "newobj",
"numinlets": 0,
"numoutlets": 1,
"outlettype": [ "" ],
"patching_rect": [ 387.0, 76.0, 178.0, 22.0 ],
"text": "in 3 @default 1 @min 0.000001"
}
},
{
"box": {
"id": "obj-24",
"maxclass": "newobj",
"numinlets": 1,
"numoutlets": 0,
"patching_rect": [ 50.0, 947.0, 35.0, 22.0 ],
"text": "out 1"
}
},
{
"box": {
"id": "obj-25",
"maxclass": "newobj",
"numinlets": 1,
"numoutlets": 0,
"patching_rect": [ 303.0, 947.0, 35.0, 22.0 ],
"text": "out 4"
}
},
{
"box": {
"id": "obj-26",
"maxclass": "newobj",
"numinlets": 1,
"numoutlets": 0,
"patching_rect": [ 387.0, 947.0, 35.0, 22.0 ],
"text": "out 5"
}
},
{
"box": {
"id": "obj-27",
"maxclass": "newobj",
"numinlets": 1,
"numoutlets": 0,
"patching_rect": [ 134.0, 947.0, 35.0, 22.0 ],
"text": "out 2"
}
},
{
"box": {
"id": "obj-28",
"maxclass": "newobj",
"numinlets": 1,
"numoutlets": 0,
"patching_rect": [ 218.0, 947.0, 35.0, 22.0 ],
"text": "out 3"
}
}
],
"lines": [
{
"patchline": {
"destination": [ "obj-24", 0 ],
"source": [ "obj-17", 0 ]
}
},
{
"patchline": {
"destination": [ "obj-25", 0 ],
"source": [ "obj-17", 3 ]
}
},
{
"patchline": {
"destination": [ "obj-26", 0 ],
"source": [ "obj-17", 4 ]
}
},
{
"patchline": {
"destination": [ "obj-27", 0 ],
"source": [ "obj-17", 1 ]
}
},
{
"patchline": {
"destination": [ "obj-28", 0 ],
"source": [ "obj-17", 2 ]
}
},
{
"patchline": {
"destination": [ "obj-17", 0 ],
"source": [ "obj-21", 0 ]
}
},
{
"patchline": {
"destination": [ "obj-17", 1 ],
"source": [ "obj-22", 0 ]
}
},
{
"patchline": {
"destination": [ "obj-17", 2 ],
"source": [ "obj-23", 0 ]
}
}
]
},
"patching_rect": [ 78.0, 268.0, 127.5, 22.0 ],
"text": "gen @title filtercoeff"
}
},
{
"box": {
"id": "obj-16",
"maxclass": "newobj",
"numinlets": 6,
"numoutlets": 1,
"outlettype": [ "" ],
"patcher": {
"fileversion": 1,
"appversion": {
"major": 9,
"minor": 1,
"revision": 0,
"architecture": "x64",
"modernui": 1
},
"classnamespace": "dsp.gen",
"rect": [ 85.0, 281.0, 1000.0, 779.0 ],
"boxes": [
{
"box": {
"code": "// ----- state (delay memory) -----\nHistory x1(0); // x[n-1]\nHistory x2(0); // x[n-2]\nHistory y1(0); // y[n-1]\nHistory y2(0); // y[n-2]\n\n// ----- per-sample processing -----\ninSig = in1;\n\n// coefficients from inlets\nb0 = in2;\nb1 = in3;\nb2 = in4;\na1 = in5;\na2 = in6;\n\n// difference equation:\n// y[n] = b0*x[n] + b1*x[n-1] + b2*x[n-2] - a1*y[n-1] - a2*y[n-2]\ny = b0 * inSig\n + b1 * x1\n + b2 * x2\n - a1 * y1\n - a2 * y2;\n\n// update state for next sample\nx2 = x1;\nx1 = inSig;\ny2 = y1;\ny1 = y;\n\n// output\nout1 = y;\n",
"fontface": 0,
"fontname": "Menlo Regular",
"fontsize": 12.0,
"id": "obj-3",
"maxclass": "codebox",
"numinlets": 6,
"numoutlets": 1,
"outlettype": [ "" ],
"patching_rect": [ 50.0, 100.0, 555.0, 533.0 ]
}
},
{
"box": {
"id": "obj-9",
"maxclass": "newobj",
"numinlets": 0,
"numoutlets": 1,
"outlettype": [ "" ],
"patching_rect": [ 50.0, 40.0, 28.0, 22.0 ],
"text": "in 1"
}
},
{
"box": {
"id": "obj-10",
"maxclass": "newobj",
"numinlets": 0,
"numoutlets": 1,
"outlettype": [ "" ],
"patching_rect": [ 157.2, 40.0, 28.0, 22.0 ],
"text": "in 2"
}
},
{
"box": {
"id": "obj-11",
"maxclass": "newobj",
"numinlets": 0,
"numoutlets": 1,
"outlettype": [ "" ],
"patching_rect": [ 264.4, 40.0, 28.0, 22.0 ],
"text": "in 3"
}
},
{
"box": {
"id": "obj-12",
"maxclass": "newobj",
"numinlets": 0,
"numoutlets": 1,
"outlettype": [ "" ],
"patching_rect": [ 371.6, 40.0, 28.0, 22.0 ],
"text": "in 4"
}
},
{
"box": {
"id": "obj-13",
"maxclass": "newobj",
"numinlets": 0,
"numoutlets": 1,
"outlettype": [ "" ],
"patching_rect": [ 478.8, 40.0, 28.0, 22.0 ],
"text": "in 5"
}
},
{
"box": {
"id": "obj-14",
"maxclass": "newobj",
"numinlets": 0,
"numoutlets": 1,
"outlettype": [ "" ],
"patching_rect": [ 586.0, 40.0, 28.0, 22.0 ],
"text": "in 6"
}
},
{
"box": {
"id": "obj-15",
"maxclass": "newobj",
"numinlets": 1,
"numoutlets": 0,
"patching_rect": [ 50.0, 703.0, 35.0, 22.0 ],
"text": "out 1"
}
}
],
"lines": [
{
"patchline": {
"destination": [ "obj-3", 1 ],
"source": [ "obj-10", 0 ]
}
},
{
"patchline": {
"destination": [ "obj-3", 2 ],
"source": [ "obj-11", 0 ]
}
},
{
"patchline": {
"destination": [ "obj-3", 3 ],
"source": [ "obj-12", 0 ]
}
},
{
"patchline": {
"destination": [ "obj-3", 4 ],
"source": [ "obj-13", 0 ]
}
},
{
"patchline": {
"destination": [ "obj-3", 5 ],
"source": [ "obj-14", 0 ]
}
},
{
"patchline": {
"destination": [ "obj-15", 0 ],
"source": [ "obj-3", 0 ]
}
},
{
"patchline": {
"destination": [ "obj-3", 0 ],
"source": [ "obj-9", 0 ]
}
}
]
},
"patching_rect": [ 50.5, 312.0, 155.0, 22.0 ],
"text": "gen @title biquad"
}
},
{
"box": {
"id": "obj-37",
"maxclass": "newobj",
"numinlets": 0,
"numoutlets": 1,
"outlettype": [ "" ],
"patching_rect": [ 50.0, 40.0, 28.0, 22.0 ],
"text": "in 1"
}
},
{
"box": {
"id": "obj-38",
"maxclass": "newobj",
"numinlets": 0,
"numoutlets": 1,
"outlettype": [ "" ],
"patching_rect": [ 132.0, 40.0, 28.0, 22.0 ],
"text": "in 2"
}
},
{
"box": {
"id": "obj-39",
"maxclass": "newobj",
"numinlets": 1,
"numoutlets": 0,
"patching_rect": [ 50.5, 394.0, 35.0, 22.0 ],
"text": "out 1"
}
}
],
"lines": [
{
"patchline": {
"destination": [ "obj-29", 0 ],
"source": [ "obj-1", 0 ]
}
},
{
"patchline": {
"destination": [ "obj-39", 0 ],
"source": [ "obj-16", 0 ]
}
},
{
"patchline": {
"destination": [ "obj-31", 0 ],
"source": [ "obj-25", 0 ]
}
},
{
"patchline": {
"destination": [ "obj-16", 5 ],
"source": [ "obj-29", 4 ]
}
},
{
"patchline": {
"destination": [ "obj-16", 4 ],
"source": [ "obj-29", 3 ]
}
},
{
"patchline": {
"destination": [ "obj-16", 3 ],
"source": [ "obj-29", 2 ]
}
},
{
"patchline": {
"destination": [ "obj-16", 2 ],
"source": [ "obj-29", 1 ]
}
},
{
"patchline": {
"destination": [ "obj-16", 1 ],
"source": [ "obj-29", 0 ]
}
},
{
"patchline": {
"destination": [ "obj-36", 0 ],
"source": [ "obj-31", 0 ]
}
},
{
"patchline": {
"destination": [ "obj-29", 1 ],
"source": [ "obj-36", 0 ]
}
},
{
"patchline": {
"destination": [ "obj-16", 0 ],
"source": [ "obj-37", 0 ]
}
},
{
"patchline": {
"destination": [ "obj-25", 0 ],
"source": [ "obj-38", 0 ]
}
},
{
"patchline": {
"destination": [ "obj-29", 2 ],
"source": [ "obj-4", 0 ]
}
}
]
},
"patching_rect": [ 53.0, 98.0, 233.0, 22.0 ],
"text": "gen @title 100Hz~"
}
},
{
"box": {
"id": "obj-1",
"maxclass": "newobj",
"numinlets": 0,
"numoutlets": 1,
"outlettype": [ "" ],
"patching_rect": [ 53.0, 32.0, 28.0, 22.0 ],
"text": "in 1"
}
},
{
"box": {
"id": "obj-4",
"maxclass": "newobj",
"numinlets": 1,
"numoutlets": 0,
"patching_rect": [ 53.0, 823.0, 35.0, 22.0 ],
"text": "out 1"
}
}
],
"lines": [
{
"patchline": {
"destination": [ "obj-40", 0 ],
"source": [ "obj-1", 0 ]
}
},
{
"patchline": {
"destination": [ "obj-40", 1 ],
"source": [ "obj-18", 0 ]
}
},
{
"patchline": {
"destination": [ "obj-54", 1 ],
"source": [ "obj-23", 0 ]
}
},
{
"patchline": {
"destination": [ "obj-43", 1 ],
"source": [ "obj-30", 0 ]
}
},
{
"patchline": {
"destination": [ "obj-44", 1 ],
"source": [ "obj-34", 0 ]
}
},
{
"patchline": {
"destination": [ "obj-47", 1 ],
"source": [ "obj-38", 0 ]
}
},
{
"patchline": {
"destination": [ "obj-54", 0 ],
"source": [ "obj-40", 0 ]
}
},
{
"patchline": {
"destination": [ "obj-46", 1 ],
"source": [ "obj-41", 0 ]
}
},
{
"patchline": {
"destination": [ "obj-45", 1 ],
"source": [ "obj-42", 0 ]
}
},
{
"patchline": {
"destination": [ "obj-44", 0 ],
"source": [ "obj-43", 0 ]
}
},
{
"patchline": {
"destination": [ "obj-45", 0 ],
"source": [ "obj-44", 0 ]
}
},
{
"patchline": {
"destination": [ "obj-46", 0 ],
"source": [ "obj-45", 0 ]
}
},
{
"patchline": {
"destination": [ "obj-47", 0 ],
"source": [ "obj-46", 0 ]
}
},
{
"patchline": {
"destination": [ "obj-53", 0 ],
"source": [ "obj-47", 0 ]
}
},
{
"patchline": {
"destination": [ "obj-4", 0 ],
"source": [ "obj-53", 0 ]
}
},
{
"patchline": {
"destination": [ "obj-43", 0 ],
"source": [ "obj-54", 0 ]
}
},
{
"patchline": {
"destination": [ "obj-53", 1 ],
"source": [ "obj-69", 0 ]
}
}
],
"autosave": 0
}
}