@audio/dynamics-core 0.1.0 → 0.2.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/index.js +0 -1
- package/package.json +4 -6
- package/biquad.js +0 -24
package/index.js
CHANGED
package/package.json
CHANGED
|
@@ -1,20 +1,18 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@audio/dynamics-core",
|
|
3
|
-
"version": "0.
|
|
4
|
-
"description": "Shared dynamics primitives — dB/linear conversion, time-constant coefficients, stream writers
|
|
3
|
+
"version": "0.2.0",
|
|
4
|
+
"description": "Shared dynamics primitives — dB/linear conversion, time-constant coefficients, stream writers",
|
|
5
5
|
"type": "module",
|
|
6
6
|
"sideEffects": false,
|
|
7
7
|
"main": "index.js",
|
|
8
8
|
"exports": {
|
|
9
9
|
".": "./index.js",
|
|
10
10
|
"./package.json": "./package.json",
|
|
11
|
-
"./util": "./util.js"
|
|
12
|
-
"./biquad": "./biquad.js"
|
|
11
|
+
"./util": "./util.js"
|
|
13
12
|
},
|
|
14
13
|
"files": [
|
|
15
14
|
"index.js",
|
|
16
|
-
"util.js"
|
|
17
|
-
"biquad.js"
|
|
15
|
+
"util.js"
|
|
18
16
|
],
|
|
19
17
|
"keywords": [
|
|
20
18
|
"audio",
|
package/biquad.js
DELETED
|
@@ -1,24 +0,0 @@
|
|
|
1
|
-
// RBJ audio EQ cookbook biquads — only what dynamics-processor needs for
|
|
2
|
-
// sidechain filtering (deesser). For a full filter library see audio-filter.
|
|
3
|
-
|
|
4
|
-
const PI2 = 2 * Math.PI
|
|
5
|
-
|
|
6
|
-
export function bandpass(sr, freq, q) {
|
|
7
|
-
let w0 = PI2 * freq / sr
|
|
8
|
-
let cw = Math.cos(w0)
|
|
9
|
-
let a = Math.sin(w0) / (2 * q)
|
|
10
|
-
let a0 = 1 + a
|
|
11
|
-
return {
|
|
12
|
-
b0: a / a0, b1: 0, b2: -a / a0,
|
|
13
|
-
a1: -2 * cw / a0, a2: (1 - a) / a0,
|
|
14
|
-
}
|
|
15
|
-
}
|
|
16
|
-
|
|
17
|
-
export function biquad(c, s, x) {
|
|
18
|
-
let y = c.b0 * x + c.b1 * s.x1 + c.b2 * s.x2 - c.a1 * s.y1 - c.a2 * s.y2
|
|
19
|
-
s.x2 = s.x1; s.x1 = x
|
|
20
|
-
s.y2 = s.y1; s.y1 = y
|
|
21
|
-
return y
|
|
22
|
-
}
|
|
23
|
-
|
|
24
|
-
export const biquadState = () => ({ x1: 0, x2: 0, y1: 0, y2: 0 })
|