@audio/effect-lofi 1.0.0 → 1.1.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.
Files changed (2) hide show
  1. package/audio-module.js +39 -0
  2. package/package.json +7 -4
@@ -0,0 +1,39 @@
1
+ // audio-module manifest — wraps the lofi atom; buffer size is fs-only (not param-
2
+ // dependent, safe at any wow/flutter setting), so every param stays live. Each channel
3
+ // gets a distinct noise seed so stereo material isn't crushed to a mono-identical
4
+ // hiss/crackle bed.
5
+
6
+ import lofiFn from './lofi.js'
7
+
8
+ export const lofi = (ctx) => {
9
+ const chP = []
10
+ for (let c = 0, N = ctx.maxChannels ?? 8; c < N; c++)
11
+ chP.push({ fs: ctx.sampleRate, seed: (0x2545f491 ^ (c * 0x9e3779b9)) >>> 0 })
12
+ return (inputs, outputs, params) => {
13
+ const inp = inputs[0], out = outputs[0]
14
+ if (!inp || !inp.length) return
15
+ for (let c = 0; c < inp.length; c++) {
16
+ const p = chP[c]
17
+ p.wow = params.wow[0]
18
+ p.flutter = params.flutter[0]
19
+ p.noise = params.noise[0]
20
+ p.crackle = params.crackle[0]
21
+ p.lowpass = params.lowpass[0]
22
+ p.highpass = params.highpass[0]
23
+ p.drive = params.drive[0]
24
+ out[c].set(inp[c])
25
+ lofiFn(out[c], p)
26
+ }
27
+ }
28
+ }
29
+ lofi.channels = 'any'
30
+ lofi.tail = 0.1 // highpass one-pole settle at highpass.min(20Hz): RT60 ≈ 55ms + 4ms delay buffer
31
+ lofi.params = {
32
+ wow: { type: 'number', min: 0, max: 1, default: 0.3 },
33
+ flutter: { type: 'number', min: 0, max: 1, default: 0.2 },
34
+ noise: { type: 'number', min: 0, max: 1, default: 0.1 },
35
+ crackle: { type: 'number', min: 0, max: 1, default: 0.1 },
36
+ lowpass: { type: 'number', min: 500, max: 18000, default: 6000, unit: 'Hz', curve: 'log' },
37
+ highpass: { type: 'number', min: 20, max: 500, default: 60, unit: 'Hz', curve: 'log' },
38
+ drive: { type: 'number', min: 0, max: 1, default: 0.3 },
39
+ }
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@audio/effect-lofi",
3
- "version": "1.0.0",
3
+ "version": "1.1.0",
4
4
  "description": "Lo-fi character — wow/flutter, vinyl noise, crackle, bandwidth ceiling (RC-20 class)",
5
5
  "type": "module",
6
6
  "sideEffects": false,
@@ -18,12 +18,15 @@
18
18
  "main": "lofi.js",
19
19
  "exports": {
20
20
  ".": "./lofi.js",
21
- "./package.json": "./package.json"
21
+ "./package.json": "./package.json",
22
+ "./audio-module": "./audio-module.js"
22
23
  },
23
24
  "files": [
24
- "lofi.js"
25
+ "lofi.js",
26
+ "audio-module.js"
25
27
  ],
26
28
  "publishConfig": {
27
29
  "access": "public"
28
- }
30
+ },
31
+ "audio-module": "./audio-module.js"
29
32
  }