@audio/effect-pingpong 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.
Files changed (2) hide show
  1. package/atom.js +26 -0
  2. package/package.json +7 -4
package/atom.js ADDED
@@ -0,0 +1,26 @@
1
+ // atom manifest — wraps the ping-pong atom. Inherently stereo: the kernel
2
+ // cross-feeds left/right delay lines, so this declares a fixed 2-channel bus and holds
3
+ // one shared state object (not per-channel). `time` sizes both delay lines at
4
+ // construction (flags: restart); feedback/mix are live.
5
+
6
+ import pingPongFn from './ping-pong.js'
7
+
8
+ export const pingpong = (ctx) => {
9
+ const p = { fs: ctx.sampleRate, time: ctx.params.time[0] }
10
+ return (inputs, outputs, params) => {
11
+ const inp = inputs[0], out = outputs[0]
12
+ if (!inp || inp.length < 2) return
13
+ p.feedback = params.feedback[0]
14
+ p.mix = params.mix[0]
15
+ out[0].set(inp[0])
16
+ out[1].set(inp[1])
17
+ pingPongFn(out[0], out[1], p)
18
+ }
19
+ }
20
+ pingpong.channels = 2
21
+ pingpong.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
22
+ pingpong.params = {
23
+ time: { type: 'number', min: 0.01, max: 2, default: 0.25, unit: 's', flags: ['restart'] },
24
+ feedback: { type: 'number', min: 0, max: 0.9, default: 0.4 },
25
+ mix: { type: 'number', min: 0, max: 1, default: 0.5, smoothing: 0.02 },
26
+ }
package/package.json CHANGED
@@ -1,16 +1,18 @@
1
1
  {
2
2
  "name": "@audio/effect-pingpong",
3
- "version": "1.0.0",
3
+ "version": "1.1.1",
4
4
  "description": "Ping-pong delay — stereo: left and right delays alternate",
5
5
  "type": "module",
6
6
  "sideEffects": false,
7
7
  "main": "ping-pong.js",
8
8
  "exports": {
9
9
  ".": "./ping-pong.js",
10
- "./package.json": "./package.json"
10
+ "./package.json": "./package.json",
11
+ "./atom": "./atom.js"
11
12
  },
12
13
  "files": [
13
- "ping-pong.js"
14
+ "ping-pong.js",
15
+ "atom.js"
14
16
  ],
15
17
  "keywords": [
16
18
  "audio",
@@ -34,5 +36,6 @@
34
36
  },
35
37
  "publishConfig": {
36
38
  "access": "public"
37
- }
39
+ },
40
+ "atom": "./atom.js"
38
41
  }