@audio/effect-subbass 1.1.2 → 1.1.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 +25 -1
  2. package/audio.d.ts +38 -0
  3. package/package.json +13 -4
package/README.md CHANGED
@@ -2,4 +2,28 @@
2
2
 
3
3
  > Psychoacoustic bass enhancer — harmonic synthesis below cutoff (MaxxBass/RBass class)
4
4
 
5
- Planned — not implemented yet. See the umbrella README for status and sources.
5
+ Extracts the band below `freq`, generates its harmonic series with an even/odd waveshaper, band-limits the harmonics to the audible low-mids, and mixes against dry. Small speakers reproduce the harmonics; the ear reconstructs the missing fundamental.
6
+
7
+ ## Install
8
+
9
+ ```
10
+ npm install @audio/effect-subbass
11
+ ```
12
+
13
+ ## Usage
14
+
15
+ ```js
16
+ import subbass from '@audio/effect-subbass'
17
+
18
+ let p = { freq: 80, amount: 0.5, drive: 0.5, keep: 1, fs: 44100 }
19
+ for (let buf of stream) subbass(buf, p)
20
+ ```
21
+
22
+ `subbass(data, params)` mutates `data` (`Float32Array`/`Float64Array`) in place and returns it. Pass the same `params` object across calls — the sub-extraction and harmonic-band filter state persists on it (`_sub`, `_out`, `_dc`).
23
+
24
+ **`freq`** sub cutoff, Hz — harmonics built from below this (default 80) · **`amount`** harmonic level 0–1 (default 0.5) · **`drive`** waveshaper intensity 0–1 (default 0.5) · **`keep`** how much original sub to keep, 0–1, 0 = replace entirely (default 1) · **`fs`** sample rate
25
+
26
+ **Use when**: small-speaker/phone playback, bass on systems that can't reproduce true sub<br>
27
+ **Not for**: sources already reproduced on full-range monitors, general saturation (use `@audio/effect-distortion`)
28
+
29
+ Part of [@audio/effect](https://github.com/audiojs/effect).
package/audio.d.ts ADDED
@@ -0,0 +1,38 @@
1
+ // Generated from the audio.js manifest (params metadata is the source of truth).
2
+ // Regenerate: node tools/dts.js in @audio/compile. Do not edit by hand.
3
+
4
+ /** Automatable number — scalar, `t => value` fn, or breakpoint curve {t, v} */
5
+ type Auto = number | ((t: number) => number) | { t: number[], v: number[] }
6
+ /** Per-block param values as delivered by hosts (numbers arrive as 1-length Float32Array) */
7
+ type Live = Record<string, Float32Array | string | boolean>
8
+ type Ctx = { sampleRate: number, maxBlockSize: number, maxChannels: number, currentTime: number, duration?: number, events?: readonly any[], emit?: (name: string, ...args: any[]) => void, [k: string]: unknown }
9
+ type Process = (inputs: Float32Array[][], outputs: Float32Array[][], params: Live) => void
10
+
11
+ /** Chainable-host options for 'subbass' */
12
+ export interface SubbassOptions {
13
+ /** 30..200 Hz (default 80) */
14
+ "freq"?: Auto
15
+ /** 0..1 (default 0.5) */
16
+ "amount"?: Auto
17
+ /** 0..1 (default 0.5) */
18
+ "drive"?: Auto
19
+ /** 0..1 (default 1) */
20
+ "keep"?: Auto
21
+ at?: number | string
22
+ duration?: number | string
23
+ }
24
+
25
+ export declare const subbass: {
26
+ (ctx: Ctx): Process
27
+ channels: "any"
28
+ params: {
29
+ /** 30..200 Hz (default 80) */
30
+ "freq": { type: "number", default: 80 }
31
+ /** 0..1 (default 0.5) */
32
+ "amount": { type: "number", default: 0.5 }
33
+ /** 0..1 (default 0.5) */
34
+ "drive": { type: "number", default: 0.5 }
35
+ /** 0..1 (default 1) */
36
+ "keep": { type: "number", default: 1 }
37
+ }
38
+ }
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@audio/effect-subbass",
3
- "version": "1.1.2",
3
+ "version": "1.1.4",
4
4
  "description": "Psychoacoustic bass enhancer — harmonic synthesis below cutoff (MaxxBass/RBass class)",
5
5
  "type": "module",
6
6
  "sideEffects": false,
@@ -19,14 +19,23 @@
19
19
  "exports": {
20
20
  ".": "./subbass.js",
21
21
  "./package.json": "./package.json",
22
- "./audio": "./audio.js"
22
+ "./audio": {
23
+ "types": "./audio.d.ts",
24
+ "default": "./audio.js"
25
+ }
23
26
  },
24
27
  "files": [
25
28
  "subbass.js",
26
- "audio.js"
29
+ "audio.js",
30
+ "audio.d.ts"
27
31
  ],
28
32
  "publishConfig": {
29
33
  "access": "public"
30
34
  },
31
- "audio": "./audio.js"
35
+ "audio": "./audio.js",
36
+ "repository": {
37
+ "type": "git",
38
+ "url": "git+https://github.com/audiojs/effect.git",
39
+ "directory": "packages/effect-subbass"
40
+ }
32
41
  }