@audio/amp-cabinet 1.3.0 → 1.3.1

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/README.md CHANGED
@@ -10,7 +10,7 @@ npm install @audio/amp-cabinet
10
10
  import cabinet from '@audio/amp-cabinet'
11
11
  ```
12
12
 
13
- With an `ir` (capture your own with `@audio/measure-ir`), convolves through `@audio/reverb-convolution` (`normalize: true`, so output level tracks input level regardless of the IR's own loudness) — the accurate path. Without one, a fixed classical speaker-sim biquad chain approximates a closed-back 12" cab: 70 Hz highpass, a low-mid bump, a presence peak around 2.4 kHz, and a steep rolloff above ~4.5 kHz.
13
+ With an `ir` (capture your own with `@audio/measure-ir`), convolves through `@audio/reverb-convolution` (`normalize: true`, so output level tracks input level regardless of the IR's own loudness) — the accurate path. Without one, a fixed classical speaker-sim biquad chain approximates a closed-back 12" cab: 70 Hz highpass, a low-mid bump, a presence peak around 2.4 kHz, and a steep rolloff above ~4.5 kHz. A section's frequency is held at 0.49 of the sample rate (past Nyquist its poles leave the unit circle), so at 8 kHz the rolloff sits at 3.92 kHz.
14
14
 
15
15
  ```js
16
16
  cabinet(data, { fs: 44100 }) // biquad approximation, no IR
package/cabinet.d.ts CHANGED
@@ -14,7 +14,7 @@ export default function cabinet(data: Float32Array, options?: CabinetOptions): F
14
14
  /** A biquad section, normalized (a0 = 1), as `@audio/biquad` makes it. */
15
15
  export interface Section { b0: number; b1: number; b2: number; a1: number; a2: number }
16
16
 
17
- /** The biquad chain's sections at `fs`, in order: 70 Hz highpass, 110 Hz bump, 2.4 kHz peak, 4.5 and 5.2 kHz lowpasses. */
17
+ /** The biquad chain's sections at `fs`, in order: 70 Hz highpass, 110 Hz bump, 2.4 kHz peak, 4.5 and 5.2 kHz lowpasses, each frequency held at 0.49 of `fs`. */
18
18
  export function chain(fs: number): Section[]
19
19
 
20
20
  /** A number as a host gives a processor its values: a 1-length array. */
package/cabinet.js CHANGED
@@ -5,14 +5,19 @@
5
5
  import convolve from '@audio/reverb-convolution'
6
6
  import { lowpass, highpass, peaking, process as biquad } from '@audio/biquad'
7
7
 
8
- /** The biquad chain's sections at `fs`, in order */
9
- export const chain = fs => [
10
- highpass(70, 0.707, fs),
11
- peaking(110, 1, fs, 2),
12
- peaking(2400, 1.2, fs, 3),
13
- lowpass(4500, 0.707, fs),
14
- lowpass(5200, 0.707, fs),
15
- ]
8
+ /** The biquad chain's sections at `fs`, in order, each frequency held at 0.49 of the rate: past Nyquist a section's
9
+ * poles leave the unit circle (the 4.5 and 5.2 kHz lowpasses at rates under 10.4 kHz wrote NaN), the rule every
10
+ * /audio processor of @audio/filter and @audio/eq keeps */
11
+ export const chain = fs => {
12
+ const at = f => Math.min(f, fs * 0.49)
13
+ return [
14
+ highpass(at(70), 0.707, fs),
15
+ peaking(at(110), 1, fs, 2),
16
+ peaking(at(2400), 1.2, fs, 3),
17
+ lowpass(at(4500), 0.707, fs),
18
+ lowpass(at(5200), 0.707, fs),
19
+ ]
20
+ }
16
21
 
17
22
  /**
18
23
  * @param {Float32Array} data — mono PCM, processed in place
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@audio/amp-cabinet",
3
- "version": "1.3.0",
3
+ "version": "1.3.1",
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,