@audio/effect-exciter 1.1.3 → 1.2.0
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 +33 -0
- package/audio.d.ts +3 -1
- package/audio.js +2 -2
- package/exciter.d.ts +19 -0
- package/exciter.js +4 -4
- package/package.json +6 -3
package/README.md
ADDED
|
@@ -0,0 +1,33 @@
|
|
|
1
|
+
# @audio/effect-exciter [](https://www.npmjs.com/package/@audio/effect-exciter) [](https://github.com/krishnized/license)
|
|
2
|
+
|
|
3
|
+
Exciter — psychoacoustic harmonic synthesis for presence/air
|
|
4
|
+
|
|
5
|
+
```
|
|
6
|
+
npm install @audio/effect-exciter
|
|
7
|
+
```
|
|
8
|
+
|
|
9
|
+
```js
|
|
10
|
+
import exciter from '@audio/effect-exciter'
|
|
11
|
+
```
|
|
12
|
+
|
|
13
|
+
Aphex-style aural exciter. Extracts the high band via SVF highpass, runs it through tanh saturation to synthesize harmonics, then mixes the harmonic residue back into the dry signal. Adds perceived "air" and "presence" without EQ boost.
|
|
14
|
+
|
|
15
|
+
**`fc`** highpass cutoff Hz (default 3000; `freq` still accepted) · **`drive`** saturation amount 0–1 (default 0.5, maps to 1–10× gain) · **`amount`** mix-in level 0–1 (default 0.5) · **`fs`** sample rate
|
|
16
|
+
|
|
17
|
+
```js
|
|
18
|
+
import exciter from '@audio/effect-exciter'
|
|
19
|
+
|
|
20
|
+
let p = { fc: 4000, drive: 0.6, amount: 0.4, fs: 44100 }
|
|
21
|
+
for (let buf of stream) exciter(buf, p)
|
|
22
|
+
```
|
|
23
|
+
|
|
24
|
+
**Use when**: dull vocals, lifeless cymbals, mastering polish, restoring high-end after compression<br>
|
|
25
|
+
**Not for**: spectral shaping (use a shelf/EQ from `@audio/filter`) — exciter *adds* harmonics, not gain
|
|
26
|
+
|
|
27
|
+
<!--  -->
|
|
28
|
+
|
|
29
|
+
---
|
|
30
|
+
|
|
31
|
+
Part of [@audio/effect](https://github.com/audiojs/effect) — the effect family umbrella. This README is generated from the umbrella docs.
|
|
32
|
+
|
|
33
|
+
MIT © [audiojs](https://github.com/audiojs)
|
package/audio.d.ts
CHANGED
|
@@ -11,6 +11,8 @@ type Process = (inputs: Float32Array[][], outputs: Float32Array[][], params: Liv
|
|
|
11
11
|
/** Chainable-host options for 'exciter' */
|
|
12
12
|
export interface ExciterOptions {
|
|
13
13
|
/** 500..8000 Hz (default 3000) */
|
|
14
|
+
"fc"?: Auto
|
|
15
|
+
/** @deprecated former name of "fc" */
|
|
14
16
|
"freq"?: Auto
|
|
15
17
|
/** 0..1 (default 0.5) */
|
|
16
18
|
"drive"?: Auto
|
|
@@ -25,7 +27,7 @@ export declare const exciter: {
|
|
|
25
27
|
channels: "any"
|
|
26
28
|
params: {
|
|
27
29
|
/** 500..8000 Hz (default 3000) */
|
|
28
|
-
"
|
|
30
|
+
"fc": { type: "number", default: 3000, alias: "freq" }
|
|
29
31
|
/** 0..1 (default 0.5) */
|
|
30
32
|
"drive": { type: "number", default: 0.5 }
|
|
31
33
|
/** 0..1 (default 0.5) */
|
package/audio.js
CHANGED
|
@@ -11,7 +11,7 @@ export const exciter = (ctx) => {
|
|
|
11
11
|
if (!inp || !inp.length) return
|
|
12
12
|
for (let c = 0; c < inp.length; c++) {
|
|
13
13
|
const p = chP[c]
|
|
14
|
-
p.
|
|
14
|
+
p.fc = params.fc[0]
|
|
15
15
|
p.drive = params.drive[0]
|
|
16
16
|
p.amount = params.amount[0]
|
|
17
17
|
out[c].set(inp[c])
|
|
@@ -21,7 +21,7 @@ export const exciter = (ctx) => {
|
|
|
21
21
|
}
|
|
22
22
|
exciter.channels = 'any'
|
|
23
23
|
exciter.params = {
|
|
24
|
-
|
|
24
|
+
fc: { type: 'number', min: 500, max: 8000, default: 3000, unit: 'Hz', curve: 'log', alias: 'freq' },
|
|
25
25
|
drive: { type: 'number', min: 0, max: 1, default: 0.5 },
|
|
26
26
|
amount: { type: 'number', min: 0, max: 1, default: 0.5 },
|
|
27
27
|
}
|
package/exciter.d.ts
ADDED
|
@@ -0,0 +1,19 @@
|
|
|
1
|
+
/** Exciter — Aphex-style aural exciter; SVF highpass extracts the high band, tanh saturation synthesizes harmonics, mixed back into dry. */
|
|
2
|
+
export interface ExciterOptions {
|
|
3
|
+
/** highpass cutoff, Hz, default 3000 */
|
|
4
|
+
fc?: number
|
|
5
|
+
/** @deprecated former name of `fc` */
|
|
6
|
+
freq?: number
|
|
7
|
+
/** saturation amount, 0–1, maps to 1×–10× gain, default 0.5 */
|
|
8
|
+
drive?: number
|
|
9
|
+
/** mix-in level, 0–1, default 0.5 */
|
|
10
|
+
amount?: number
|
|
11
|
+
/** sample rate, default 44100 */
|
|
12
|
+
fs?: number
|
|
13
|
+
}
|
|
14
|
+
|
|
15
|
+
/**
|
|
16
|
+
* Mutates `data` in place and returns the same reference. Pass the same params
|
|
17
|
+
* object across calls — the SVF integrator state persists on it (`_lp`, `_bp`).
|
|
18
|
+
*/
|
|
19
|
+
export default function exciter<T extends Float32Array | Float64Array>(data: T, params?: ExciterOptions): T
|
package/exciter.js
CHANGED
|
@@ -6,8 +6,8 @@
|
|
|
6
6
|
|
|
7
7
|
let {sin, tanh, PI} = Math
|
|
8
8
|
|
|
9
|
-
export default function exciter (data, params) {
|
|
10
|
-
let
|
|
9
|
+
export default function exciter (data, params = {}) {
|
|
10
|
+
let fc = params.fc ?? params.freq ?? 3000 // highpass cutoff Hz (`freq`: former name)
|
|
11
11
|
let drive = params.drive ?? 0.5 // saturation 0–1 → 1×–10× gain
|
|
12
12
|
let amount = params.amount ?? 0.5 // exciter mix 0–1
|
|
13
13
|
let fs = params.fs || 44100
|
|
@@ -17,7 +17,7 @@ export default function exciter (data, params) {
|
|
|
17
17
|
params._bp = 0
|
|
18
18
|
}
|
|
19
19
|
let lp = params._lp, bp = params._bp
|
|
20
|
-
let f = 2 * sin(PI *
|
|
20
|
+
let f = 2 * sin(PI * fc / fs)
|
|
21
21
|
let q = 0.5 // moderate damping
|
|
22
22
|
let g = 1 + drive * 9 // 1×–10×
|
|
23
23
|
|
|
@@ -27,7 +27,7 @@ export default function exciter (data, params) {
|
|
|
27
27
|
lp += f * bp
|
|
28
28
|
let hp = x - lp - q * bp
|
|
29
29
|
bp += f * hp
|
|
30
|
-
// Tanh saturation synthesizes harmonics above `
|
|
30
|
+
// Tanh saturation synthesizes harmonics above `fc`
|
|
31
31
|
data[i] = x + amount * tanh(hp * g) * 0.5
|
|
32
32
|
}
|
|
33
33
|
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@audio/effect-exciter",
|
|
3
|
-
"version": "1.
|
|
3
|
+
"version": "1.2.0",
|
|
4
4
|
"description": "Exciter — psychoacoustic harmonic synthesis for presence/air",
|
|
5
5
|
"type": "module",
|
|
6
6
|
"sideEffects": false,
|
|
@@ -16,7 +16,8 @@
|
|
|
16
16
|
"files": [
|
|
17
17
|
"exciter.js",
|
|
18
18
|
"audio.js",
|
|
19
|
-
"audio.d.ts"
|
|
19
|
+
"audio.d.ts",
|
|
20
|
+
"exciter.d.ts"
|
|
20
21
|
],
|
|
21
22
|
"keywords": [
|
|
22
23
|
"audio",
|
|
@@ -41,5 +42,7 @@
|
|
|
41
42
|
"publishConfig": {
|
|
42
43
|
"access": "public"
|
|
43
44
|
},
|
|
44
|
-
"
|
|
45
|
+
"types": "exciter.d.ts",
|
|
46
|
+
"audio": "./audio.js",
|
|
47
|
+
"funding": "https://github.com/sponsors/audiojs"
|
|
45
48
|
}
|