@audio/amp-cabinet 1.2.2 → 1.2.3

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.
Files changed (2) hide show
  1. package/cabinet.js +6 -15
  2. package/package.json +7 -2
package/cabinet.js CHANGED
@@ -3,16 +3,7 @@
3
3
  // closed-back 12" cab: 70 Hz highpass, low bump, presence peak, steep rolloff above ~4.5 kHz.
4
4
 
5
5
  import convolve from '@audio/reverb-convolution'
6
- import { lowpass, highpass, peaking } from '@audio/biquad'
7
-
8
- function biquadRun (data, c) {
9
- let x1 = 0, x2 = 0, y1 = 0, y2 = 0
10
- for (let i = 0; i < data.length; i++) {
11
- let x = data[i]
12
- let y = c.b0 * x + c.b1 * x1 + c.b2 * x2 - c.a1 * y1 - c.a2 * y2
13
- x2 = x1; x1 = x; y2 = y1; y1 = data[i] = y
14
- }
15
- }
6
+ import { lowpass, highpass, peaking, process as biquad } from '@audio/biquad'
16
7
 
17
8
  /**
18
9
  * @param {Float32Array} data — mono PCM, processed in place
@@ -20,10 +11,10 @@ function biquadRun (data, c) {
20
11
  */
21
12
  export default function cabinet (data, { fs = 44100, ir, mix = 1 } = {}) {
22
13
  if (ir) return convolve(data, { ir, mix, normalize: true })
23
- biquadRun(data, highpass(70, 0.707, fs))
24
- biquadRun(data, peaking(110, 1, fs, 2))
25
- biquadRun(data, peaking(2400, 1.2, fs, 3))
26
- biquadRun(data, lowpass(4500, 0.707, fs))
27
- biquadRun(data, lowpass(5200, 0.707, fs))
14
+ biquad(data, highpass(70, 0.707, fs))
15
+ biquad(data, peaking(110, 1, fs, 2))
16
+ biquad(data, peaking(2400, 1.2, fs, 3))
17
+ biquad(data, lowpass(4500, 0.707, fs))
18
+ biquad(data, lowpass(5200, 0.707, fs))
28
19
  return data
29
20
  }
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@audio/amp-cabinet",
3
- "version": "1.2.2",
3
+ "version": "1.2.3",
4
4
  "description": "Cabinet simulation — measured-IR convolution (pair with @audio/measure-ir) or classical speaker-sim biquads",
5
5
  "type": "module",
6
6
  "sideEffects": false,
@@ -37,5 +37,10 @@
37
37
  "publishConfig": {
38
38
  "access": "public"
39
39
  },
40
- "audio": "./audio.js"
40
+ "audio": "./audio.js",
41
+ "repository": {
42
+ "type": "git",
43
+ "url": "git+https://github.com/audiojs/amp.git",
44
+ "directory": "packages/amp-cabinet"
45
+ }
41
46
  }