@audio/effect-graindelay 1.0.0 → 1.1.1
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/atom.js +39 -0
- package/package.json +7 -4
package/atom.js
ADDED
|
@@ -0,0 +1,39 @@
|
|
|
1
|
+
// atom manifest — wraps the graindelay atom; state rides per-channel params
|
|
2
|
+
// objects. time/spray/pitch/jitter/grain all feed the buffer-size calc (flags: restart
|
|
3
|
+
// — a live change reallocates and silently drops the buffered history, an audible
|
|
4
|
+
// glitch); feedback/mix are live. Each channel gets a distinct grain-scatter seed.
|
|
5
|
+
|
|
6
|
+
import graindelayFn from './graindelay.js'
|
|
7
|
+
|
|
8
|
+
export const graindelay = (ctx) => {
|
|
9
|
+
const chP = []
|
|
10
|
+
for (let c = 0, N = ctx.maxChannels ?? 8; c < N; c++)
|
|
11
|
+
chP.push({
|
|
12
|
+
fs: ctx.sampleRate,
|
|
13
|
+
time: ctx.params.time[0], spray: ctx.params.spray[0],
|
|
14
|
+
pitch: ctx.params.pitch[0], jitter: ctx.params.jitter[0], grain: ctx.params.grain[0],
|
|
15
|
+
seed: (0x9e3779b9 ^ (c * 0x2545f491)) >>> 0,
|
|
16
|
+
})
|
|
17
|
+
return (inputs, outputs, params) => {
|
|
18
|
+
const inp = inputs[0], out = outputs[0]
|
|
19
|
+
if (!inp || !inp.length) return
|
|
20
|
+
for (let c = 0; c < inp.length; c++) {
|
|
21
|
+
const p = chP[c]
|
|
22
|
+
p.feedback = params.feedback[0]
|
|
23
|
+
p.mix = params.mix[0]
|
|
24
|
+
out[c].set(inp[c])
|
|
25
|
+
graindelayFn(out[c], p)
|
|
26
|
+
}
|
|
27
|
+
}
|
|
28
|
+
}
|
|
29
|
+
graindelay.channels = 'any'
|
|
30
|
+
graindelay.tail = ({ params }) => { let fb = params.feedback[0]; let reps = fb > 0 ? Math.log(1e-3) / Math.log(fb) : 1; return (reps + 1) * params.time[0] } // RT60 from live feedback × live time
|
|
31
|
+
graindelay.params = {
|
|
32
|
+
time: { type: 'number', min: 0.02, max: 1.5, default: 0.25, unit: 's', flags: ['restart'] },
|
|
33
|
+
spray: { type: 'number', min: 0, max: 0.1, default: 0.02, unit: 's', flags: ['restart'] },
|
|
34
|
+
pitch: { type: 'number', min: -24, max: 24, default: 0, unit: 'st', flags: ['restart'] },
|
|
35
|
+
jitter: { type: 'number', min: 0, max: 12, default: 0, unit: 'st', flags: ['restart'] },
|
|
36
|
+
grain: { type: 'number', min: 0.01, max: 0.3, default: 0.08, unit: 's', flags: ['restart'] },
|
|
37
|
+
feedback: { type: 'number', min: 0, max: 0.9, default: 0.3 },
|
|
38
|
+
mix: { type: 'number', min: 0, max: 1, default: 0.5, smoothing: 0.02 },
|
|
39
|
+
}
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@audio/effect-graindelay",
|
|
3
|
-
"version": "1.
|
|
3
|
+
"version": "1.1.1",
|
|
4
4
|
"description": "Granular delay — per-grain pitch/time scatter (Ableton Grain Delay class)",
|
|
5
5
|
"type": "module",
|
|
6
6
|
"sideEffects": false,
|
|
@@ -18,12 +18,15 @@
|
|
|
18
18
|
"main": "graindelay.js",
|
|
19
19
|
"exports": {
|
|
20
20
|
".": "./graindelay.js",
|
|
21
|
-
"./package.json": "./package.json"
|
|
21
|
+
"./package.json": "./package.json",
|
|
22
|
+
"./atom": "./atom.js"
|
|
22
23
|
},
|
|
23
24
|
"files": [
|
|
24
|
-
"graindelay.js"
|
|
25
|
+
"graindelay.js",
|
|
26
|
+
"atom.js"
|
|
25
27
|
],
|
|
26
28
|
"publishConfig": {
|
|
27
29
|
"access": "public"
|
|
28
|
-
}
|
|
30
|
+
},
|
|
31
|
+
"atom": "./atom.js"
|
|
29
32
|
}
|