@audio/effect-subbass 1.1.3 → 1.1.5
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 +25 -1
- package/package.json +11 -3
- package/subbass.d.ts +25 -0
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
|
-
|
|
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/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@audio/effect-subbass",
|
|
3
|
-
"version": "1.1.
|
|
3
|
+
"version": "1.1.5",
|
|
4
4
|
"description": "Psychoacoustic bass enhancer — harmonic synthesis below cutoff (MaxxBass/RBass class)",
|
|
5
5
|
"type": "module",
|
|
6
6
|
"sideEffects": false,
|
|
@@ -27,10 +27,18 @@
|
|
|
27
27
|
"files": [
|
|
28
28
|
"subbass.js",
|
|
29
29
|
"audio.js",
|
|
30
|
-
"audio.d.ts"
|
|
30
|
+
"audio.d.ts",
|
|
31
|
+
"subbass.d.ts"
|
|
31
32
|
],
|
|
32
33
|
"publishConfig": {
|
|
33
34
|
"access": "public"
|
|
34
35
|
},
|
|
35
|
-
"
|
|
36
|
+
"types": "subbass.d.ts",
|
|
37
|
+
"audio": "./audio.js",
|
|
38
|
+
"repository": {
|
|
39
|
+
"type": "git",
|
|
40
|
+
"url": "git+https://github.com/audiojs/effect.git",
|
|
41
|
+
"directory": "packages/effect-subbass"
|
|
42
|
+
},
|
|
43
|
+
"funding": "https://github.com/sponsors/audiojs"
|
|
36
44
|
}
|
package/subbass.d.ts
ADDED
|
@@ -0,0 +1,25 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Psychoacoustic bass enhancer (MaxxBass/RBass class) — extracts the band below
|
|
3
|
+
* `freq`, generates its harmonic series with an even/odd waveshaper, band-limits
|
|
4
|
+
* the harmonics to the audible low-mids, and mixes against dry. Small speakers
|
|
5
|
+
* reproduce the harmonics; the ear reconstructs the missing fundamental.
|
|
6
|
+
*/
|
|
7
|
+
export interface SubbassOptions {
|
|
8
|
+
/** sub cutoff, Hz — harmonics built from below this, default 80 */
|
|
9
|
+
freq?: number
|
|
10
|
+
/** harmonic level, 0–1, default 0.5 */
|
|
11
|
+
amount?: number
|
|
12
|
+
/** waveshaper intensity, 0–1, default 0.5 */
|
|
13
|
+
drive?: number
|
|
14
|
+
/** how much original sub to keep, 0–1, 0 = replace entirely, default 1 */
|
|
15
|
+
keep?: number
|
|
16
|
+
/** sample rate, default 44100 */
|
|
17
|
+
fs?: number
|
|
18
|
+
}
|
|
19
|
+
|
|
20
|
+
/**
|
|
21
|
+
* Mutates `data` in place and returns the same reference. Pass the same params
|
|
22
|
+
* object across calls — the sub-extraction and harmonic-band filter state persist
|
|
23
|
+
* on it (`_sub`, `_out`, `_dc`).
|
|
24
|
+
*/
|
|
25
|
+
export default function subbass(data: Float32Array, params?: SubbassOptions): Float32Array
|