@buffered-audio/nodes 0.16.0 → 0.18.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/dist/index.d.ts CHANGED
@@ -1,6 +1,5 @@
1
1
  import { z } from 'zod';
2
- import { SourceNode, SourceNodeProperties, BufferedSourceStream, SourceMetadata, AudioChunk, TargetNode, TargetNodeProperties, BufferedTargetStream, StreamContext, TransformNode, TransformNodeProperties, BufferedTransformStream, ChunkBuffer, CompositeNode, BufferedAudioNode } from '@buffered-audio/core';
3
- export { CompositeNode } from '@buffered-audio/core';
2
+ import { SourceNode, SourceNodeProperties, BufferedSourceStream, SourceMetadata, Block, TargetNode, TargetNodeProperties, BufferedTargetStream, StreamContext, TransformNode, TransformNodeProperties, UnbufferedTransformStream, BufferedAudioNode, BufferedTransformStream, BlockBuffer, Composition } from '@buffered-audio/core';
4
3
 
5
4
  declare const ffmpegSchema: z.ZodObject<{
6
5
  path: z.ZodDefault<z.ZodString>;
@@ -20,24 +19,23 @@ declare class ReadFfmpegStream<P extends ReadFfmpegProperties = ReadFfmpegProper
20
19
  private sourceBitDepth;
21
20
  getMetadata(): Promise<SourceMetadata>;
22
21
  private ensureInitialized;
23
- _read(): Promise<AudioChunk | undefined>;
24
- _flush(): Promise<void>;
25
- _teardown(): void;
22
+ _read(): Promise<Block | undefined>;
23
+ _destroy(): Promise<void>;
26
24
  private probe;
27
25
  private readBytes;
28
26
  }
29
27
  declare class ReadFfmpegNode extends SourceNode<ReadFfmpegProperties> {
30
- static readonly moduleName = "Read FFmpeg";
28
+ static readonly nodeName = "Read FFmpeg";
31
29
  static readonly packageName: string;
32
30
  static readonly packageVersion: string;
33
- static readonly moduleDescription = "Read audio from a file using FFmpeg";
31
+ static readonly nodeDescription = "Read audio from a file using FFmpeg";
34
32
  static readonly schema: z.ZodObject<{
35
33
  path: z.ZodDefault<z.ZodString>;
36
34
  ffmpegPath: z.ZodDefault<z.ZodString>;
37
35
  ffprobePath: z.ZodDefault<z.ZodString>;
38
36
  }, z.core.$strip>;
37
+ static readonly streamClass: typeof ReadFfmpegStream;
39
38
  readonly type: readonly ["buffered-audio-node", "source", "read-ffmpeg"];
40
- protected createStream(): ReadFfmpegStream;
41
39
  clone(overrides?: Partial<ReadFfmpegProperties>): ReadFfmpegNode;
42
40
  }
43
41
  declare function readFfmpeg(path: string, options: {
@@ -52,7 +50,6 @@ declare const wavSchema: z.ZodObject<{
52
50
  interface ReadWavProperties extends z.infer<typeof wavSchema>, SourceNodeProperties {
53
51
  readonly channels?: ReadonlyArray<number>;
54
52
  }
55
- declare function readSample(data: Buffer, offset: number, bitsPerSample: number, audioFormat: number): number;
56
53
  declare class ReadWavStream<P extends ReadWavProperties = ReadWavProperties> extends BufferedSourceStream<P> {
57
54
  private fileHandle?;
58
55
  private format?;
@@ -61,53 +58,32 @@ declare class ReadWavStream<P extends ReadWavProperties = ReadWavProperties> ext
61
58
  private sourceBitDepth;
62
59
  getMetadata(): Promise<SourceMetadata>;
63
60
  private ensureInitialized;
64
- _read(): Promise<AudioChunk | undefined>;
65
- _flush(): Promise<void>;
66
- _teardown(): void;
61
+ _read(): Promise<Block | undefined>;
62
+ _destroy(): Promise<void>;
67
63
  }
68
64
  declare class ReadWavNode extends SourceNode<ReadWavProperties> {
69
- static readonly moduleName = "Read WAV";
65
+ static readonly nodeName = "Read WAV";
70
66
  static readonly packageName: string;
71
67
  static readonly packageVersion: string;
72
- static readonly moduleDescription = "Read audio from a WAV file";
68
+ static readonly nodeDescription = "Read audio from a WAV file";
73
69
  static readonly schema: z.ZodObject<{
74
70
  path: z.ZodDefault<z.ZodString>;
75
71
  }, z.core.$strip>;
72
+ static readonly streamClass: typeof ReadWavStream;
76
73
  readonly type: readonly ["buffered-audio-node", "source", "read-wav"];
77
- protected createStream(): ReadWavStream;
78
74
  clone(overrides?: Partial<ReadWavProperties>): ReadWavNode;
79
75
  }
80
76
  declare function readWav(path: string, options?: {
81
77
  channels?: ReadonlyArray<number>;
82
78
  }): ReadWavNode;
83
79
 
84
- declare const schema$m: z.ZodObject<{
85
- path: z.ZodDefault<z.ZodString>;
86
- ffmpegPath: z.ZodDefault<z.ZodString>;
87
- ffprobePath: z.ZodDefault<z.ZodString>;
88
- }, z.core.$strip>;
89
- interface ReadProperties extends z.infer<typeof schema$m>, SourceNodeProperties {
90
- readonly channels?: ReadonlyArray<number>;
91
- }
92
- declare class ReadNode extends SourceNode<ReadProperties> {
93
- static readonly moduleName = "Read";
94
- static readonly packageName: string;
95
- static readonly packageVersion: string;
96
- static readonly moduleDescription = "Read audio from a file";
97
- static readonly schema: z.ZodObject<{
98
- path: z.ZodDefault<z.ZodString>;
99
- ffmpegPath: z.ZodDefault<z.ZodString>;
100
- ffprobePath: z.ZodDefault<z.ZodString>;
101
- }, z.core.$strip>;
102
- readonly type: readonly ["buffered-audio-node", "source", "read"];
103
- protected createStream(): ReadWavStream<ReadProperties> | ReadFfmpegStream<ReadProperties>;
104
- clone(overrides?: Partial<ReadProperties>): ReadNode;
105
- }
106
80
  declare function read(path: string, options?: {
107
81
  channels?: ReadonlyArray<number>;
108
82
  ffmpegPath?: string;
109
83
  ffprobePath?: string;
110
- }): ReadNode;
84
+ }): ReadWavNode | ReadFfmpegNode;
85
+
86
+ declare function readSample(data: Buffer, offset: number, bitsPerSample: number, audioFormat: number): number;
111
87
 
112
88
  declare const schema$l: z.ZodObject<{
113
89
  bucketCount: z.ZodDefault<z.ZodNumber>;
@@ -138,27 +114,23 @@ declare class LoudnessStatsStream extends BufferedTargetStream<LoudnessStatsProp
138
114
  private statsInitialized;
139
115
  private fileHandle?;
140
116
  get stats(): LoudnessStats | undefined;
141
- _setup(input: ReadableStream<AudioChunk>, context: StreamContext): Promise<void>;
117
+ _setup(input: ReadableStream<Block>, context: StreamContext): Promise<void>;
142
118
  private ensureInit;
143
- _write(chunk: AudioChunk): Promise<void>;
119
+ _write(chunk: Block): Promise<void>;
144
120
  _close(): Promise<void>;
145
121
  }
146
122
  declare class LoudnessStatsNode extends TargetNode<LoudnessStatsProperties> {
147
- static readonly moduleName = "Loudness Stats";
123
+ static readonly nodeName = "Loudness Stats";
148
124
  static readonly packageName: string;
149
125
  static readonly packageVersion: string;
150
- static readonly moduleDescription = "Measure integrated loudness, true peak, and loudness range per EBU R128, plus an amplitude-distribution histogram";
126
+ static readonly nodeDescription = "Measure integrated loudness, true peak, and loudness range per EBU R128, plus an amplitude-distribution histogram";
151
127
  static readonly schema: z.ZodObject<{
152
128
  bucketCount: z.ZodDefault<z.ZodNumber>;
153
129
  outputPath: z.ZodDefault<z.ZodString>;
154
130
  }, z.core.$strip>;
131
+ static readonly streamClass: typeof LoudnessStatsStream;
155
132
  static is(value: unknown): value is LoudnessStatsNode;
156
133
  readonly type: readonly ["buffered-audio-node", "target", "loudness-stats"];
157
- private cachedStats?;
158
- constructor(properties: LoudnessStatsProperties);
159
- get stats(): LoudnessStats | undefined;
160
- _teardown(): void;
161
- createStream(): LoudnessStatsStream;
162
134
  clone(overrides?: Partial<LoudnessStatsProperties>): LoudnessStatsNode;
163
135
  }
164
136
  declare function loudnessStats(options?: {
@@ -200,29 +172,28 @@ declare class SpectrogramStream extends BufferedTargetStream<SpectrogramProperti
200
172
  private writeBufferFileOffset;
201
173
  private readonly WRITE_BATCH_FRAMES;
202
174
  private initialized;
203
- _setup(input: ReadableStream<AudioChunk>, context: StreamContext): Promise<void>;
175
+ _setup(input: ReadableStream<Block>, context: StreamContext): Promise<void>;
204
176
  private initialize;
205
- _write(chunk: AudioChunk): Promise<void>;
177
+ _write(chunk: Block): Promise<void>;
206
178
  _close(): Promise<void>;
207
179
  private processAccumulatedSamples;
208
180
  private writeFrame;
209
181
  private flushWriteBuffer;
210
182
  }
211
183
  declare class SpectrogramNode extends TargetNode<SpectrogramProperties> {
212
- static readonly moduleName = "Spectrogram";
184
+ static readonly nodeName = "Spectrogram";
213
185
  static readonly packageName: string;
214
186
  static readonly packageVersion: string;
215
- static readonly moduleDescription = "Generate spectrogram visualization data";
187
+ static readonly nodeDescription = "Generate spectrogram visualization data";
216
188
  static readonly schema: z.ZodObject<{
217
189
  outputPath: z.ZodDefault<z.ZodString>;
218
190
  fftSize: z.ZodDefault<z.ZodNumber>;
219
191
  hopSize: z.ZodDefault<z.ZodNumber>;
220
192
  fftwAddonPath: z.ZodDefault<z.ZodString>;
221
193
  }, z.core.$strip>;
194
+ static readonly streamClass: typeof SpectrogramStream;
222
195
  static is(value: unknown): value is SpectrogramNode;
223
196
  readonly type: readonly ["buffered-audio-node", "target", "spectrogram"];
224
- constructor(properties: SpectrogramProperties);
225
- createStream(): SpectrogramStream;
226
197
  clone(overrides?: Partial<SpectrogramProperties>): SpectrogramNode;
227
198
  }
228
199
  declare function spectrogram(outputPath: string, options?: {
@@ -255,27 +226,26 @@ declare class WaveformStream extends BufferedTargetStream<WaveformProperties> {
255
226
  private writeBufferFileOffset;
256
227
  private readonly WRITE_BATCH_POINTS;
257
228
  private initialized;
258
- _setup(input: ReadableStream<AudioChunk>, context: StreamContext): Promise<void>;
229
+ _setup(input: ReadableStream<Block>, context: StreamContext): Promise<void>;
259
230
  private initialize;
260
231
  private writeHeader;
261
- _write(chunk: AudioChunk): Promise<void>;
232
+ _write(chunk: Block): Promise<void>;
262
233
  _close(): Promise<void>;
263
234
  private flushPoint;
264
235
  private flushWriteBuffer;
265
236
  }
266
237
  declare class WaveformNode extends TargetNode<WaveformProperties> {
267
- static readonly moduleName = "Waveform";
238
+ static readonly nodeName = "Waveform";
268
239
  static readonly packageName: string;
269
240
  static readonly packageVersion: string;
270
- static readonly moduleDescription = "Generate waveform visualization data";
241
+ static readonly nodeDescription = "Generate waveform visualization data";
271
242
  static readonly schema: z.ZodObject<{
272
243
  outputPath: z.ZodDefault<z.ZodString>;
273
244
  resolution: z.ZodDefault<z.ZodNumber>;
274
245
  }, z.core.$strip>;
246
+ static readonly streamClass: typeof WaveformStream;
275
247
  static is(value: unknown): value is WaveformNode;
276
248
  readonly type: readonly ["buffered-audio-node", "target", "waveform"];
277
- constructor(properties: WaveformProperties);
278
- createStream(): WaveformStream;
279
249
  clone(overrides?: Partial<WaveformProperties>): WaveformNode;
280
250
  }
281
251
  declare function waveform(outputPath: string, options?: {
@@ -305,21 +275,21 @@ declare class WriteStream extends BufferedTargetStream<WriteProperties> {
305
275
  private bytesWritten;
306
276
  private useEncoding;
307
277
  private initialized;
308
- _setup(input: ReadableStream<AudioChunk>, context: StreamContext): Promise<void>;
278
+ _setup(input: ReadableStream<Block>, context: StreamContext): Promise<void>;
309
279
  private initialize;
310
280
  private spawnFfmpeg;
311
- _write(chunk: AudioChunk): Promise<void>;
281
+ _write(chunk: Block): Promise<void>;
312
282
  _close(): Promise<void>;
313
- _teardown(): Promise<void>;
283
+ _destroy(): Promise<void>;
314
284
  private convertChunk;
315
285
  private buildFfmpegArgs;
316
286
  private writeToStdin;
317
287
  }
318
288
  declare class WriteNode extends TargetNode<WriteProperties> {
319
- static readonly moduleName = "Write";
289
+ static readonly nodeName = "Write";
320
290
  static readonly packageName: string;
321
291
  static readonly packageVersion: string;
322
- static readonly moduleDescription = "Write audio to a file";
292
+ static readonly nodeDescription = "Write audio to a file";
323
293
  static readonly schema: z.ZodObject<{
324
294
  path: z.ZodDefault<z.ZodString>;
325
295
  ffmpegPath: z.ZodDefault<z.ZodString>;
@@ -341,8 +311,8 @@ declare class WriteNode extends TargetNode<WriteProperties> {
341
311
  sampleRate: z.ZodOptional<z.ZodNumber>;
342
312
  }, z.core.$strip>>;
343
313
  }, z.core.$strip>;
314
+ static readonly streamClass: typeof WriteStream;
344
315
  readonly type: readonly ["buffered-audio-node", "target", "write"];
345
- createStream(): WriteStream;
346
316
  clone(overrides?: Partial<WriteProperties>): WriteNode;
347
317
  }
348
318
  declare function write(path: string, options?: {
@@ -364,26 +334,26 @@ declare const schema$i: z.ZodObject<{
364
334
  type CutRegion = z.infer<typeof cutRegionSchema>;
365
335
  interface CutProperties extends z.infer<typeof schema$i>, TransformNodeProperties {
366
336
  }
367
- declare class CutStream extends BufferedTransformStream<CutProperties> {
337
+ declare class CutStream extends UnbufferedTransformStream<CutProperties> {
368
338
  private sortedRegions;
369
339
  private removedFrames;
370
- constructor(properties: CutProperties);
371
- _unbuffer(chunk: AudioChunk): AudioChunk | undefined;
340
+ constructor(node: BufferedAudioNode);
341
+ transform(chunk: Block, enqueue: (block: Block) => void): void;
372
342
  }
373
343
  declare class CutNode extends TransformNode<CutProperties> {
374
- static readonly moduleName = "Cut";
344
+ static readonly nodeName = "Cut";
375
345
  static readonly packageName: string;
376
346
  static readonly packageVersion: string;
377
- static readonly moduleDescription = "Remove a region of audio";
347
+ static readonly nodeDescription = "Remove a region of audio";
378
348
  static readonly schema: z.ZodObject<{
379
349
  regions: z.ZodDefault<z.ZodArray<z.ZodObject<{
380
350
  start: z.ZodNumber;
381
351
  end: z.ZodNumber;
382
352
  }, z.core.$strip>>>;
383
353
  }, z.core.$strip>;
354
+ static readonly streamClass: typeof CutStream;
384
355
  static is(value: unknown): value is CutNode;
385
356
  readonly type: readonly ["buffered-audio-node", "transform", "cut"];
386
- createStream(): CutStream;
387
357
  clone(overrides?: Partial<CutProperties>): CutNode;
388
358
  }
389
359
  declare function cut(regions: Array<CutRegion>, options?: {
@@ -396,23 +366,22 @@ declare const schema$h: z.ZodObject<{
396
366
  }, z.core.$strip>;
397
367
  interface DitherProperties extends z.infer<typeof schema$h>, TransformNodeProperties {
398
368
  }
399
- declare class DitherStream extends BufferedTransformStream<DitherProperties> {
369
+ declare class DitherStream extends UnbufferedTransformStream<DitherProperties> {
400
370
  private lastError;
401
- _buffer(chunk: AudioChunk, buffer: ChunkBuffer): Promise<void>;
402
- _unbuffer(chunk: AudioChunk): AudioChunk;
371
+ transform(chunk: Block, enqueue: (block: Block) => void): void;
403
372
  }
404
373
  declare class DitherNode extends TransformNode<DitherProperties> {
405
- static readonly moduleName = "Dither";
374
+ static readonly nodeName = "Dither";
406
375
  static readonly packageName: string;
407
376
  static readonly packageVersion: string;
408
- static readonly moduleDescription = "Add shaped noise to reduce quantization distortion";
377
+ static readonly nodeDescription = "Add shaped noise to reduce quantization distortion";
409
378
  static readonly schema: z.ZodObject<{
410
379
  bitDepth: z.ZodDefault<z.ZodUnion<readonly [z.ZodLiteral<16>, z.ZodLiteral<24>]>>;
411
380
  noiseShaping: z.ZodDefault<z.ZodBoolean>;
412
381
  }, z.core.$strip>;
382
+ static readonly streamClass: typeof DitherStream;
413
383
  static is(value: unknown): value is DitherNode;
414
384
  readonly type: readonly ["buffered-audio-node", "transform", "dither"];
415
- createStream(): DitherStream;
416
385
  clone(overrides?: Partial<DitherProperties>): DitherNode;
417
386
  }
418
387
  declare function dither(bitDepth: 16 | 24, options?: {
@@ -426,24 +395,22 @@ declare const schema$g: z.ZodObject<{
426
395
  interface NormalizeProperties extends z.infer<typeof schema$g>, TransformNodeProperties {
427
396
  }
428
397
  declare class NormalizeStream extends BufferedTransformStream<NormalizeProperties> {
398
+ blockSize: number;
429
399
  private peak;
430
- private scale;
431
- _buffer(chunk: AudioChunk, buffer: ChunkBuffer): Promise<void>;
432
- _process(_buffer: ChunkBuffer): void;
433
- _unbuffer(chunk: AudioChunk): AudioChunk;
400
+ prepare(block: Block): Block;
401
+ transform(buffered: BlockBuffer, enqueue: (block: Block) => void): Promise<void>;
434
402
  }
435
403
  declare class NormalizeNode extends TransformNode<NormalizeProperties> {
436
- static readonly moduleName = "Normalize";
404
+ static readonly nodeName = "Normalize";
437
405
  static readonly packageName: string;
438
406
  static readonly packageVersion: string;
439
- static readonly moduleDescription = "Adjust peak or loudness level to a target ceiling";
407
+ static readonly nodeDescription = "Adjust peak or loudness level to a target ceiling";
440
408
  static readonly schema: z.ZodObject<{
441
409
  ceiling: z.ZodDefault<z.ZodNumber>;
442
410
  }, z.core.$strip>;
411
+ static readonly streamClass: typeof NormalizeStream;
443
412
  static is(value: unknown): value is NormalizeNode;
444
413
  readonly type: readonly ["buffered-audio-node", "transform", "normalize"];
445
- constructor(properties: NormalizeProperties);
446
- createStream(): NormalizeStream;
447
414
  clone(overrides?: Partial<NormalizeProperties>): NormalizeNode;
448
415
  }
449
416
  declare function normalize(options?: {
@@ -457,22 +424,27 @@ declare const schema$f: z.ZodObject<{
457
424
  }, z.core.$strip>;
458
425
  interface PadProperties extends z.infer<typeof schema$f>, TransformNodeProperties {
459
426
  }
460
- declare class PadStream extends BufferedTransformStream<PadProperties> {
461
- _process(buffer: ChunkBuffer): Promise<void>;
427
+ declare class PadStream extends UnbufferedTransformStream<PadProperties> {
428
+ private seenChunk;
429
+ private capturedSampleRate;
430
+ private capturedBitDepth;
431
+ private capturedChannels;
432
+ private outputOffset;
433
+ transform(chunk: Block, enqueue: (block: Block) => void): void;
434
+ flush(enqueue: (block: Block) => void): void;
462
435
  }
463
436
  declare class PadNode extends TransformNode<PadProperties> {
464
- static readonly moduleName = "Pad";
437
+ static readonly nodeName = "Pad";
465
438
  static readonly packageName: string;
466
439
  static readonly packageVersion: string;
467
- static readonly moduleDescription = "Add silence to start or end of audio";
440
+ static readonly nodeDescription = "Add silence to start or end of audio";
468
441
  static readonly schema: z.ZodObject<{
469
442
  before: z.ZodDefault<z.ZodNumber>;
470
443
  after: z.ZodDefault<z.ZodNumber>;
471
444
  }, z.core.$strip>;
445
+ static readonly streamClass: typeof PadStream;
472
446
  static is(value: unknown): value is PadNode;
473
447
  readonly type: readonly ["buffered-audio-node", "transform", "pad"];
474
- constructor(properties: PadProperties);
475
- createStream(): PadStream;
476
448
  clone(overrides?: Partial<PadProperties>): PadNode;
477
449
  }
478
450
  declare function pad(options: {
@@ -487,24 +459,24 @@ declare const schema$e: z.ZodObject<{
487
459
  }, z.core.$strip>;
488
460
  interface PhaseProperties extends z.infer<typeof schema$e>, TransformNodeProperties {
489
461
  }
490
- declare class PhaseStream extends BufferedTransformStream<PhaseProperties> {
462
+ declare class PhaseStream extends UnbufferedTransformStream<PhaseProperties> {
491
463
  private allpassState;
492
- _unbuffer(chunk: AudioChunk): AudioChunk;
464
+ transform(chunk: Block, enqueue: (block: Block) => void): void;
493
465
  private applyInvert;
494
466
  private applyPhaseRotation;
495
467
  }
496
468
  declare class PhaseNode extends TransformNode<PhaseProperties> {
497
- static readonly moduleName = "Phase";
469
+ static readonly nodeName = "Phase";
498
470
  static readonly packageName: string;
499
471
  static readonly packageVersion: string;
500
- static readonly moduleDescription = "Invert or rotate signal phase";
472
+ static readonly nodeDescription = "Invert or rotate signal phase";
501
473
  static readonly schema: z.ZodObject<{
502
474
  invert: z.ZodDefault<z.ZodBoolean>;
503
475
  angle: z.ZodOptional<z.ZodNumber>;
504
476
  }, z.core.$strip>;
477
+ static readonly streamClass: typeof PhaseStream;
505
478
  static is(value: unknown): value is PhaseNode;
506
479
  readonly type: readonly ["buffered-audio-node", "transform", "phase"];
507
- createStream(): PhaseStream;
508
480
  clone(overrides?: Partial<PhaseProperties>): PhaseNode;
509
481
  }
510
482
  declare function phase(options?: {
@@ -517,18 +489,18 @@ declare function invert(options?: {
517
489
  }): PhaseNode;
518
490
 
519
491
  declare class ReverseStream extends BufferedTransformStream {
520
- _process(buffer: ChunkBuffer): Promise<void>;
492
+ blockSize: number;
493
+ transform(buffered: BlockBuffer, enqueue: (block: Block) => void): Promise<void>;
521
494
  }
522
495
  declare class ReverseNode extends TransformNode {
523
- static readonly moduleName = "Reverse";
496
+ static readonly nodeName = "Reverse";
524
497
  static readonly packageName: string;
525
498
  static readonly packageVersion: string;
526
- static readonly moduleDescription = "Reverse audio playback direction";
499
+ static readonly nodeDescription = "Reverse audio playback direction";
527
500
  static readonly schema: z.ZodObject<{}, z.core.$strip>;
501
+ static readonly streamClass: typeof ReverseStream;
528
502
  static is(value: unknown): value is ReverseNode;
529
503
  readonly type: readonly ["buffered-audio-node", "transform", "reverse"];
530
- constructor(properties?: TransformNodeProperties);
531
- createStream(): ReverseStream;
532
504
  clone(overrides?: Partial<TransformNodeProperties>): ReverseNode;
533
505
  }
534
506
  declare function reverse(options?: {
@@ -542,26 +514,26 @@ declare const schema$d: z.ZodObject<{
542
514
  interface SpliceProperties extends z.infer<typeof schema$d>, TransformNodeProperties {
543
515
  readonly channels?: ReadonlyArray<number>;
544
516
  }
545
- declare class SpliceStream extends BufferedTransformStream<SpliceProperties> {
517
+ declare class SpliceStream extends UnbufferedTransformStream<SpliceProperties> {
546
518
  private insertSamples;
547
519
  private insertSampleRate;
548
520
  private insertLength;
549
521
  private sampleRateChecked;
550
- _setup(input: ReadableStream<AudioChunk>, context: StreamContext): Promise<ReadableStream<AudioChunk>>;
551
- _unbuffer(chunk: AudioChunk): AudioChunk;
522
+ _setup(input: ReadableStream<Block>, context: StreamContext): Promise<ReadableStream<Block>>;
523
+ transform(chunk: Block, enqueue: (block: Block) => void): void;
552
524
  }
553
525
  declare class SpliceNode extends TransformNode<SpliceProperties> {
554
- static readonly moduleName = "Splice";
526
+ static readonly nodeName = "Splice";
555
527
  static readonly packageName: string;
556
528
  static readonly packageVersion: string;
557
- static readonly moduleDescription = "Replace a region of audio with processed content";
529
+ static readonly nodeDescription = "Replace a region of audio with processed content";
558
530
  static readonly schema: z.ZodObject<{
559
531
  insertPath: z.ZodDefault<z.ZodString>;
560
532
  insertAt: z.ZodDefault<z.ZodNumber>;
561
533
  }, z.core.$strip>;
534
+ static readonly streamClass: typeof SpliceStream;
562
535
  static is(value: unknown): value is SpliceNode;
563
536
  readonly type: readonly ["buffered-audio-node", "transform", "splice"];
564
- createStream(): SpliceStream;
565
537
  clone(overrides?: Partial<SpliceProperties>): SpliceNode;
566
538
  }
567
539
  declare function splice(insertPath: string, insertAt: number, options?: {
@@ -577,23 +549,27 @@ declare const schema$c: z.ZodObject<{
577
549
  interface TrimProperties extends z.infer<typeof schema$c>, TransformNodeProperties {
578
550
  }
579
551
  declare class TrimStream extends BufferedTransformStream<TrimProperties> {
580
- _process(buffer: ChunkBuffer): Promise<void>;
552
+ blockSize: number;
553
+ private firstAbove;
554
+ private lastAbove;
555
+ private scanOffset;
556
+ prepare(block: Block): Block;
557
+ transform(buffered: BlockBuffer, enqueue: (block: Block) => void): Promise<void>;
581
558
  }
582
559
  declare class TrimNode extends TransformNode<TrimProperties> {
583
- static readonly moduleName = "Trim";
560
+ static readonly nodeName = "Trim";
584
561
  static readonly packageName: string;
585
562
  static readonly packageVersion: string;
586
- static readonly moduleDescription = "Remove silence from start and end";
563
+ static readonly nodeDescription = "Remove silence from start and end";
587
564
  static readonly schema: z.ZodObject<{
588
565
  threshold: z.ZodDefault<z.ZodNumber>;
589
566
  margin: z.ZodDefault<z.ZodNumber>;
590
567
  start: z.ZodDefault<z.ZodBoolean>;
591
568
  end: z.ZodDefault<z.ZodBoolean>;
592
569
  }, z.core.$strip>;
570
+ static readonly streamClass: typeof TrimStream;
593
571
  static is(value: unknown): value is TrimNode;
594
572
  readonly type: readonly ["buffered-audio-node", "transform", "trim"];
595
- constructor(properties: TrimProperties);
596
- createStream(): TrimStream;
597
573
  clone(overrides?: Partial<TrimProperties>): TrimNode;
598
574
  }
599
575
  declare function trim(options?: {
@@ -604,21 +580,18 @@ declare function trim(options?: {
604
580
  id?: string;
605
581
  }): TrimNode;
606
582
 
607
- /**
608
- * Downmix N channels to 1 by averaging all channels equally.
609
- */
610
- declare class DownmixMonoStream extends BufferedTransformStream {
611
- _unbuffer(chunk: AudioChunk): AudioChunk;
583
+ declare class DownmixMonoStream extends UnbufferedTransformStream {
584
+ transform(chunk: Block, enqueue: (block: Block) => void): void;
612
585
  }
613
586
  declare class DownmixMonoNode extends TransformNode {
614
- static readonly moduleName = "Downmix Mono";
587
+ static readonly nodeName = "Downmix Mono";
615
588
  static readonly packageName: string;
616
589
  static readonly packageVersion: string;
617
- static readonly moduleDescription = "Mix all input channels to a single mono channel by averaging";
590
+ static readonly nodeDescription = "Mix all input channels to a single mono channel by averaging";
618
591
  static readonly schema: z.ZodObject<{}, z.core.$strip>;
592
+ static readonly streamClass: typeof DownmixMonoStream;
619
593
  static is(value: unknown): value is DownmixMonoNode;
620
594
  readonly type: readonly ["buffered-audio-node", "transform", "downmix-mono"];
621
- createStream(): DownmixMonoStream;
622
595
  clone(overrides?: Partial<TransformNodeProperties>): DownmixMonoNode;
623
596
  }
624
597
  declare function downmixMono(options?: {
@@ -630,24 +603,20 @@ declare const schema$b: z.ZodObject<{
630
603
  }, z.core.$strip>;
631
604
  interface DuplicateChannelsProperties extends z.infer<typeof schema$b>, TransformNodeProperties {
632
605
  }
633
- /**
634
- * Duplicate a single mono channel into N identical output channels.
635
- * Requires exactly 1 input channel; throws for any other channel count.
636
- */
637
- declare class DuplicateChannelsStream extends BufferedTransformStream<DuplicateChannelsProperties> {
638
- _unbuffer(chunk: AudioChunk): AudioChunk;
606
+ declare class DuplicateChannelsStream extends UnbufferedTransformStream<DuplicateChannelsProperties> {
607
+ transform(chunk: Block, enqueue: (block: Block) => void): void;
639
608
  }
640
609
  declare class DuplicateChannelsNode extends TransformNode<DuplicateChannelsProperties> {
641
- static readonly moduleName = "Duplicate Channels";
610
+ static readonly nodeName = "Duplicate Channels";
642
611
  static readonly packageName: string;
643
612
  static readonly packageVersion: string;
644
- static readonly moduleDescription = "Duplicate a mono signal into multiple identical output channels";
613
+ static readonly nodeDescription = "Duplicate a mono signal into multiple identical output channels; requires exactly 1 input channel, throws otherwise";
645
614
  static readonly schema: z.ZodObject<{
646
615
  channels: z.ZodDefault<z.ZodNumber>;
647
616
  }, z.core.$strip>;
617
+ static readonly streamClass: typeof DuplicateChannelsStream;
648
618
  static is(value: unknown): value is DuplicateChannelsNode;
649
619
  readonly type: readonly ["buffered-audio-node", "transform", "duplicate-channels"];
650
- createStream(): DuplicateChannelsStream;
651
620
  clone(overrides?: Partial<DuplicateChannelsProperties>): DuplicateChannelsNode;
652
621
  }
653
622
  declare function duplicateChannels(options?: {
@@ -660,20 +629,20 @@ declare const schema$a: z.ZodObject<{
660
629
  }, z.core.$strip>;
661
630
  interface GainProperties extends z.infer<typeof schema$a>, TransformNodeProperties {
662
631
  }
663
- declare class GainStream extends BufferedTransformStream<GainProperties> {
664
- _unbuffer(chunk: AudioChunk): AudioChunk;
632
+ declare class GainStream extends UnbufferedTransformStream<GainProperties> {
633
+ transform(block: Block, enqueue: (block: Block) => void): void;
665
634
  }
666
635
  declare class GainNode extends TransformNode<GainProperties> {
667
- static readonly moduleName = "Gain";
636
+ static readonly nodeName = "Gain";
668
637
  static readonly packageName: string;
669
638
  static readonly packageVersion: string;
670
- static readonly moduleDescription = "Adjust signal level by a fixed amount in dB";
639
+ static readonly nodeDescription = "Adjust signal level by a fixed amount in dB";
671
640
  static readonly schema: z.ZodObject<{
672
641
  gain: z.ZodDefault<z.ZodNumber>;
673
642
  }, z.core.$strip>;
643
+ static readonly streamClass: typeof GainStream;
674
644
  static is(value: unknown): value is GainNode;
675
645
  readonly type: readonly ["buffered-audio-node", "transform", "gain"];
676
- createStream(): GainStream;
677
646
  clone(overrides?: Partial<GainProperties>): GainNode;
678
647
  }
679
648
  declare function gain(options?: {
@@ -686,28 +655,20 @@ declare const schema$9: z.ZodObject<{
686
655
  }, z.core.$strip>;
687
656
  interface PanProperties extends z.infer<typeof schema$9>, TransformNodeProperties {
688
657
  }
689
- /**
690
- * Pan transform.
691
- * - Mono input (1 ch): equal-power pan to stereo.
692
- * - Stereo input (2 ch): balance (pan shifts gain between existing L/R).
693
- * - More than 2 channels: throws (unsupported).
694
- *
695
- * Equal-power law: L = cos(θ), R = sin(θ), where θ = (pan + 1) / 2 * π/2.
696
- */
697
- declare class PanStream extends BufferedTransformStream<PanProperties> {
698
- _unbuffer(chunk: AudioChunk): AudioChunk;
658
+ declare class PanStream extends UnbufferedTransformStream<PanProperties> {
659
+ transform(chunk: Block, enqueue: (block: Block) => void): void;
699
660
  }
700
661
  declare class PanNode extends TransformNode<PanProperties> {
701
- static readonly moduleName = "Pan";
662
+ static readonly nodeName = "Pan";
702
663
  static readonly packageName: string;
703
664
  static readonly packageVersion: string;
704
- static readonly moduleDescription = "Position mono signal in stereo field or adjust stereo balance";
665
+ static readonly nodeDescription = "Position mono signal in stereo field or adjust stereo balance; throws for inputs with more than 2 channels";
705
666
  static readonly schema: z.ZodObject<{
706
667
  pan: z.ZodDefault<z.ZodNumber>;
707
668
  }, z.core.$strip>;
669
+ static readonly streamClass: typeof PanStream;
708
670
  static is(value: unknown): value is PanNode;
709
671
  readonly type: readonly ["buffered-audio-node", "transform", "pan"];
710
- createStream(): PanStream;
711
672
  clone(overrides?: Partial<PanProperties>): PanNode;
712
673
  }
713
674
  declare function pan(options?: {
@@ -720,39 +681,36 @@ interface FfmpegProperties extends TransformNodeProperties {
720
681
  readonly args?: Array<string> | ((context: StreamContext) => Array<string>);
721
682
  readonly outputSampleRate?: number;
722
683
  }
723
- declare class FfmpegStream<P extends FfmpegProperties = FfmpegProperties> extends BufferedTransformStream<P> {
684
+ declare class FfmpegStream<P extends FfmpegProperties = FfmpegProperties> extends UnbufferedTransformStream<P> {
724
685
  private streamContext?;
725
- private _sourceTotalFrames?;
726
686
  private child?;
687
+ private enqueueBlock?;
727
688
  private stdoutStash;
728
689
  private outputOffset;
729
690
  private stderr;
691
+ private stdinError?;
730
692
  private exitPromise?;
731
693
  private stdoutEndPromise?;
732
694
  private pendingDrain?;
733
695
  private inputSampleRate;
734
696
  private inputChannels;
735
- private hasStartedEvent;
736
- _setup(input: ReadableStream<AudioChunk>, context: StreamContext): Promise<ReadableStream<AudioChunk>>;
737
- protected _buildArgs(_context: StreamContext): Array<string>;
738
- protected _buildOutputArgs(_context: StreamContext): Array<string>;
739
- createTransformStream(): TransformStream<AudioChunk, AudioChunk>;
697
+ _setup(input: ReadableStream<Block>, context: StreamContext): Promise<ReadableStream<Block>>;
698
+ protected _buildArgs(context: StreamContext): Array<string>;
740
699
  private spawnChild;
741
700
  private handleStdoutBytes;
742
- private handleChunk;
743
- private handleFlushStream;
744
- _teardown(): Promise<void>;
701
+ transform(block: Block, enqueue: (block: Block) => void): Promise<void>;
702
+ flush(enqueue: (block: Block) => void): Promise<void>;
703
+ _destroy(): Promise<void>;
745
704
  }
746
705
  declare class FfmpegNode<P extends FfmpegProperties = FfmpegProperties> extends TransformNode<P> {
747
- static readonly moduleName: string;
706
+ static readonly nodeName: string;
748
707
  static readonly packageName: string;
749
708
  static readonly packageVersion: string;
750
- static readonly moduleDescription: string;
709
+ static readonly nodeDescription: string;
751
710
  static readonly schema: z.ZodType;
711
+ static readonly streamClass: typeof FfmpegStream;
752
712
  static is(value: unknown): value is FfmpegNode;
753
713
  readonly type: ReadonlyArray<string>;
754
- constructor(properties: P);
755
- createStream(): FfmpegStream<P>;
756
714
  clone(overrides?: Partial<P>): FfmpegNode<P>;
757
715
  }
758
716
  declare function ffmpeg(options: {
@@ -762,56 +720,6 @@ declare function ffmpeg(options: {
762
720
  id?: string;
763
721
  }): FfmpegNode;
764
722
 
765
- /**
766
- * Schema for the loudnessTarget node.
767
- *
768
- * Fits a source to a `(LUFS, true-peak)` target pair via a single
769
- * level-indexed gain curve with a peak-respecting smoothed gain
770
- * envelope. The curve carries an upper-arm peak anchor that gives
771
- * structural control over `targetTp` in the same envelope that lands
772
- * LUFS. See design-loudness-target §"Parameters" for the parameter
773
- * rationale and §"Two-pass node structure" for the stream structure.
774
- *
775
- * `pivot` is optional; when undefined the node derives it from
776
- * `median(considered LRA blocks)` (BS.1770 / EBU R128 two-stage gate)
777
- * on the pass-1 measurement — see design-loudness-target §"Pivot
778
- * semantic — lower bound of the gain-riding zone". `floor` is
779
- * optional; when undefined the curve has no pass-through region and
780
- * applies uniform body gain B below pivot. The `.refine()` enforces
781
- * `floor < pivot` only when both are set; per-field `.lt(0)` still
782
- * constrains each to dB < 0 when supplied.
783
- *
784
- * Iteration is 2D joint on `(B, peakGainDb)`. `limitDb` is set ONCE
785
- * from the measurement (or an explicit override) and is constant across
786
- * attempts. Initial `B` is seeded by a histogram-based LUFS predictor
787
- * (per `plan-loudness-target-deterministic` 2026-05-13 revert) so
788
- * attempt 1 lands close to target and the secant converges in fewer
789
- * attempts. Initial `peakGainDb` is the closed-form `effectiveTargetTp
790
- * − limitDb`; per-attempt proportional feedback on TP overshoot moves
791
- * it from there. LRA falls out as a consequence of the resulting
792
- * geometry — there is no LRA target axis.
793
- *
794
- * `targetTp` is the do-no-harm-default peak axis:
795
- * - `targetTp` undefined → `effectiveTargetTp = sourcePeakDb` and
796
- * `peakGainDb` collapses to 0; peaks track body lift unchanged.
797
- *
798
- * `limitDb` is the limit-anchor override. Default behaviour:
799
- * - unset → top-down percentile walk over the source's 4×-rate
800
- * detection-envelope histogram (`measureSource`'s `limitAutoDb`),
801
- * parameterised by `limitPercentile`.
802
- * - set → fix the limit anchor at this value (clamped to the per-
803
- * source feasible window inside the iterator).
804
- *
805
- * `limitPercentile` selects the brick-wall threshold's statistical
806
- * quantile on the detection histogram: with default `0.995` the top
807
- * 0.5 % of detection samples sit above `limitAutoDb` and brick-wall at
808
- * the target ceiling. Higher values → less limiting (tighter quantile);
809
- * lower values → more aggressive limiting.
810
- *
811
- * `smoothing` is the peak-respecting envelope time constant in ms;
812
- * collapses `K = W` window-half-width and bidirectional IIR time
813
- * constant into one user parameter.
814
- */
815
723
  declare const schema$8: z.ZodObject<{
816
724
  targetLufs: z.ZodDefault<z.ZodNumber>;
817
725
  pivot: z.ZodOptional<z.ZodNumber>;
@@ -827,79 +735,30 @@ declare const schema$8: z.ZodObject<{
827
735
  interface LoudnessTargetProperties extends z.infer<typeof schema$8>, TransformNodeProperties {
828
736
  }
829
737
  declare class LoudnessTargetStream extends BufferedTransformStream<LoudnessTargetProperties> {
830
- /**
831
- * BASE-rate peak-respecting smoothed gain envelope produced by the
832
- * winning iteration attempt, held as a disk-backed single-channel
833
- * `ChunkBuffer` of size `frames` (post the 2026-05-13 base-rate-
834
- * downstream rewrite; no `× OVERSAMPLE_FACTOR` factor). The
835
- * envelope is read chunk-by-chunk in `_unbuffer` rather than held
836
- * as a flat `Float32Array` — keeps RAM at ~10 MB regardless of
837
- * source length. `null` when the stream passes through (silent /
838
- * sub-block-length source).
839
- */
738
+ blockSize: number;
840
739
  private winningSmoothedEnvelopeBuffer;
841
- /**
842
- * Body gain `B` from the winning iteration attempt. `null` when the
843
- * stream passes through (no curve was learned). Diagnostic only —
844
- * the apply pass uses the materialised envelope, not `B` directly.
845
- */
846
740
  private winningB;
847
- /**
848
- * Limit anchor `limitDb` used for this source — constant across
849
- * iteration attempts. Sourced from `limitDbOverride` when explicit,
850
- * else from the percentile-derived `limitAutoDb` on the source's
851
- * detection-envelope histogram, else `sourcePeakDb` (no limiting).
852
- * `null` when the stream passes through. Diagnostic only.
853
- */
854
741
  private winningLimitDb;
855
- /**
856
- * `peakGainDb` from the winning attempt — the upper-segment right-
857
- * endpoint anchor gain. Starts at the closed-form
858
- * `effectiveTargetTp − limitDb` and adjusts via proportional
859
- * feedback on observed signed TP error. `null` when the stream
860
- * passes through.
861
- */
862
742
  private winningPeakGainDb;
863
- /**
864
- * Set to `true` by the first `_unbuffer` call so the
865
- * `winningSmoothedEnvelopeBuffer`'s read cursor is rewound exactly
866
- * once. The envelope is read-only in `_unbuffer` and consumed
867
- * forward in chunk-cadence lockstep with upstream chunks; this
868
- * lazy-reset pattern keeps the cursor management out of `_setup`.
869
- * Post the 2026-05-13 base-rate-downstream rewrite the
870
- * upsampled-source cache no longer exists — `_unbuffer` reads
871
- * source samples directly from the framework-provided chunk.
872
- */
873
- private unbufferCursorsReady;
874
- /**
875
- * Per-chunk wall-clock time spent in `_unbuffer`. Post the
876
- * 2026-05-13 base-rate-downstream rewrite, `_unbuffer` is a pure
877
- * base-rate multiply per chunk (no upsample, no downsample, no
878
- * AA filter — the smoothed envelope is bandlimited far below
879
- * base-rate Nyquist, so the multiply introduces no high-frequency
880
- * content). Accumulated across all `_unbuffer` calls.
881
- */
743
+ private measurementAccumulator?;
744
+ private capturedDetectionEnvelope;
882
745
  unbufferElapsedMs: number;
883
- /**
884
- * Wall-clock breakdown of the learn pass. `iteration` is the wall
885
- * time spent inside `iterateForTargets`. `detection` stays at 0 for
886
- * QA-driver log parity — detection-envelope build cost is folded
887
- * into `iteration`.
888
- */
889
746
  learnTimingMs: {
890
747
  sourceMeasurement: number;
891
748
  detection: number;
892
749
  iteration: number;
893
750
  };
894
- _process(buffer: ChunkBuffer): Promise<void>;
895
- _teardown(): Promise<void>;
896
- _unbuffer(chunk: AudioChunk): Promise<AudioChunk>;
751
+ prepare(block: Block): Promise<Block>;
752
+ transform(buffered: BlockBuffer, enqueue: (block: Block) => void): Promise<void>;
753
+ private finalize;
754
+ _destroy(): Promise<void>;
755
+ private emitApplied;
897
756
  }
898
757
  declare class LoudnessTargetNode extends TransformNode<LoudnessTargetProperties> {
899
- static readonly moduleName = "Loudness Target";
758
+ static readonly nodeName = "Loudness Target";
900
759
  static readonly packageName: string;
901
760
  static readonly packageVersion: string;
902
- static readonly moduleDescription = "Peak-aware content-adaptive curve fitting (LUFS, true-peak, LRA) via a single combined gain envelope with a peak-respecting two-stage smoother. The upper-arm peak anchor jointly iterates with the body gain to land both LUFS and true-peak targets in one envelope.";
761
+ static readonly nodeDescription = "Peak-aware content-adaptive curve fitting (LUFS, true-peak, LRA) via a single combined gain envelope with a peak-respecting two-stage smoother. The upper-arm peak anchor jointly iterates with the body gain to land both LUFS and true-peak targets in one envelope.";
903
762
  static readonly schema: z.ZodObject<{
904
763
  targetLufs: z.ZodDefault<z.ZodNumber>;
905
764
  pivot: z.ZodOptional<z.ZodNumber>;
@@ -912,10 +771,9 @@ declare class LoudnessTargetNode extends TransformNode<LoudnessTargetProperties>
912
771
  tolerance: z.ZodDefault<z.ZodNumber>;
913
772
  peakTolerance: z.ZodDefault<z.ZodNumber>;
914
773
  }, z.core.$strip>;
774
+ static readonly streamClass: typeof LoudnessTargetStream;
915
775
  static is(value: unknown): value is LoudnessTargetNode;
916
776
  readonly type: readonly ["buffered-audio-node", "transform", "loudness-target"];
917
- constructor(properties: LoudnessTargetProperties);
918
- createStream(): LoudnessTargetStream;
919
777
  clone(overrides?: Partial<LoudnessTargetProperties>): LoudnessTargetNode;
920
778
  }
921
779
  declare function loudnessTarget(options: {
@@ -938,22 +796,22 @@ declare const schema$7: z.ZodObject<{
938
796
  interface LoudnessNormalizeProperties extends z.infer<typeof schema$7>, TransformNodeProperties {
939
797
  }
940
798
  declare class LoudnessNormalizeStream extends BufferedTransformStream<LoudnessNormalizeProperties> {
941
- private gain;
942
- _process(buffer: ChunkBuffer): Promise<void>;
943
- _unbuffer(chunk: AudioChunk): AudioChunk;
799
+ blockSize: number;
800
+ private accumulator?;
801
+ prepare(block: Block): Block;
802
+ transform(buffered: BlockBuffer, enqueue: (block: Block) => void): Promise<void>;
944
803
  }
945
804
  declare class LoudnessNormalizeNode extends TransformNode<LoudnessNormalizeProperties> {
946
- static readonly moduleName = "Loudness Normalize";
805
+ static readonly nodeName = "Loudness Normalize";
947
806
  static readonly packageName: string;
948
807
  static readonly packageVersion: string;
949
- static readonly moduleDescription = "Measure integrated loudness (BS.1770) and apply a single linear gain to hit a target LUFS \u2014 no limiting, no dynamics";
808
+ static readonly nodeDescription = "Measure integrated loudness (BS.1770) and apply a single linear gain to hit a target LUFS \u2014 no limiting, no dynamics";
950
809
  static readonly schema: z.ZodObject<{
951
810
  target: z.ZodDefault<z.ZodNumber>;
952
811
  }, z.core.$strip>;
812
+ static readonly streamClass: typeof LoudnessNormalizeStream;
953
813
  static is(value: unknown): value is LoudnessNormalizeNode;
954
814
  readonly type: readonly ["buffered-audio-node", "transform", "loudness-normalize"];
955
- constructor(properties: LoudnessNormalizeProperties);
956
- createStream(): LoudnessNormalizeStream;
957
815
  clone(overrides?: Partial<LoudnessNormalizeProperties>): LoudnessNormalizeNode;
958
816
  }
959
817
  declare function loudnessNormalize(options?: {
@@ -967,22 +825,23 @@ declare const schema$6: z.ZodObject<{
967
825
  interface TruePeakNormalizeProperties extends z.infer<typeof schema$6>, TransformNodeProperties {
968
826
  }
969
827
  declare class TruePeakNormalizeStream extends BufferedTransformStream<TruePeakNormalizeProperties> {
970
- private gain;
971
- _process(buffer: ChunkBuffer): Promise<void>;
972
- _unbuffer(chunk: AudioChunk): AudioChunk;
828
+ blockSize: number;
829
+ private accumulator?;
830
+ prepare(block: Block): Block;
831
+ transform(buffered: BlockBuffer, enqueue: (block: Block) => void): Promise<void>;
832
+ private resolveGain;
973
833
  }
974
834
  declare class TruePeakNormalizeNode extends TransformNode<TruePeakNormalizeProperties> {
975
- static readonly moduleName = "True Peak Normalize";
835
+ static readonly nodeName = "True Peak Normalize";
976
836
  static readonly packageName: string;
977
837
  static readonly packageVersion: string;
978
- static readonly moduleDescription = "Measure source true peak (4\u00D7 upsampled, BS.1770-4 style) and apply a single linear gain to hit a target dBTP";
838
+ static readonly nodeDescription = "Measure source true peak (4\u00D7 upsampled, BS.1770-4 style) and apply a single linear gain to hit a target dBTP";
979
839
  static readonly schema: z.ZodObject<{
980
840
  target: z.ZodDefault<z.ZodNumber>;
981
841
  }, z.core.$strip>;
842
+ static readonly streamClass: typeof TruePeakNormalizeStream;
982
843
  static is(value: unknown): value is TruePeakNormalizeNode;
983
844
  readonly type: readonly ["buffered-audio-node", "transform", "true-peak-normalize"];
984
- constructor(properties: TruePeakNormalizeProperties);
985
- createStream(): TruePeakNormalizeStream;
986
845
  clone(overrides?: Partial<TruePeakNormalizeProperties>): TruePeakNormalizeNode;
987
846
  }
988
847
  declare function truePeakNormalize(options?: {
@@ -999,161 +858,29 @@ declare const schema$5: z.ZodObject<{
999
858
  interface CrestReduceProperties extends z.infer<typeof schema$5>, TransformNodeProperties {
1000
859
  }
1001
860
  declare class CrestReduceStream extends BufferedTransformStream<CrestReduceProperties> {
861
+ blockSize: number;
1002
862
  private fftBackend?;
1003
863
  private fftAddonOptions?;
1004
- /**
1005
- * Whole-file transformed output as a node-owned, disk-backed
1006
- * `ChunkBuffer` (the `loudnessTarget` `winningSmoothedEnvelopeBuffer`
1007
- * precedent — NOT a stream-resident full-length `Float32Array`, which
1008
- * was the design-streaming.md materialization anti-pattern Phase 2
1009
- * removes). `_process` writes the produced output here at flush;
1010
- * `_unbuffer` serves it chunk-by-chunk. `null` when the stream passes
1011
- * through (no audio or a sub-frame input — there is no `strength`
1012
- * bypass after the 2026-05-17 keystone; the node always runs the
1013
- * gate/search/lattice path), in which case `_unbuffer` emits the
1014
- * input verbatim (the length-preserving passthrough fallback).
1015
- */
1016
- private outputBuffer;
1017
- /**
1018
- * Set `true` by the first `_unbuffer` call so `outputBuffer`'s read
1019
- * cursor is rewound exactly once (it is at end-of-buffer after
1020
- * `_process`'s streaming production write). Rewound lazily in
1021
- * `_unbuffer` — after `_process` finished — not eagerly, so a stable
1022
- * cursor state exists (the `loudnessTarget` `unbufferCursorsReady`
1023
- * precedent).
1024
- */
1025
- private unbufferCursorReady;
1026
- _setup(input: ReadableStream<AudioChunk>, context: StreamContext): Promise<ReadableStream<AudioChunk>>;
864
+ private truePeakAccumulator?;
865
+ _setup(input: ReadableStream<Block>, context: StreamContext): Promise<ReadableStream<Block>>;
1027
866
  private get hopSize();
1028
- /**
1029
- * Whole-file processing at flush (the `loudnessTarget` accumulate-then-
1030
- * process precedent — `bufferSize === WHOLE_FILE`, so the framework hands
1031
- * the ENTIRE accumulated signal in one `_process` call). The SINGLE
1032
- * realization (2026-05-16 FUNDAMENTAL REFRAME — the normalized
1033
- * Gray–Markel lossless-lattice phase rotator; `spectral` and the
1034
- * `realization` parameter removed):
1035
- *
1036
- * The 2026-05-17 KEYSTONE rework — SINGLE-PASS, per-binding-peak
1037
- * Item-7 search over a TP-DRIVEN gate and a TP-DRIVEN commit
1038
- * objective; NO `strength` (the node always applies the optimal
1039
- * value); NO whole-signal never-worsen veto (the only never-worsen
1040
- * is the per-window commit-only-if-better intrinsic to the Item-7
1041
- * search):
1042
- *
1043
- * 1. WHOLE-SIGNAL 4× true peak + its input-sample index measured
1044
- * ONCE — a SEQUENTIAL CHUNKED WALK driving per-channel BS.1770-4
1045
- * 4× `TruePeakUpsampler`s directly
1046
- * (`measureBufferTruePeakWithArgmax`; 12-tap history carries
1047
- * across `upsample` so chunk boundaries are invisible). The dBTP
1048
- * is the gate's proximity reference; `peakInputSample`
1049
- * force-binds the analysis frame containing the file's global
1050
- * 4× true peak.
1051
- * 2. EXTRACT + TP-DRIVEN GATE + ITEM-7 SEARCH, one streaming
1052
- * sliding-window pass — `streamLatticeTrajectory(buffer, …,
1053
- * { globalTruePeakDb, peakInputSample, sampleRate, lambda })`: a
1054
- * `frameSize` ring of the linked-stereo sum + ONE per channel,
1055
- * computed on the fly (NO whole-signal array). Per hop the
1056
- * grounded Abel & Smith (Item 9) + RMV §III step-down (Item 8)
1057
- * reflection row is fitted VERBATIM; the frame is classified by
1058
- * the TP-DRIVEN gate predicate (`isBindingPeak` —
1059
- * `peakPriorityAmount` headroom AND ( the window's OWN
1060
- * per-channel 4× true peak within BINDING_DELTA_DB of the global
1061
- * 4× true peak, SAME true-peak domain — OR the global-4×-TP
1062
- * frame, force-bound ); `binding.ts` UNFROZEN); an ACTIVE-band
1063
- * peak frame runs the §Algorithm Specification Item-7 search
1064
- * (`searchBindingPeak`, Hong/Kim/Har 2011 §3; `search.ts`
1065
- * UNFROZEN — its COMMIT OBJECTIVE is the cross-channel 4×
1066
- * true-peak power, the Eq. 7–9 φ′ raw-sample recurrence kept as
1067
- * the candidate-proposal direction only) over the PER-CHANNEL
1068
- * windows with the FULL group-delay-ceiling λ — its committed
1069
- * scale (commit-only-if-better on the 4× TP power; identity
1070
- * `c=0` is the guaranteed floor) is the per-active-peak OPTIMAL
1071
- * decorrelation value; a NON-active frame's envelope value is 0.
1072
- * There is NO `strength` (λ is ALWAYS the full ceiling,
1073
- * `groupDelayLambda`). The O(frames) trajectory IS the
1074
- * decorrelation envelope (the ONLY resident product besides
1075
- * bounded scratch).
1076
- * 2b. COMBINE the envelope (the 2026-05-17 PER-PEAK-EXACT model):
1077
- * `smoothControlTrajectory` = `max` of a per-peak EXACT-OPTIMAL
1078
- * flat hold centered on the PEAK SAMPLE `n_i` (half-width
1079
- * `exactHoldHalfWidthFrames(sampleRate, hopSize)` — the
1080
- * group-delay span, NEVER `smoothing`) that pins the EXACT
1081
- * Item-7 optimal at every binding peak so whole-signal
1082
- * true-peak reduction is `smoothing`-INVARIANT, and a
1083
- * `smoothing`-driven bidirectional zero-phase SPILL
1084
- * (transient-asymmetry pullback pre-pass THEN forward+backward
1085
- * `BidirectionalIir` on the trajectory's FRAME-RATE axis,
1086
- * τ = (ms/1000)·√2 internal to `BidirectionalIir`) whose ONLY
1087
- * effect is decorrelation spill into the gated gaps + easing
1088
- * between active values. HARD RULE (design §Rejected
1089
- * Approaches): both passes are on the CONTROL trajectory ONLY —
1090
- * NEVER the audio.
1091
- * 3. ONE streaming PRODUCTION pass over the committed
1092
- * per-peak-exact + bidirectionally-SMOOTHED decorrelation
1093
- * envelope. `streamLatticeApply` is the byte-faithful
1094
- * `processLatticeChannel` transcription (lattice.ts BYTE-FROZEN)
1095
- * and is called with the literal `1` for its internal
1096
- * transcribed scalar (an identity no-op at the call site — an
1097
- * internal arg of the verbatim transcription, NOT a public
1098
- * surface; there is no `strength`). There is NO whole-signal
1099
- * never-worsen veto (removed — the per-window
1100
- * commit-only-if-better in the Item-7 search is the only
1101
- * never-worsen) and NO per-sample binding gate / edge crossfade:
1102
- * a non-active segment is the lattice at eased-to-zero
1103
- * coefficients (a crest-invariant pure delay). Each output chunk
1104
- * is written straight into the node-owned output `ChunkBuffer`
1105
- * (served chunk-by-chunk by `_unbuffer`). The streamed lattice
1106
- * output is BIT-IDENTICAL to processing one contiguous array.
1107
- *
1108
- * NO whole-signal `Float32Array` exists anywhere — the
1109
- * design-streaming.md materialization anti-pattern is GENUINELY
1110
- * eliminated (not relocated). Resident state: the O(frames) trajectory
1111
- * + mask + bounded ring (sum + per-channel) / accumulator / chunk
1112
- * scratch.
1113
- *
1114
- * There is NO node-level bypass (the `strength` parameter and its
1115
- * `strength <= 0` early-return were removed by the 2026-05-17
1116
- * keystone). The only passthrough is the length-preserving fallback
1117
- * for no audio / a sub-frame input (no analysis frame fits) —
1118
- * `_unbuffer` then emits the input verbatim.
1119
- */
1120
- _process(buffer: ChunkBuffer): Promise<void>;
1121
- /**
1122
- * Serve the whole-file transformed output sequentially in chunk cadence
1123
- * from the node-owned disk-backed `ChunkBuffer` (the `loudnessTarget`
1124
- * `_unbuffer` precedent — read forward in chunk-cadence lockstep with
1125
- * upstream chunks; NO overlap re-feed since `bufferSize === WHOLE_FILE`).
1126
- * When no transform was produced (no audio or a sub-frame input —
1127
- * there is no `strength` bypass after the 2026-05-17 keystone) the
1128
- * input chunk is emitted VERBATIM — the length-preserving passthrough
1129
- * fallback (nothing mutated, same backing arrays).
1130
- */
1131
- _unbuffer(chunk: AudioChunk): Promise<AudioChunk | undefined>;
1132
- /**
1133
- * Idempotent cleanup of the node-owned output `ChunkBuffer` so its
1134
- * backing temp file is released on EVERY exit path — not only graceful
1135
- * end-of-stream (the 2026-05-12 `_teardown`-guaranteed-cleanup
1136
- * Decision; the `loudnessTarget` precedent). `BufferedTransformStream`
1137
- * already closes its own accumulation `chunkBuffer` in `teardown()`;
1138
- * this node-owned extra buffer needs its own release.
1139
- */
1140
- _teardown(): Promise<void>;
867
+ prepare(block: Block): Block;
868
+ transform(buffered: BlockBuffer, enqueue: (block: Block) => void): Promise<void>;
1141
869
  }
1142
870
  declare class CrestReduceNode extends TransformNode<CrestReduceProperties> {
1143
- static readonly moduleName = "Crest Reduce";
871
+ static readonly nodeName = "Crest Reduce";
1144
872
  static readonly packageName: string;
1145
873
  static readonly packageVersion: string;
1146
- static readonly moduleDescription = "Content-adaptive, magnitude-preserving, phase-only crest-factor reducer \u2014 a pre-limiter headroom stage that rearranges signal phase to flatten true-peak excursions without changing the magnitude spectrum, never increasing crest factor";
874
+ static readonly nodeDescription = "Content-adaptive, magnitude-preserving, phase-only crest-factor reducer \u2014 a pre-limiter headroom stage that rearranges signal phase to flatten true-peak excursions without changing the magnitude spectrum, never increasing crest factor";
1147
875
  static readonly schema: z.ZodObject<{
1148
876
  smoothing: z.ZodDefault<z.ZodNumber>;
1149
877
  frameSize: z.ZodDefault<z.ZodNumber>;
1150
878
  vkfftAddonPath: z.ZodDefault<z.ZodString>;
1151
879
  fftwAddonPath: z.ZodDefault<z.ZodString>;
1152
880
  }, z.core.$strip>;
881
+ static readonly streamClass: typeof CrestReduceStream;
1153
882
  static is(value: unknown): value is CrestReduceNode;
1154
883
  readonly type: readonly ["buffered-audio-node", "transform", "crest-reduce"];
1155
- constructor(properties: CrestReduceProperties);
1156
- createStream(): CrestReduceStream;
1157
884
  clone(overrides?: Partial<CrestReduceProperties>): CrestReduceNode;
1158
885
  }
1159
886
  declare function crestReduce(options?: {
@@ -1182,43 +909,8 @@ declare const schema$4: z.ZodObject<{
1182
909
  }, z.core.$strip>;
1183
910
  interface DeBleedProperties extends z.infer<typeof schema$4>, TransformNodeProperties {
1184
911
  }
1185
- /**
1186
- * Adaptive de-bleed node — MEF FDAF Kalman + MWF + Lukin-Todd post-filter.
1187
- *
1188
- * Pipeline per design-de-bleed.md "2026-05-01: Replace stages 1+2 with MEF":
1189
- *
1190
- * - **Stage 0 (MSAD)**: per-band SNR thresholding to gate Kalman update and
1191
- * trigger ISP restoration.
1192
- * - **Stage 1 (FDAF Kalman)**: per-frame frequency-domain Kalman update
1193
- * on `Ĥ_{m,μ}(ℓ,k)` per (target, reference) pair.
1194
- * - **Stage 2 (MWF)**: per-frame Wiener gain mask with per-interferer PSD
1195
- * `Φ̂_{D̂D̂,m} = |D̂_m^total|²` smoothed temporally (β = 0.5 MEF default).
1196
- * - **Stage 3 (NLM + DFTT)**: Lukin-Todd 2D smoothing of the gain mask.
1197
- * - **Stage 4 (synthesis)**: iSTFT of the masked target STFT.
1198
- *
1199
- * **IO pattern** (post chunk-buffer-sequential-api refactor): the target
1200
- * `buffer` is treated as read-only during `_process`; a fresh `outputBuffer`
1201
- * is allocated, all processed audio is streamed sequentially into it, then the
1202
- * input buffer is cleared and the output is stream-copied back. The
1203
- * `WindowReader` helper maintains a per-buffer sample-domain scratch that
1204
- * advances in lockstep with the outer chunk loop — replacing the prior
1205
- * offset-based reads against the input buffer. References use the same
1206
- * `WindowReader` pattern, driven in lockstep with the target.
1207
- *
1208
- * **Outer-loop ordering**: all channels processed in lockstep per chunk
1209
- * (option A from the Phase 6 plan). The per-channel algorithmic state
1210
- * (Kalman, MWF PSD, MSAD, ISP) has no cross-channel coupling, so reordering
1211
- * the inherent two nested loops from `for ch: for chunk` to
1212
- * `for chunk: for ch` is a pure refactor with no algorithmic effect. This is
1213
- * required by the new sequential ChunkBuffer API: `outputBuffer.write` stores
1214
- * all channels at each frame position, so we must produce all channels'
1215
- * samples for a given output frame range in one go.
1216
- *
1217
- * **Hard "do not extend" boundary** (Kokkinis): per-interferer PSD is
1218
- * `|D̂^WF|²` from the Kalman bleed estimate ONLY. No PSD envelope of target,
1219
- * no dominant-bin selection, no coherence-based interferer-PSD estimator.
1220
- */
1221
912
  declare class DeBleedStream extends BufferedTransformStream<DeBleedProperties> {
913
+ blockSize: number;
1222
914
  private fftBackend?;
1223
915
  private fftAddonOptions?;
1224
916
  private dfttFftBackend?;
@@ -1226,30 +918,16 @@ declare class DeBleedStream extends BufferedTransformStream<DeBleedProperties> {
1226
918
  private referenceBuffers;
1227
919
  private chunkFrames;
1228
920
  private numBins;
1229
- _setup(input: ReadableStream<AudioChunk>, context: StreamContext): Promise<ReadableStream<AudioChunk>>;
1230
- _teardown(): Promise<void>;
1231
- /**
1232
- * Run the first-N-seconds warm-up scan across all target channels and all
1233
- * references in a single sequential pass over each buffer.
1234
- *
1235
- * Each buffer is rewound to its start, then sequentially read for
1236
- * `warmupSamples` real samples. STFTs are computed once per buffer (one
1237
- * STFT per channel for the multi-channel target, one STFT per reference
1238
- * for the references). Per-channel cross-spectral accumulators then
1239
- * consume the pre-computed STFTs.
1240
- *
1241
- * Returns a `channels × refCount` array of `TransferFunction` seeds:
1242
- * `seedsByChannel[ch][refIndex]`. Degeneracy validation and cold-start
1243
- * fallback per `validateTransferSeed`.
1244
- */
921
+ _setup(input: ReadableStream<Block>, context: StreamContext): Promise<ReadableStream<Block>>;
922
+ _destroy(): Promise<void>;
1245
923
  private warmupSeedsAllChannels;
1246
- _process(buffer: ChunkBuffer): Promise<void>;
924
+ transform(buffered: BlockBuffer, enqueue: (block: Block) => void): Promise<void>;
1247
925
  }
1248
926
  declare class DeBleedNode extends TransformNode<DeBleedProperties> {
1249
- static readonly moduleName = "De-Bleed Adaptive";
927
+ static readonly nodeName = "De-Bleed Adaptive";
1250
928
  static readonly packageName: string;
1251
929
  static readonly packageVersion: string;
1252
- static readonly moduleDescription = "Adaptive (MEF FDAF Kalman + MWF + MSAD) reference-based microphone bleed reduction. Stages 1+2 are MEF Meyer-Elshamy-Fingscheidt 2020; Stage 3 is Lukin-Todd 2D NLM+DFTT post-filter.";
930
+ static readonly nodeDescription = "Adaptive (MEF FDAF Kalman + MWF + MSAD) reference-based microphone bleed reduction. Stages 1+2 are MEF Meyer-Elshamy-Fingscheidt 2020; Stage 3 is Lukin-Todd 2D NLM+DFTT post-filter.";
1253
931
  static readonly schema: z.ZodObject<{
1254
932
  references: z.ZodDefault<z.ZodArray<z.ZodString>>;
1255
933
  reductionStrength: z.ZodDefault<z.ZodNumber>;
@@ -1266,10 +944,9 @@ declare class DeBleedNode extends TransformNode<DeBleedProperties> {
1266
944
  js: "js";
1267
945
  }>>;
1268
946
  }, z.core.$strip>;
947
+ static readonly streamClass: typeof DeBleedStream;
1269
948
  static is(value: unknown): value is DeBleedNode;
1270
949
  readonly type: readonly ["buffered-audio-node", "transform", "de-bleed"];
1271
- constructor(properties: DeBleedProperties);
1272
- createStream(): DeBleedStream;
1273
950
  clone(overrides?: Partial<DeBleedProperties>): DeBleedNode;
1274
951
  }
1275
952
  declare function deBleed(references: string | ReadonlyArray<string>, options?: {
@@ -1294,17 +971,18 @@ declare const schema$3: z.ZodObject<{
1294
971
  interface DeepFilterNet3Properties extends z.infer<typeof schema$3>, TransformNodeProperties {
1295
972
  }
1296
973
  declare class DeepFilterNet3Stream extends BufferedTransformStream<DeepFilterNet3Properties> {
974
+ blockSize: number;
1297
975
  private session?;
1298
976
  private dfnStates;
1299
- _setup(input: ReadableStream<AudioChunk>, context: StreamContext): Promise<ReadableStream<AudioChunk>>;
1300
- _process(buffer: ChunkBuffer): Promise<void>;
1301
- _teardown(): void;
977
+ _setup(input: ReadableStream<Block>, context: StreamContext): Promise<ReadableStream<Block>>;
978
+ transform(buffered: BlockBuffer, enqueue: (block: Block) => void): Promise<void>;
979
+ _destroy(): void;
1302
980
  }
1303
981
  declare class DeepFilterNet3Node extends TransformNode<DeepFilterNet3Properties> {
1304
- static readonly moduleName = "DeepFilterNet3 (Denoiser)";
982
+ static readonly nodeName = "DeepFilterNet3 (Denoiser)";
1305
983
  static readonly packageName: string;
1306
984
  static readonly packageVersion: string;
1307
- static readonly moduleDescription = "Remove background noise from speech using DeepFilterNet3 (48 kHz full-band CRN)";
985
+ static readonly nodeDescription = "Remove background noise from speech using DeepFilterNet3 (48 kHz full-band CRN)";
1308
986
  static readonly schema: z.ZodObject<{
1309
987
  modelPath: z.ZodDefault<z.ZodString>;
1310
988
  ffmpegPath: z.ZodDefault<z.ZodString>;
@@ -1312,10 +990,9 @@ declare class DeepFilterNet3Node extends TransformNode<DeepFilterNet3Properties>
1312
990
  sampleRate: z.ZodNumber;
1313
991
  attenuation: z.ZodDefault<z.ZodNumber>;
1314
992
  }, z.core.$strip>;
993
+ static readonly streamClass: typeof DeepFilterNet3Stream;
1315
994
  static is(value: unknown): value is DeepFilterNet3Node;
1316
995
  readonly type: readonly ["buffered-audio-node", "transform", "deep-filter-net-3"];
1317
- constructor(properties: DeepFilterNet3Properties);
1318
- createStream(): DeepFilterNet3Stream;
1319
996
  clone(overrides?: Partial<DeepFilterNet3Properties>): DeepFilterNet3Node;
1320
997
  }
1321
998
  declare function deepFilterNet3(options: {
@@ -1338,19 +1015,20 @@ declare const schema$2: z.ZodObject<{
1338
1015
  interface DtlnProperties extends z.infer<typeof schema$2>, TransformNodeProperties {
1339
1016
  }
1340
1017
  declare class DtlnStream extends BufferedTransformStream<DtlnProperties> {
1018
+ blockSize: number;
1341
1019
  private session1;
1342
1020
  private session2;
1343
1021
  private fftBackend?;
1344
1022
  private fftAddonOptions?;
1345
- _setup(input: ReadableStream<AudioChunk>, context: StreamContext): Promise<ReadableStream<AudioChunk>>;
1346
- _process(buffer: ChunkBuffer): Promise<void>;
1023
+ _setup(input: ReadableStream<Block>, context: StreamContext): Promise<ReadableStream<Block>>;
1024
+ transform(buffered: BlockBuffer, enqueue: (block: Block) => void): Promise<void>;
1347
1025
  private runMainPass;
1348
1026
  }
1349
1027
  declare class DtlnNode extends TransformNode<DtlnProperties> {
1350
- static readonly moduleName = "DTLN (Denoiser)";
1028
+ static readonly nodeName = "DTLN (Denoiser)";
1351
1029
  static readonly packageName: string;
1352
1030
  static readonly packageVersion: string;
1353
- static readonly moduleDescription = "Remove background noise from speech using DTLN neural network";
1031
+ static readonly nodeDescription = "Remove background noise from speech using DTLN neural network";
1354
1032
  static readonly schema: z.ZodObject<{
1355
1033
  modelPath1: z.ZodDefault<z.ZodString>;
1356
1034
  modelPath2: z.ZodDefault<z.ZodString>;
@@ -1359,10 +1037,9 @@ declare class DtlnNode extends TransformNode<DtlnProperties> {
1359
1037
  vkfftAddonPath: z.ZodDefault<z.ZodString>;
1360
1038
  fftwAddonPath: z.ZodDefault<z.ZodString>;
1361
1039
  }, z.core.$strip>;
1040
+ static readonly streamClass: typeof DtlnStream;
1362
1041
  static is(value: unknown): value is DtlnNode;
1363
1042
  readonly type: readonly ["buffered-audio-node", "transform", "dtln"];
1364
- constructor(properties: DtlnProperties);
1365
- createStream(): DtlnStream;
1366
1043
  clone(overrides?: Partial<DtlnProperties>): DtlnNode;
1367
1044
  }
1368
1045
  declare function dtln(options: {
@@ -1392,17 +1069,18 @@ interface HtdemucsProperties extends z.infer<typeof schema$1>, TransformNodeProp
1392
1069
  readonly stems: StemGains;
1393
1070
  }
1394
1071
  declare class HtdemucsStream extends BufferedTransformStream<HtdemucsProperties> {
1072
+ blockSize: number;
1395
1073
  private session;
1396
- _setup(input: ReadableStream<AudioChunk>, context: StreamContext): Promise<ReadableStream<AudioChunk>>;
1397
- _process(buffer: ChunkBuffer): Promise<void>;
1074
+ _setup(input: ReadableStream<Block>, context: StreamContext): Promise<ReadableStream<Block>>;
1075
+ transform(buffered: BlockBuffer, enqueue: (block: Block) => void): Promise<void>;
1398
1076
  private runMainPass;
1399
1077
  private emitStable;
1400
1078
  }
1401
1079
  declare class HtdemucsNode extends TransformNode<HtdemucsProperties> {
1402
- static readonly moduleName = "HTDemucs (Stem Separator)";
1080
+ static readonly nodeName = "HTDemucs (Stem Separator)";
1403
1081
  static readonly packageName: string;
1404
1082
  static readonly packageVersion: string;
1405
- static readonly moduleDescription = "Rebalance stem volumes using HTDemucs source separation";
1083
+ static readonly nodeDescription = "Rebalance stem volumes using HTDemucs source separation";
1406
1084
  static readonly schema: z.ZodObject<{
1407
1085
  modelPath: z.ZodDefault<z.ZodString>;
1408
1086
  ffmpegPath: z.ZodDefault<z.ZodString>;
@@ -1410,10 +1088,9 @@ declare class HtdemucsNode extends TransformNode<HtdemucsProperties> {
1410
1088
  highPass: z.ZodDefault<z.ZodNumber>;
1411
1089
  lowPass: z.ZodDefault<z.ZodNumber>;
1412
1090
  }, z.core.$strip>;
1091
+ static readonly streamClass: typeof HtdemucsStream;
1413
1092
  static is(value: unknown): value is HtdemucsNode;
1414
1093
  readonly type: readonly ["buffered-audio-node", "transform", "htdemucs"];
1415
- constructor(properties: HtdemucsProperties);
1416
- createStream(): HtdemucsStream;
1417
1094
  clone(overrides?: Partial<HtdemucsProperties>): HtdemucsNode;
1418
1095
  }
1419
1096
  declare function htdemucs(modelPath: string, stems: Partial<StemGains>, options?: {
@@ -1432,19 +1109,20 @@ declare const schema: z.ZodObject<{
1432
1109
  interface KimVocal2Properties extends z.infer<typeof schema>, TransformNodeProperties {
1433
1110
  }
1434
1111
  declare class KimVocal2Stream extends BufferedTransformStream<KimVocal2Properties> {
1112
+ blockSize: number;
1435
1113
  private session;
1436
1114
  private fftInstance;
1437
- constructor(properties: KimVocal2Properties);
1438
- _setup(input: ReadableStream<AudioChunk>, context: StreamContext): Promise<ReadableStream<AudioChunk>>;
1439
- _process(buffer: ChunkBuffer): Promise<void>;
1115
+ constructor(node: BufferedAudioNode);
1116
+ _setup(input: ReadableStream<Block>, context: StreamContext): Promise<ReadableStream<Block>>;
1117
+ transform(buffered: BlockBuffer, enqueue: (block: Block) => void): Promise<void>;
1440
1118
  private runMainPass;
1441
1119
  private emitStable;
1442
1120
  }
1443
1121
  declare class KimVocal2Node extends TransformNode<KimVocal2Properties> {
1444
- static readonly moduleName = "Kim Vocal 2 (Stem Separator)";
1122
+ static readonly nodeName = "Kim Vocal 2 (Stem Separator)";
1445
1123
  static readonly packageName: string;
1446
1124
  static readonly packageVersion: string;
1447
- static readonly moduleDescription = "Isolate dialogue from background using MDX-Net vocal separation";
1125
+ static readonly nodeDescription = "Isolate dialogue from background using MDX-Net vocal separation";
1448
1126
  static readonly schema: z.ZodObject<{
1449
1127
  modelPath: z.ZodDefault<z.ZodString>;
1450
1128
  ffmpegPath: z.ZodDefault<z.ZodString>;
@@ -1452,10 +1130,9 @@ declare class KimVocal2Node extends TransformNode<KimVocal2Properties> {
1452
1130
  highPass: z.ZodDefault<z.ZodNumber>;
1453
1131
  lowPass: z.ZodDefault<z.ZodNumber>;
1454
1132
  }, z.core.$strip>;
1133
+ static readonly streamClass: typeof KimVocal2Stream;
1455
1134
  static is(value: unknown): value is KimVocal2Node;
1456
1135
  readonly type: readonly ["buffered-audio-node", "transform", "kim-vocal-2"];
1457
- constructor(properties: KimVocal2Properties);
1458
- createStream(): KimVocal2Stream;
1459
1136
  clone(overrides?: Partial<KimVocal2Properties>): KimVocal2Node;
1460
1137
  }
1461
1138
  declare function kimVocal2(options: {
@@ -1471,65 +1148,32 @@ interface VstStage {
1471
1148
  readonly pluginPath: string;
1472
1149
  readonly pluginName?: string;
1473
1150
  readonly presetPath?: string;
1474
- /**
1475
- * Optional parameter overrides applied after `presetPath` loads. Keys map
1476
- * to Pedalboard parameter names exposed by the plugin (lowercase / snake-
1477
- * cased identifiers — see `plugin.parameters` in Pedalboard). Useful for
1478
- * plugins whose on-disk preset format Pedalboard's `load_preset` rejects
1479
- * (e.g. Waves XPst inside a VST3 wrapper) but whose parameter surface is
1480
- * reachable directly.
1481
- */
1482
- readonly parameters?: Readonly<Record<string, number | string | boolean>>;
1483
1151
  }
1484
1152
 
1485
1153
  interface Vst3Properties extends TransformNodeProperties {
1486
1154
  readonly vstHostPath: string;
1487
1155
  readonly stages: ReadonlyArray<VstStage>;
1488
1156
  readonly bypass?: boolean;
1489
- /**
1490
- * Extra args appended after the canonical CLI args. Test-only; allows the
1491
- * unit tests to spawn `node <stub.mjs>` by passing `node` as `vstHostPath`
1492
- * and `[stub.mjs]` here.
1493
- */
1494
1157
  readonly extraArgs?: ReadonlyArray<string>;
1495
1158
  }
1496
- /**
1497
- * Whole-file VST3 chain stream. The framework drives `_process` exactly once
1498
- * (after the upstream EOF flushes the accumulated buffer at `bufferSize:
1499
- * WHOLE_FILE`). The buffer is streamed through a `vst-host` subprocess that
1500
- * runs Pedalboard's offline mode (`reset=True`) over the configured chain;
1501
- * Pedalboard handles plugin delay compensation internally so the returned
1502
- * audio is sample-aligned with the input — no leading silence, no tail loss.
1503
- *
1504
- * Memory discipline: although `bufferSize: WHOLE_FILE` schedules the
1505
- * `_process` call after EOF, the JS-side memory cost is bounded.
1506
- * `processStreamingThroughVstHost` drains the buffer to subprocess stdin in
1507
- * `CHUNK_FRAMES`-sized chunks, then `clear()`s the buffer (Pedalboard's
1508
- * offline mode has captured the full input internally by then), then drains
1509
- * subprocess stdout chunk-by-chunk back into the SAME buffer. No temp
1510
- * ChunkBuffer, no stream-copy phase. Disk usage stays at 1× source size.
1511
- * The subprocess holds the full interleaved input in its own RAM
1512
- * (Pedalboard's offline-mode constraint), but that's not part of the Node
1513
- * heap.
1514
- */
1515
1159
  declare class Vst3Stream<P extends Vst3Properties = Vst3Properties> extends BufferedTransformStream<P> {
1160
+ blockSize: number;
1516
1161
  private streamContext?;
1517
1162
  private stagesJsonPath?;
1518
1163
  private stagesJsonCleanup?;
1519
- _setup(input: ReadableStream<AudioChunk>, context: StreamContext): Promise<ReadableStream<AudioChunk>>;
1520
- _process(buffer: ChunkBuffer): Promise<void>;
1521
- _teardown(): Promise<void>;
1164
+ _setup(input: ReadableStream<Block>, context: StreamContext): Promise<ReadableStream<Block>>;
1165
+ transform(buffered: BlockBuffer, enqueue: (block: Block) => void): Promise<void>;
1166
+ _destroy(): Promise<void>;
1522
1167
  }
1523
1168
  declare class Vst3Node<P extends Vst3Properties = Vst3Properties> extends TransformNode<P> {
1524
- static readonly moduleName: string;
1169
+ static readonly nodeName: string;
1525
1170
  static readonly packageName: string;
1526
1171
  static readonly packageVersion: string;
1527
- static readonly moduleDescription: string;
1172
+ static readonly nodeDescription: string;
1528
1173
  static readonly schema: z.ZodType;
1174
+ static readonly streamClass: typeof Vst3Stream;
1529
1175
  static is(value: unknown): value is Vst3Node;
1530
1176
  readonly type: ReadonlyArray<string>;
1531
- constructor(properties: P);
1532
- createStream(): BufferedTransformStream<P>;
1533
1177
  clone(overrides?: Partial<P>): Vst3Node<P>;
1534
1178
  }
1535
1179
  declare function vst3(options: {
@@ -1540,18 +1184,9 @@ declare function vst3(options: {
1540
1184
  extraArgs?: ReadonlyArray<string>;
1541
1185
  }): Vst3Node;
1542
1186
 
1543
- declare class ChainNode extends CompositeNode {
1544
- static readonly packageName: string;
1545
- static readonly packageVersion: string;
1546
- readonly type: readonly ["buffered-audio-node", "transform", "composite", "chain"];
1547
- private readonly _head;
1548
- private readonly _tail;
1549
- constructor(head: BufferedAudioNode, tail: BufferedAudioNode);
1550
- get head(): BufferedAudioNode;
1551
- get tail(): BufferedAudioNode;
1552
- createStream(): BufferedTransformStream;
1553
- clone(): ChainNode;
1554
- }
1555
- declare function chain(...nodes: Array<BufferedAudioNode | CompositeNode>): ChainNode;
1187
+ interface Chain extends Composition {
1188
+ to(child: BufferedAudioNode | Composition): void;
1189
+ }
1190
+ declare function chain(...items: Array<BufferedAudioNode | Composition>): Chain;
1556
1191
 
1557
- export { ChainNode, CrestReduceNode, type CrestReduceProperties, CrestReduceStream, CutNode, type CutProperties, type CutRegion, CutStream, DeBleedNode, type DeBleedProperties, DeBleedStream, DeepFilterNet3Node, type DeepFilterNet3Properties, DeepFilterNet3Stream, DitherNode, type DitherProperties, DitherStream, DownmixMonoNode, DownmixMonoStream, DtlnNode, type DtlnProperties, DtlnStream, DuplicateChannelsNode, type DuplicateChannelsProperties, DuplicateChannelsStream, type EncodingOptions, FfmpegNode, type FfmpegProperties, FfmpegStream, type FrequencyScale, GainNode, type GainProperties, GainStream, HtdemucsNode, type HtdemucsProperties, HtdemucsStream, KimVocal2Node, type KimVocal2Properties, KimVocal2Stream, LoudnessNormalizeNode, type LoudnessNormalizeProperties, LoudnessNormalizeStream, type LoudnessStats, LoudnessStatsNode, LoudnessStatsStream, LoudnessTargetNode, type LoudnessTargetProperties, LoudnessTargetStream, NormalizeNode, type NormalizeProperties, NormalizeStream, PadNode, type PadProperties, PadStream, PanNode, type PanProperties, PanStream, PhaseNode, type PhaseProperties, PhaseStream, ReadFfmpegNode, type ReadFfmpegProperties, ReadFfmpegStream, ReadNode, type ReadProperties, ReadWavNode, type ReadWavProperties, ReadWavStream, ReverseNode, ReverseStream, SpectrogramNode, type SpectrogramProperties, SpectrogramStream, SpliceNode, type SpliceProperties, SpliceStream, type StemGains, TrimNode, type TrimProperties, TrimStream, TruePeakNormalizeNode, type TruePeakNormalizeProperties, TruePeakNormalizeStream, Vst3Node, type Vst3Properties, Vst3Stream, type WavBitDepth, WaveformNode, type WaveformProperties, WaveformStream, WriteNode, type WriteProperties, WriteStream, chain, crestReduce, cut, deBleed, deepFilterNet3, dither, downmixMono, dtln, duplicateChannels, ffmpeg, ffmpegSchema, gain, htdemucs, invert, kimVocal2, loudnessNormalize, loudnessStats, loudnessTarget, normalize, pad, pan, phase, read, readFfmpeg, readSample, readWav, reverse, spectrogram, splice, trim, truePeakNormalize, vst3, wavSchema, waveform, write };
1192
+ export { type Chain, CrestReduceNode, type CrestReduceProperties, CrestReduceStream, CutNode, type CutProperties, type CutRegion, CutStream, DeBleedNode, type DeBleedProperties, DeBleedStream, DeepFilterNet3Node, type DeepFilterNet3Properties, DeepFilterNet3Stream, DitherNode, type DitherProperties, DitherStream, DownmixMonoNode, DownmixMonoStream, DtlnNode, type DtlnProperties, DtlnStream, DuplicateChannelsNode, type DuplicateChannelsProperties, DuplicateChannelsStream, type EncodingOptions, FfmpegNode, type FfmpegProperties, FfmpegStream, type FrequencyScale, GainNode, type GainProperties, GainStream, HtdemucsNode, type HtdemucsProperties, HtdemucsStream, KimVocal2Node, type KimVocal2Properties, KimVocal2Stream, LoudnessNormalizeNode, type LoudnessNormalizeProperties, LoudnessNormalizeStream, type LoudnessStats, LoudnessStatsNode, LoudnessStatsStream, LoudnessTargetNode, type LoudnessTargetProperties, LoudnessTargetStream, NormalizeNode, type NormalizeProperties, NormalizeStream, PadNode, type PadProperties, PadStream, PanNode, type PanProperties, PanStream, PhaseNode, type PhaseProperties, PhaseStream, ReadFfmpegNode, type ReadFfmpegProperties, ReadFfmpegStream, ReadWavNode, type ReadWavProperties, ReadWavStream, ReverseNode, ReverseStream, SpectrogramNode, type SpectrogramProperties, SpectrogramStream, SpliceNode, type SpliceProperties, SpliceStream, type StemGains, TrimNode, type TrimProperties, TrimStream, TruePeakNormalizeNode, type TruePeakNormalizeProperties, TruePeakNormalizeStream, Vst3Node, type Vst3Properties, Vst3Stream, type WavBitDepth, WaveformNode, type WaveformProperties, WaveformStream, WriteNode, type WriteProperties, WriteStream, chain, crestReduce, cut, deBleed, deepFilterNet3, dither, downmixMono, dtln, duplicateChannels, ffmpeg, ffmpegSchema, gain, htdemucs, invert, kimVocal2, loudnessNormalize, loudnessStats, loudnessTarget, normalize, pad, pan, phase, read, readFfmpeg, readSample, readWav, reverse, spectrogram, splice, trim, truePeakNormalize, vst3, wavSchema, waveform, write };