@audio/effect-pingpong 1.1.2 → 1.1.4
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 +35 -0
- package/package.json +11 -4
- package/ping-pong.d.ts +22 -0
package/README.md
ADDED
|
@@ -0,0 +1,33 @@
|
|
|
1
|
+
# @audio/effect-pingpong [](https://www.npmjs.com/package/@audio/effect-pingpong) [](https://github.com/krishnized/license)
|
|
2
|
+
|
|
3
|
+
Ping-pong delay — stereo: left and right delays alternate
|
|
4
|
+
|
|
5
|
+
```
|
|
6
|
+
npm install @audio/effect-pingpong
|
|
7
|
+
```
|
|
8
|
+
|
|
9
|
+
```js
|
|
10
|
+
import pingPong from '@audio/effect-pingpong'
|
|
11
|
+
```
|
|
12
|
+
|
|
13
|
+
Cross-fed stereo delay — left echo bounces to right, right to left.
|
|
14
|
+
|
|
15
|
+
**`time`** delay time in seconds (default 0.25) · **`feedback`** 0–1 (default 0.3) · **`mix`** wet/dry 0–1 (default 0.5) · **`fs`** sample rate
|
|
16
|
+
|
|
17
|
+
```js
|
|
18
|
+
import { pingPong } from '@audio/effect'
|
|
19
|
+
|
|
20
|
+
let p = { time: 0.15, feedback: 0.5, mix: 0.5, fs: 44100 }
|
|
21
|
+
for (let [L, R] of stereoStream) pingPong(L, R, p)
|
|
22
|
+
```
|
|
23
|
+
|
|
24
|
+
**Use when**: stereo width from delays, spatial depth, rhythmic bounce effects<br>
|
|
25
|
+
**Not for**: mono output
|
|
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
ADDED
|
@@ -0,0 +1,35 @@
|
|
|
1
|
+
// Generated from the audio.js manifest (params metadata is the source of truth).
|
|
2
|
+
// Regenerate: node tools/dts.js in @audio/compile. Do not edit by hand.
|
|
3
|
+
|
|
4
|
+
/** Automatable number — scalar, `t => value` fn, or breakpoint curve {t, v} */
|
|
5
|
+
type Auto = number | ((t: number) => number) | { t: number[], v: number[] }
|
|
6
|
+
/** Per-block param values as delivered by hosts (numbers arrive as 1-length Float32Array) */
|
|
7
|
+
type Live = Record<string, Float32Array | string | boolean>
|
|
8
|
+
type Ctx = { sampleRate: number, maxBlockSize: number, maxChannels: number, currentTime: number, duration?: number, events?: readonly any[], emit?: (name: string, ...args: any[]) => void, [k: string]: unknown }
|
|
9
|
+
type Process = (inputs: Float32Array[][], outputs: Float32Array[][], params: Live) => void
|
|
10
|
+
|
|
11
|
+
/** Chainable-host options for 'pingpong' */
|
|
12
|
+
export interface PingpongOptions {
|
|
13
|
+
/** 0.01..2 s (default 0.25) */
|
|
14
|
+
"time"?: Auto
|
|
15
|
+
/** 0..0.9 (default 0.4) */
|
|
16
|
+
"feedback"?: Auto
|
|
17
|
+
/** 0..1 (default 0.5) */
|
|
18
|
+
"mix"?: Auto
|
|
19
|
+
at?: number | string
|
|
20
|
+
duration?: number | string
|
|
21
|
+
}
|
|
22
|
+
|
|
23
|
+
export declare const pingpong: {
|
|
24
|
+
(ctx: Ctx): Process
|
|
25
|
+
channels: 2
|
|
26
|
+
tail: (ctx: { sampleRate: number, params: Live }) => number
|
|
27
|
+
params: {
|
|
28
|
+
/** 0.01..2 s (default 0.25) [restart] */
|
|
29
|
+
"time": { type: "number", default: 0.25 }
|
|
30
|
+
/** 0..0.9 (default 0.4) */
|
|
31
|
+
"feedback": { type: "number", default: 0.4 }
|
|
32
|
+
/** 0..1 (default 0.5) */
|
|
33
|
+
"mix": { type: "number", default: 0.5 }
|
|
34
|
+
}
|
|
35
|
+
}
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@audio/effect-pingpong",
|
|
3
|
-
"version": "1.1.
|
|
3
|
+
"version": "1.1.4",
|
|
4
4
|
"description": "Ping-pong delay — stereo: left and right delays alternate",
|
|
5
5
|
"type": "module",
|
|
6
6
|
"sideEffects": false,
|
|
@@ -8,11 +8,16 @@
|
|
|
8
8
|
"exports": {
|
|
9
9
|
".": "./ping-pong.js",
|
|
10
10
|
"./package.json": "./package.json",
|
|
11
|
-
"./audio":
|
|
11
|
+
"./audio": {
|
|
12
|
+
"types": "./audio.d.ts",
|
|
13
|
+
"default": "./audio.js"
|
|
14
|
+
}
|
|
12
15
|
},
|
|
13
16
|
"files": [
|
|
14
17
|
"ping-pong.js",
|
|
15
|
-
"audio.js"
|
|
18
|
+
"audio.js",
|
|
19
|
+
"audio.d.ts",
|
|
20
|
+
"ping-pong.d.ts"
|
|
16
21
|
],
|
|
17
22
|
"keywords": [
|
|
18
23
|
"audio",
|
|
@@ -37,5 +42,7 @@
|
|
|
37
42
|
"publishConfig": {
|
|
38
43
|
"access": "public"
|
|
39
44
|
},
|
|
40
|
-
"
|
|
45
|
+
"types": "ping-pong.d.ts",
|
|
46
|
+
"audio": "./audio.js",
|
|
47
|
+
"funding": "https://github.com/sponsors/audiojs"
|
|
41
48
|
}
|
package/ping-pong.d.ts
ADDED
|
@@ -0,0 +1,22 @@
|
|
|
1
|
+
/** Ping-pong delay — stereo cross-fed delay; left echo bounces to right, right to left. */
|
|
2
|
+
export interface PingPongOptions {
|
|
3
|
+
/** delay time, seconds, default 0.25. Changing this reallocates both delay buffers, dropping buffered history. */
|
|
4
|
+
time?: number
|
|
5
|
+
/** feedback, 0–0.9, default 0.4 */
|
|
6
|
+
feedback?: number
|
|
7
|
+
/** wet/dry, 0–1, default 0.5 */
|
|
8
|
+
mix?: number
|
|
9
|
+
/** sample rate, default 44100 */
|
|
10
|
+
fs?: number
|
|
11
|
+
}
|
|
12
|
+
|
|
13
|
+
/**
|
|
14
|
+
* Mutates `left` and `right` in place and returns `[left, right]` (the same two
|
|
15
|
+
* references). Pass the same params object across calls — the two delay ring
|
|
16
|
+
* buffers and shared write pointer persist on it (`_bufL`, `_bufR`, `_ptr`).
|
|
17
|
+
*/
|
|
18
|
+
export default function pingPong(
|
|
19
|
+
left: Float32Array,
|
|
20
|
+
right: Float32Array,
|
|
21
|
+
params?: PingPongOptions
|
|
22
|
+
): [Float32Array, Float32Array]
|