@audio/amp-cabinet 1.2.3 → 1.2.4

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 (3) hide show
  1. package/README.md +35 -0
  2. package/cabinet.d.ts +12 -0
  3. package/package.json +6 -3
package/README.md ADDED
@@ -0,0 +1,35 @@
1
+ # @audio/amp-cabinet [![npm](https://img.shields.io/npm/v/@audio/amp-cabinet)](https://www.npmjs.com/package/@audio/amp-cabinet) [![MIT](https://img.shields.io/badge/MIT-%E0%A5%90-white)](https://github.com/krishnized/license)
2
+
3
+ Cabinet simulation — measured-IR convolution (pair with @audio/measure-ir) or classical speaker-sim biquads
4
+
5
+ ```
6
+ npm install @audio/amp-cabinet
7
+ ```
8
+
9
+ ```js
10
+ import cabinet from '@audio/amp-cabinet'
11
+ ```
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.
14
+
15
+ ```js
16
+ cabinet(data, { fs: 44100 }) // biquad approximation, no IR
17
+ cabinet(data, { fs: 44100, ir: measuredCabinetIr }) // measured IR, accurate path
18
+ ```
19
+
20
+ | Param | Default | |
21
+ |---|---|---|
22
+ | `fs` | `44100` | sample rate |
23
+ | `ir` | *(none)* | measured cabinet impulse response (`Float32Array`); when set, bypasses the biquad chain entirely |
24
+ | `mix` | `1` | 0..1 — wet/dry blend; **only applies to the `ir` path** (the biquad chain ignores it, always fully wet) |
25
+
26
+ **Mutates `data` in place** and returns it (same array reference, not a copy). Mono only. A delta IR (`[1, 0, 0, …]`) is an exact identity through the convolution path — useful for sanity-checking your own IRs.
27
+
28
+ **Use when:** finishing a guitar/bass amp chain — pair after `@audio/amp-tube`.<br>
29
+ **Not for:** room/hall ambience (use `@audio/reverb-*`) — this is a fixed speaker-and-mic coloration, not a spatial reverb.
30
+
31
+ ---
32
+
33
+ Part of the [@audio/amp](https://github.com/audiojs/amp) family.
34
+
35
+ MIT © [audiojs](https://github.com/audiojs)
package/cabinet.d.ts ADDED
@@ -0,0 +1,12 @@
1
+ /** Cabinet simulation — measured-IR convolution, or a classical speaker-sim biquad chain without one. */
2
+ export interface CabinetOptions {
3
+ /** sample rate in Hz, default 44100 */
4
+ fs?: number
5
+ /** measured cabinet impulse response; when set, bypasses the biquad chain entirely */
6
+ ir?: Float32Array
7
+ /** 0..1, wet/dry blend — only applies to the `ir` path; the biquad chain ignores it, default 1 */
8
+ mix?: number
9
+ }
10
+
11
+ /** Process a mono buffer in place; returns the same array. */
12
+ export default function cabinet(data: Float32Array, options?: CabinetOptions): Float32Array
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@audio/amp-cabinet",
3
- "version": "1.2.3",
3
+ "version": "1.2.4",
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,
@@ -16,7 +16,8 @@
16
16
  "files": [
17
17
  "cabinet.js",
18
18
  "audio.js",
19
- "audio.d.ts"
19
+ "audio.d.ts",
20
+ "cabinet.d.ts"
20
21
  ],
21
22
  "dependencies": {
22
23
  "@audio/reverb-convolution": "^1.0.0",
@@ -42,5 +43,7 @@
42
43
  "type": "git",
43
44
  "url": "git+https://github.com/audiojs/amp.git",
44
45
  "directory": "packages/amp-cabinet"
45
- }
46
+ },
47
+ "funding": "https://github.com/sponsors/audiojs",
48
+ "types": "cabinet.d.ts"
46
49
  }