@buffered-audio/nodes 0.0.0 → 0.15.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/README.md +566 -0
- package/dist/cli.js +85 -0
- package/dist/index.d.ts +1557 -0
- package/dist/index.js +37589 -0
- package/package.json +52 -3
package/dist/index.d.ts
ADDED
|
@@ -0,0 +1,1557 @@
|
|
|
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';
|
|
4
|
+
|
|
5
|
+
declare const ffmpegSchema: z.ZodObject<{
|
|
6
|
+
path: z.ZodDefault<z.ZodString>;
|
|
7
|
+
ffmpegPath: z.ZodDefault<z.ZodString>;
|
|
8
|
+
ffprobePath: z.ZodDefault<z.ZodString>;
|
|
9
|
+
}, z.core.$strip>;
|
|
10
|
+
interface ReadFfmpegProperties extends z.infer<typeof ffmpegSchema>, SourceNodeProperties {
|
|
11
|
+
readonly channels?: ReadonlyArray<number>;
|
|
12
|
+
}
|
|
13
|
+
declare class ReadFfmpegStream<P extends ReadFfmpegProperties = ReadFfmpegProperties> extends BufferedSourceStream<P> {
|
|
14
|
+
private ffmpegProcess?;
|
|
15
|
+
private stdout?;
|
|
16
|
+
private frameOffset;
|
|
17
|
+
private remainder?;
|
|
18
|
+
private outputChannels;
|
|
19
|
+
private sourceSampleRate;
|
|
20
|
+
private sourceBitDepth;
|
|
21
|
+
getMetadata(): Promise<SourceMetadata>;
|
|
22
|
+
private ensureInitialized;
|
|
23
|
+
_read(): Promise<AudioChunk | undefined>;
|
|
24
|
+
_flush(): Promise<void>;
|
|
25
|
+
_teardown(): void;
|
|
26
|
+
private probe;
|
|
27
|
+
private readBytes;
|
|
28
|
+
}
|
|
29
|
+
declare class ReadFfmpegNode extends SourceNode<ReadFfmpegProperties> {
|
|
30
|
+
static readonly moduleName = "Read FFmpeg";
|
|
31
|
+
static readonly packageName: string;
|
|
32
|
+
static readonly packageVersion: string;
|
|
33
|
+
static readonly moduleDescription = "Read audio from a file using FFmpeg";
|
|
34
|
+
static readonly schema: z.ZodObject<{
|
|
35
|
+
path: z.ZodDefault<z.ZodString>;
|
|
36
|
+
ffmpegPath: z.ZodDefault<z.ZodString>;
|
|
37
|
+
ffprobePath: z.ZodDefault<z.ZodString>;
|
|
38
|
+
}, z.core.$strip>;
|
|
39
|
+
readonly type: readonly ["buffered-audio-node", "source", "read-ffmpeg"];
|
|
40
|
+
protected createStream(): ReadFfmpegStream;
|
|
41
|
+
clone(overrides?: Partial<ReadFfmpegProperties>): ReadFfmpegNode;
|
|
42
|
+
}
|
|
43
|
+
declare function readFfmpeg(path: string, options: {
|
|
44
|
+
channels?: ReadonlyArray<number>;
|
|
45
|
+
ffmpegPath: string;
|
|
46
|
+
ffprobePath: string;
|
|
47
|
+
}): ReadFfmpegNode;
|
|
48
|
+
|
|
49
|
+
declare const wavSchema: z.ZodObject<{
|
|
50
|
+
path: z.ZodDefault<z.ZodString>;
|
|
51
|
+
}, z.core.$strip>;
|
|
52
|
+
interface ReadWavProperties extends z.infer<typeof wavSchema>, SourceNodeProperties {
|
|
53
|
+
readonly channels?: ReadonlyArray<number>;
|
|
54
|
+
}
|
|
55
|
+
declare function readSample(data: Buffer, offset: number, bitsPerSample: number, audioFormat: number): number;
|
|
56
|
+
declare class ReadWavStream<P extends ReadWavProperties = ReadWavProperties> extends BufferedSourceStream<P> {
|
|
57
|
+
private fileHandle?;
|
|
58
|
+
private format?;
|
|
59
|
+
private bytesRead;
|
|
60
|
+
private sourceSampleRate;
|
|
61
|
+
private sourceBitDepth;
|
|
62
|
+
getMetadata(): Promise<SourceMetadata>;
|
|
63
|
+
private ensureInitialized;
|
|
64
|
+
_read(): Promise<AudioChunk | undefined>;
|
|
65
|
+
_flush(): Promise<void>;
|
|
66
|
+
_teardown(): void;
|
|
67
|
+
}
|
|
68
|
+
declare class ReadWavNode extends SourceNode<ReadWavProperties> {
|
|
69
|
+
static readonly moduleName = "Read WAV";
|
|
70
|
+
static readonly packageName: string;
|
|
71
|
+
static readonly packageVersion: string;
|
|
72
|
+
static readonly moduleDescription = "Read audio from a WAV file";
|
|
73
|
+
static readonly schema: z.ZodObject<{
|
|
74
|
+
path: z.ZodDefault<z.ZodString>;
|
|
75
|
+
}, z.core.$strip>;
|
|
76
|
+
readonly type: readonly ["buffered-audio-node", "source", "read-wav"];
|
|
77
|
+
protected createStream(): ReadWavStream;
|
|
78
|
+
clone(overrides?: Partial<ReadWavProperties>): ReadWavNode;
|
|
79
|
+
}
|
|
80
|
+
declare function readWav(path: string, options?: {
|
|
81
|
+
channels?: ReadonlyArray<number>;
|
|
82
|
+
}): ReadWavNode;
|
|
83
|
+
|
|
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
|
+
declare function read(path: string, options?: {
|
|
107
|
+
channels?: ReadonlyArray<number>;
|
|
108
|
+
ffmpegPath?: string;
|
|
109
|
+
ffprobePath?: string;
|
|
110
|
+
}): ReadNode;
|
|
111
|
+
|
|
112
|
+
declare const schema$l: z.ZodObject<{
|
|
113
|
+
bucketCount: z.ZodDefault<z.ZodNumber>;
|
|
114
|
+
outputPath: z.ZodDefault<z.ZodString>;
|
|
115
|
+
}, z.core.$strip>;
|
|
116
|
+
interface LoudnessStatsProperties extends z.infer<typeof schema$l>, TargetNodeProperties {
|
|
117
|
+
}
|
|
118
|
+
interface AmplitudeDistribution {
|
|
119
|
+
readonly buckets: Uint32Array;
|
|
120
|
+
readonly bucketMax: number;
|
|
121
|
+
readonly totalSamples: number;
|
|
122
|
+
readonly median: number;
|
|
123
|
+
percentile(p: number): number;
|
|
124
|
+
}
|
|
125
|
+
interface LoudnessStats {
|
|
126
|
+
readonly integrated: number;
|
|
127
|
+
readonly truePeak: number;
|
|
128
|
+
readonly range: number;
|
|
129
|
+
readonly amplitude: AmplitudeDistribution;
|
|
130
|
+
}
|
|
131
|
+
declare class LoudnessStatsStream extends BufferedTargetStream<LoudnessStatsProperties> {
|
|
132
|
+
private channels;
|
|
133
|
+
private sampleRate;
|
|
134
|
+
private truePeakAccumulator;
|
|
135
|
+
private loudnessAccumulator;
|
|
136
|
+
private histogramAccumulator;
|
|
137
|
+
private _stats?;
|
|
138
|
+
private statsInitialized;
|
|
139
|
+
private fileHandle?;
|
|
140
|
+
get stats(): LoudnessStats | undefined;
|
|
141
|
+
_setup(input: ReadableStream<AudioChunk>, context: StreamContext): Promise<void>;
|
|
142
|
+
private ensureInit;
|
|
143
|
+
_write(chunk: AudioChunk): Promise<void>;
|
|
144
|
+
_close(): Promise<void>;
|
|
145
|
+
}
|
|
146
|
+
declare class LoudnessStatsNode extends TargetNode<LoudnessStatsProperties> {
|
|
147
|
+
static readonly moduleName = "Loudness Stats";
|
|
148
|
+
static readonly packageName: string;
|
|
149
|
+
static readonly packageVersion: string;
|
|
150
|
+
static readonly moduleDescription = "Measure integrated loudness, true peak, and loudness range per EBU R128, plus an amplitude-distribution histogram";
|
|
151
|
+
static readonly schema: z.ZodObject<{
|
|
152
|
+
bucketCount: z.ZodDefault<z.ZodNumber>;
|
|
153
|
+
outputPath: z.ZodDefault<z.ZodString>;
|
|
154
|
+
}, z.core.$strip>;
|
|
155
|
+
static is(value: unknown): value is LoudnessStatsNode;
|
|
156
|
+
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
|
+
clone(overrides?: Partial<LoudnessStatsProperties>): LoudnessStatsNode;
|
|
163
|
+
}
|
|
164
|
+
declare function loudnessStats(options?: {
|
|
165
|
+
id?: string;
|
|
166
|
+
bucketCount?: number;
|
|
167
|
+
outputPath?: string;
|
|
168
|
+
}): LoudnessStatsNode;
|
|
169
|
+
|
|
170
|
+
declare const schema$k: z.ZodObject<{
|
|
171
|
+
outputPath: z.ZodDefault<z.ZodString>;
|
|
172
|
+
fftSize: z.ZodDefault<z.ZodNumber>;
|
|
173
|
+
hopSize: z.ZodDefault<z.ZodNumber>;
|
|
174
|
+
fftwAddonPath: z.ZodDefault<z.ZodString>;
|
|
175
|
+
}, z.core.$strip>;
|
|
176
|
+
type FrequencyScale = "linear" | "log" | "mel" | "erb";
|
|
177
|
+
interface SpectrogramProperties extends z.infer<typeof schema$k>, TargetNodeProperties {
|
|
178
|
+
readonly frequencyScale?: FrequencyScale;
|
|
179
|
+
readonly numBands?: number;
|
|
180
|
+
readonly minFrequency?: number;
|
|
181
|
+
readonly maxFrequency?: number;
|
|
182
|
+
}
|
|
183
|
+
declare class SpectrogramStream extends BufferedTargetStream<SpectrogramProperties> {
|
|
184
|
+
private fileHandle?;
|
|
185
|
+
private channels;
|
|
186
|
+
private linearBins;
|
|
187
|
+
private outputBins;
|
|
188
|
+
private numFrames;
|
|
189
|
+
private fileOffset;
|
|
190
|
+
private windowCoefficients;
|
|
191
|
+
private workspace?;
|
|
192
|
+
private addon;
|
|
193
|
+
private bandMappings?;
|
|
194
|
+
private magnitudes;
|
|
195
|
+
private sampleBuffers;
|
|
196
|
+
private sampleBufferOffset;
|
|
197
|
+
private sampleBufferCapacity;
|
|
198
|
+
private writeBuffer?;
|
|
199
|
+
private writeBufferOffset;
|
|
200
|
+
private writeBufferFileOffset;
|
|
201
|
+
private readonly WRITE_BATCH_FRAMES;
|
|
202
|
+
private initialized;
|
|
203
|
+
_setup(input: ReadableStream<AudioChunk>, context: StreamContext): Promise<void>;
|
|
204
|
+
private initialize;
|
|
205
|
+
_write(chunk: AudioChunk): Promise<void>;
|
|
206
|
+
_close(): Promise<void>;
|
|
207
|
+
private processAccumulatedSamples;
|
|
208
|
+
private writeFrame;
|
|
209
|
+
private flushWriteBuffer;
|
|
210
|
+
}
|
|
211
|
+
declare class SpectrogramNode extends TargetNode<SpectrogramProperties> {
|
|
212
|
+
static readonly moduleName = "Spectrogram";
|
|
213
|
+
static readonly packageName: string;
|
|
214
|
+
static readonly packageVersion: string;
|
|
215
|
+
static readonly moduleDescription = "Generate spectrogram visualization data";
|
|
216
|
+
static readonly schema: z.ZodObject<{
|
|
217
|
+
outputPath: z.ZodDefault<z.ZodString>;
|
|
218
|
+
fftSize: z.ZodDefault<z.ZodNumber>;
|
|
219
|
+
hopSize: z.ZodDefault<z.ZodNumber>;
|
|
220
|
+
fftwAddonPath: z.ZodDefault<z.ZodString>;
|
|
221
|
+
}, z.core.$strip>;
|
|
222
|
+
static is(value: unknown): value is SpectrogramNode;
|
|
223
|
+
readonly type: readonly ["buffered-audio-node", "target", "spectrogram"];
|
|
224
|
+
constructor(properties: SpectrogramProperties);
|
|
225
|
+
createStream(): SpectrogramStream;
|
|
226
|
+
clone(overrides?: Partial<SpectrogramProperties>): SpectrogramNode;
|
|
227
|
+
}
|
|
228
|
+
declare function spectrogram(outputPath: string, options?: {
|
|
229
|
+
fftSize?: number;
|
|
230
|
+
hopSize?: number;
|
|
231
|
+
frequencyScale?: FrequencyScale;
|
|
232
|
+
numBands?: number;
|
|
233
|
+
minFrequency?: number;
|
|
234
|
+
maxFrequency?: number;
|
|
235
|
+
fftwAddonPath?: string;
|
|
236
|
+
}): SpectrogramNode;
|
|
237
|
+
|
|
238
|
+
declare const schema$j: z.ZodObject<{
|
|
239
|
+
outputPath: z.ZodDefault<z.ZodString>;
|
|
240
|
+
resolution: z.ZodDefault<z.ZodNumber>;
|
|
241
|
+
}, z.core.$strip>;
|
|
242
|
+
interface WaveformProperties extends z.infer<typeof schema$j>, TargetNodeProperties {
|
|
243
|
+
}
|
|
244
|
+
declare class WaveformStream extends BufferedTargetStream<WaveformProperties> {
|
|
245
|
+
private fileHandle?;
|
|
246
|
+
private channels;
|
|
247
|
+
private samplesPerPoint;
|
|
248
|
+
private totalPoints;
|
|
249
|
+
private fileOffset;
|
|
250
|
+
private samplesInCurrentWindow;
|
|
251
|
+
private currentMin;
|
|
252
|
+
private currentMax;
|
|
253
|
+
private writeBuffer;
|
|
254
|
+
private writeBufferOffset;
|
|
255
|
+
private writeBufferFileOffset;
|
|
256
|
+
private readonly WRITE_BATCH_POINTS;
|
|
257
|
+
private initialized;
|
|
258
|
+
_setup(input: ReadableStream<AudioChunk>, context: StreamContext): Promise<void>;
|
|
259
|
+
private initialize;
|
|
260
|
+
private writeHeader;
|
|
261
|
+
_write(chunk: AudioChunk): Promise<void>;
|
|
262
|
+
_close(): Promise<void>;
|
|
263
|
+
private flushPoint;
|
|
264
|
+
private flushWriteBuffer;
|
|
265
|
+
}
|
|
266
|
+
declare class WaveformNode extends TargetNode<WaveformProperties> {
|
|
267
|
+
static readonly moduleName = "Waveform";
|
|
268
|
+
static readonly packageName: string;
|
|
269
|
+
static readonly packageVersion: string;
|
|
270
|
+
static readonly moduleDescription = "Generate waveform visualization data";
|
|
271
|
+
static readonly schema: z.ZodObject<{
|
|
272
|
+
outputPath: z.ZodDefault<z.ZodString>;
|
|
273
|
+
resolution: z.ZodDefault<z.ZodNumber>;
|
|
274
|
+
}, z.core.$strip>;
|
|
275
|
+
static is(value: unknown): value is WaveformNode;
|
|
276
|
+
readonly type: readonly ["buffered-audio-node", "target", "waveform"];
|
|
277
|
+
constructor(properties: WaveformProperties);
|
|
278
|
+
createStream(): WaveformStream;
|
|
279
|
+
clone(overrides?: Partial<WaveformProperties>): WaveformNode;
|
|
280
|
+
}
|
|
281
|
+
declare function waveform(outputPath: string, options?: {
|
|
282
|
+
resolution?: number;
|
|
283
|
+
}): WaveformNode;
|
|
284
|
+
|
|
285
|
+
type WavBitDepth = "16" | "24" | "32" | "32f";
|
|
286
|
+
interface EncodingOptions {
|
|
287
|
+
readonly format: "wav" | "flac" | "mp3" | "aac";
|
|
288
|
+
readonly bitrate?: string;
|
|
289
|
+
readonly vbr?: number;
|
|
290
|
+
readonly sampleRate?: number;
|
|
291
|
+
}
|
|
292
|
+
interface WriteProperties extends TargetNodeProperties {
|
|
293
|
+
readonly path: string;
|
|
294
|
+
readonly ffmpegPath?: string;
|
|
295
|
+
readonly bitDepth: WavBitDepth;
|
|
296
|
+
readonly encoding?: EncodingOptions;
|
|
297
|
+
}
|
|
298
|
+
declare class WriteStream extends BufferedTargetStream<WriteProperties> {
|
|
299
|
+
private fileHandle?;
|
|
300
|
+
private ffmpegProcess?;
|
|
301
|
+
private ffmpegStdin?;
|
|
302
|
+
private ffmpegDone?;
|
|
303
|
+
private sampleRate;
|
|
304
|
+
private channels;
|
|
305
|
+
private bytesWritten;
|
|
306
|
+
private useEncoding;
|
|
307
|
+
private initialized;
|
|
308
|
+
_setup(input: ReadableStream<AudioChunk>, context: StreamContext): Promise<void>;
|
|
309
|
+
private initialize;
|
|
310
|
+
private spawnFfmpeg;
|
|
311
|
+
_write(chunk: AudioChunk): Promise<void>;
|
|
312
|
+
_close(): Promise<void>;
|
|
313
|
+
_teardown(): Promise<void>;
|
|
314
|
+
private convertChunk;
|
|
315
|
+
private buildFfmpegArgs;
|
|
316
|
+
private writeToStdin;
|
|
317
|
+
}
|
|
318
|
+
declare class WriteNode extends TargetNode<WriteProperties> {
|
|
319
|
+
static readonly moduleName = "Write";
|
|
320
|
+
static readonly packageName: string;
|
|
321
|
+
static readonly packageVersion: string;
|
|
322
|
+
static readonly moduleDescription = "Write audio to a file";
|
|
323
|
+
static readonly schema: z.ZodObject<{
|
|
324
|
+
path: z.ZodDefault<z.ZodString>;
|
|
325
|
+
ffmpegPath: z.ZodDefault<z.ZodString>;
|
|
326
|
+
bitDepth: z.ZodDefault<z.ZodEnum<{
|
|
327
|
+
16: "16";
|
|
328
|
+
24: "24";
|
|
329
|
+
32: "32";
|
|
330
|
+
"32f": "32f";
|
|
331
|
+
}>>;
|
|
332
|
+
encoding: z.ZodOptional<z.ZodObject<{
|
|
333
|
+
format: z.ZodEnum<{
|
|
334
|
+
wav: "wav";
|
|
335
|
+
flac: "flac";
|
|
336
|
+
mp3: "mp3";
|
|
337
|
+
aac: "aac";
|
|
338
|
+
}>;
|
|
339
|
+
bitrate: z.ZodOptional<z.ZodString>;
|
|
340
|
+
vbr: z.ZodOptional<z.ZodNumber>;
|
|
341
|
+
sampleRate: z.ZodOptional<z.ZodNumber>;
|
|
342
|
+
}, z.core.$strip>>;
|
|
343
|
+
}, z.core.$strip>;
|
|
344
|
+
readonly type: readonly ["buffered-audio-node", "target", "write"];
|
|
345
|
+
createStream(): WriteStream;
|
|
346
|
+
clone(overrides?: Partial<WriteProperties>): WriteNode;
|
|
347
|
+
}
|
|
348
|
+
declare function write(path: string, options?: {
|
|
349
|
+
bitDepth?: WavBitDepth;
|
|
350
|
+
ffmpegPath?: string;
|
|
351
|
+
encoding?: EncodingOptions;
|
|
352
|
+
}): WriteNode;
|
|
353
|
+
|
|
354
|
+
declare const cutRegionSchema: z.ZodObject<{
|
|
355
|
+
start: z.ZodNumber;
|
|
356
|
+
end: z.ZodNumber;
|
|
357
|
+
}, z.core.$strip>;
|
|
358
|
+
declare const schema$i: z.ZodObject<{
|
|
359
|
+
regions: z.ZodDefault<z.ZodArray<z.ZodObject<{
|
|
360
|
+
start: z.ZodNumber;
|
|
361
|
+
end: z.ZodNumber;
|
|
362
|
+
}, z.core.$strip>>>;
|
|
363
|
+
}, z.core.$strip>;
|
|
364
|
+
type CutRegion = z.infer<typeof cutRegionSchema>;
|
|
365
|
+
interface CutProperties extends z.infer<typeof schema$i>, TransformNodeProperties {
|
|
366
|
+
}
|
|
367
|
+
declare class CutStream extends BufferedTransformStream<CutProperties> {
|
|
368
|
+
private sortedRegions;
|
|
369
|
+
private removedFrames;
|
|
370
|
+
constructor(properties: CutProperties);
|
|
371
|
+
_unbuffer(chunk: AudioChunk): AudioChunk | undefined;
|
|
372
|
+
}
|
|
373
|
+
declare class CutNode extends TransformNode<CutProperties> {
|
|
374
|
+
static readonly moduleName = "Cut";
|
|
375
|
+
static readonly packageName: string;
|
|
376
|
+
static readonly packageVersion: string;
|
|
377
|
+
static readonly moduleDescription = "Remove a region of audio";
|
|
378
|
+
static readonly schema: z.ZodObject<{
|
|
379
|
+
regions: z.ZodDefault<z.ZodArray<z.ZodObject<{
|
|
380
|
+
start: z.ZodNumber;
|
|
381
|
+
end: z.ZodNumber;
|
|
382
|
+
}, z.core.$strip>>>;
|
|
383
|
+
}, z.core.$strip>;
|
|
384
|
+
static is(value: unknown): value is CutNode;
|
|
385
|
+
readonly type: readonly ["buffered-audio-node", "transform", "cut"];
|
|
386
|
+
createStream(): CutStream;
|
|
387
|
+
clone(overrides?: Partial<CutProperties>): CutNode;
|
|
388
|
+
}
|
|
389
|
+
declare function cut(regions: Array<CutRegion>, options?: {
|
|
390
|
+
id?: string;
|
|
391
|
+
}): CutNode;
|
|
392
|
+
|
|
393
|
+
declare const schema$h: z.ZodObject<{
|
|
394
|
+
bitDepth: z.ZodDefault<z.ZodUnion<readonly [z.ZodLiteral<16>, z.ZodLiteral<24>]>>;
|
|
395
|
+
noiseShaping: z.ZodDefault<z.ZodBoolean>;
|
|
396
|
+
}, z.core.$strip>;
|
|
397
|
+
interface DitherProperties extends z.infer<typeof schema$h>, TransformNodeProperties {
|
|
398
|
+
}
|
|
399
|
+
declare class DitherStream extends BufferedTransformStream<DitherProperties> {
|
|
400
|
+
private lastError;
|
|
401
|
+
_buffer(chunk: AudioChunk, buffer: ChunkBuffer): Promise<void>;
|
|
402
|
+
_unbuffer(chunk: AudioChunk): AudioChunk;
|
|
403
|
+
}
|
|
404
|
+
declare class DitherNode extends TransformNode<DitherProperties> {
|
|
405
|
+
static readonly moduleName = "Dither";
|
|
406
|
+
static readonly packageName: string;
|
|
407
|
+
static readonly packageVersion: string;
|
|
408
|
+
static readonly moduleDescription = "Add shaped noise to reduce quantization distortion";
|
|
409
|
+
static readonly schema: z.ZodObject<{
|
|
410
|
+
bitDepth: z.ZodDefault<z.ZodUnion<readonly [z.ZodLiteral<16>, z.ZodLiteral<24>]>>;
|
|
411
|
+
noiseShaping: z.ZodDefault<z.ZodBoolean>;
|
|
412
|
+
}, z.core.$strip>;
|
|
413
|
+
static is(value: unknown): value is DitherNode;
|
|
414
|
+
readonly type: readonly ["buffered-audio-node", "transform", "dither"];
|
|
415
|
+
createStream(): DitherStream;
|
|
416
|
+
clone(overrides?: Partial<DitherProperties>): DitherNode;
|
|
417
|
+
}
|
|
418
|
+
declare function dither(bitDepth: 16 | 24, options?: {
|
|
419
|
+
noiseShaping?: boolean;
|
|
420
|
+
id?: string;
|
|
421
|
+
}): DitherNode;
|
|
422
|
+
|
|
423
|
+
declare const schema$g: z.ZodObject<{
|
|
424
|
+
ceiling: z.ZodDefault<z.ZodNumber>;
|
|
425
|
+
}, z.core.$strip>;
|
|
426
|
+
interface NormalizeProperties extends z.infer<typeof schema$g>, TransformNodeProperties {
|
|
427
|
+
}
|
|
428
|
+
declare class NormalizeStream extends BufferedTransformStream<NormalizeProperties> {
|
|
429
|
+
private peak;
|
|
430
|
+
private scale;
|
|
431
|
+
_buffer(chunk: AudioChunk, buffer: ChunkBuffer): Promise<void>;
|
|
432
|
+
_process(_buffer: ChunkBuffer): void;
|
|
433
|
+
_unbuffer(chunk: AudioChunk): AudioChunk;
|
|
434
|
+
}
|
|
435
|
+
declare class NormalizeNode extends TransformNode<NormalizeProperties> {
|
|
436
|
+
static readonly moduleName = "Normalize";
|
|
437
|
+
static readonly packageName: string;
|
|
438
|
+
static readonly packageVersion: string;
|
|
439
|
+
static readonly moduleDescription = "Adjust peak or loudness level to a target ceiling";
|
|
440
|
+
static readonly schema: z.ZodObject<{
|
|
441
|
+
ceiling: z.ZodDefault<z.ZodNumber>;
|
|
442
|
+
}, z.core.$strip>;
|
|
443
|
+
static is(value: unknown): value is NormalizeNode;
|
|
444
|
+
readonly type: readonly ["buffered-audio-node", "transform", "normalize"];
|
|
445
|
+
constructor(properties: NormalizeProperties);
|
|
446
|
+
createStream(): NormalizeStream;
|
|
447
|
+
clone(overrides?: Partial<NormalizeProperties>): NormalizeNode;
|
|
448
|
+
}
|
|
449
|
+
declare function normalize(options?: {
|
|
450
|
+
ceiling?: number;
|
|
451
|
+
id?: string;
|
|
452
|
+
}): NormalizeNode;
|
|
453
|
+
|
|
454
|
+
declare const schema$f: z.ZodObject<{
|
|
455
|
+
before: z.ZodDefault<z.ZodNumber>;
|
|
456
|
+
after: z.ZodDefault<z.ZodNumber>;
|
|
457
|
+
}, z.core.$strip>;
|
|
458
|
+
interface PadProperties extends z.infer<typeof schema$f>, TransformNodeProperties {
|
|
459
|
+
}
|
|
460
|
+
declare class PadStream extends BufferedTransformStream<PadProperties> {
|
|
461
|
+
_process(buffer: ChunkBuffer): Promise<void>;
|
|
462
|
+
}
|
|
463
|
+
declare class PadNode extends TransformNode<PadProperties> {
|
|
464
|
+
static readonly moduleName = "Pad";
|
|
465
|
+
static readonly packageName: string;
|
|
466
|
+
static readonly packageVersion: string;
|
|
467
|
+
static readonly moduleDescription = "Add silence to start or end of audio";
|
|
468
|
+
static readonly schema: z.ZodObject<{
|
|
469
|
+
before: z.ZodDefault<z.ZodNumber>;
|
|
470
|
+
after: z.ZodDefault<z.ZodNumber>;
|
|
471
|
+
}, z.core.$strip>;
|
|
472
|
+
static is(value: unknown): value is PadNode;
|
|
473
|
+
readonly type: readonly ["buffered-audio-node", "transform", "pad"];
|
|
474
|
+
constructor(properties: PadProperties);
|
|
475
|
+
createStream(): PadStream;
|
|
476
|
+
clone(overrides?: Partial<PadProperties>): PadNode;
|
|
477
|
+
}
|
|
478
|
+
declare function pad(options: {
|
|
479
|
+
before?: number;
|
|
480
|
+
after?: number;
|
|
481
|
+
id?: string;
|
|
482
|
+
}): PadNode;
|
|
483
|
+
|
|
484
|
+
declare const schema$e: z.ZodObject<{
|
|
485
|
+
invert: z.ZodDefault<z.ZodBoolean>;
|
|
486
|
+
angle: z.ZodOptional<z.ZodNumber>;
|
|
487
|
+
}, z.core.$strip>;
|
|
488
|
+
interface PhaseProperties extends z.infer<typeof schema$e>, TransformNodeProperties {
|
|
489
|
+
}
|
|
490
|
+
declare class PhaseStream extends BufferedTransformStream<PhaseProperties> {
|
|
491
|
+
private allpassState;
|
|
492
|
+
_unbuffer(chunk: AudioChunk): AudioChunk;
|
|
493
|
+
private applyInvert;
|
|
494
|
+
private applyPhaseRotation;
|
|
495
|
+
}
|
|
496
|
+
declare class PhaseNode extends TransformNode<PhaseProperties> {
|
|
497
|
+
static readonly moduleName = "Phase";
|
|
498
|
+
static readonly packageName: string;
|
|
499
|
+
static readonly packageVersion: string;
|
|
500
|
+
static readonly moduleDescription = "Invert or rotate signal phase";
|
|
501
|
+
static readonly schema: z.ZodObject<{
|
|
502
|
+
invert: z.ZodDefault<z.ZodBoolean>;
|
|
503
|
+
angle: z.ZodOptional<z.ZodNumber>;
|
|
504
|
+
}, z.core.$strip>;
|
|
505
|
+
static is(value: unknown): value is PhaseNode;
|
|
506
|
+
readonly type: readonly ["buffered-audio-node", "transform", "phase"];
|
|
507
|
+
createStream(): PhaseStream;
|
|
508
|
+
clone(overrides?: Partial<PhaseProperties>): PhaseNode;
|
|
509
|
+
}
|
|
510
|
+
declare function phase(options?: {
|
|
511
|
+
invert?: boolean;
|
|
512
|
+
angle?: number;
|
|
513
|
+
id?: string;
|
|
514
|
+
}): PhaseNode;
|
|
515
|
+
declare function invert(options?: {
|
|
516
|
+
id?: string;
|
|
517
|
+
}): PhaseNode;
|
|
518
|
+
|
|
519
|
+
declare class ReverseStream extends BufferedTransformStream {
|
|
520
|
+
_process(buffer: ChunkBuffer): Promise<void>;
|
|
521
|
+
}
|
|
522
|
+
declare class ReverseNode extends TransformNode {
|
|
523
|
+
static readonly moduleName = "Reverse";
|
|
524
|
+
static readonly packageName: string;
|
|
525
|
+
static readonly packageVersion: string;
|
|
526
|
+
static readonly moduleDescription = "Reverse audio playback direction";
|
|
527
|
+
static readonly schema: z.ZodObject<{}, z.core.$strip>;
|
|
528
|
+
static is(value: unknown): value is ReverseNode;
|
|
529
|
+
readonly type: readonly ["buffered-audio-node", "transform", "reverse"];
|
|
530
|
+
constructor(properties?: TransformNodeProperties);
|
|
531
|
+
createStream(): ReverseStream;
|
|
532
|
+
clone(overrides?: Partial<TransformNodeProperties>): ReverseNode;
|
|
533
|
+
}
|
|
534
|
+
declare function reverse(options?: {
|
|
535
|
+
id?: string;
|
|
536
|
+
}): ReverseNode;
|
|
537
|
+
|
|
538
|
+
declare const schema$d: z.ZodObject<{
|
|
539
|
+
insertPath: z.ZodDefault<z.ZodString>;
|
|
540
|
+
insertAt: z.ZodDefault<z.ZodNumber>;
|
|
541
|
+
}, z.core.$strip>;
|
|
542
|
+
interface SpliceProperties extends z.infer<typeof schema$d>, TransformNodeProperties {
|
|
543
|
+
readonly channels?: ReadonlyArray<number>;
|
|
544
|
+
}
|
|
545
|
+
declare class SpliceStream extends BufferedTransformStream<SpliceProperties> {
|
|
546
|
+
private insertSamples;
|
|
547
|
+
private insertSampleRate;
|
|
548
|
+
private insertLength;
|
|
549
|
+
private sampleRateChecked;
|
|
550
|
+
_setup(input: ReadableStream<AudioChunk>, context: StreamContext): Promise<ReadableStream<AudioChunk>>;
|
|
551
|
+
_unbuffer(chunk: AudioChunk): AudioChunk;
|
|
552
|
+
}
|
|
553
|
+
declare class SpliceNode extends TransformNode<SpliceProperties> {
|
|
554
|
+
static readonly moduleName = "Splice";
|
|
555
|
+
static readonly packageName: string;
|
|
556
|
+
static readonly packageVersion: string;
|
|
557
|
+
static readonly moduleDescription = "Replace a region of audio with processed content";
|
|
558
|
+
static readonly schema: z.ZodObject<{
|
|
559
|
+
insertPath: z.ZodDefault<z.ZodString>;
|
|
560
|
+
insertAt: z.ZodDefault<z.ZodNumber>;
|
|
561
|
+
}, z.core.$strip>;
|
|
562
|
+
static is(value: unknown): value is SpliceNode;
|
|
563
|
+
readonly type: readonly ["buffered-audio-node", "transform", "splice"];
|
|
564
|
+
createStream(): SpliceStream;
|
|
565
|
+
clone(overrides?: Partial<SpliceProperties>): SpliceNode;
|
|
566
|
+
}
|
|
567
|
+
declare function splice(insertPath: string, insertAt: number, options?: {
|
|
568
|
+
channels?: ReadonlyArray<number>;
|
|
569
|
+
}): SpliceNode;
|
|
570
|
+
|
|
571
|
+
declare const schema$c: z.ZodObject<{
|
|
572
|
+
threshold: z.ZodDefault<z.ZodNumber>;
|
|
573
|
+
margin: z.ZodDefault<z.ZodNumber>;
|
|
574
|
+
start: z.ZodDefault<z.ZodBoolean>;
|
|
575
|
+
end: z.ZodDefault<z.ZodBoolean>;
|
|
576
|
+
}, z.core.$strip>;
|
|
577
|
+
interface TrimProperties extends z.infer<typeof schema$c>, TransformNodeProperties {
|
|
578
|
+
}
|
|
579
|
+
declare class TrimStream extends BufferedTransformStream<TrimProperties> {
|
|
580
|
+
_process(buffer: ChunkBuffer): Promise<void>;
|
|
581
|
+
}
|
|
582
|
+
declare class TrimNode extends TransformNode<TrimProperties> {
|
|
583
|
+
static readonly moduleName = "Trim";
|
|
584
|
+
static readonly packageName: string;
|
|
585
|
+
static readonly packageVersion: string;
|
|
586
|
+
static readonly moduleDescription = "Remove silence from start and end";
|
|
587
|
+
static readonly schema: z.ZodObject<{
|
|
588
|
+
threshold: z.ZodDefault<z.ZodNumber>;
|
|
589
|
+
margin: z.ZodDefault<z.ZodNumber>;
|
|
590
|
+
start: z.ZodDefault<z.ZodBoolean>;
|
|
591
|
+
end: z.ZodDefault<z.ZodBoolean>;
|
|
592
|
+
}, z.core.$strip>;
|
|
593
|
+
static is(value: unknown): value is TrimNode;
|
|
594
|
+
readonly type: readonly ["buffered-audio-node", "transform", "trim"];
|
|
595
|
+
constructor(properties: TrimProperties);
|
|
596
|
+
createStream(): TrimStream;
|
|
597
|
+
clone(overrides?: Partial<TrimProperties>): TrimNode;
|
|
598
|
+
}
|
|
599
|
+
declare function trim(options?: {
|
|
600
|
+
threshold?: number;
|
|
601
|
+
margin?: number;
|
|
602
|
+
start?: boolean;
|
|
603
|
+
end?: boolean;
|
|
604
|
+
id?: string;
|
|
605
|
+
}): TrimNode;
|
|
606
|
+
|
|
607
|
+
/**
|
|
608
|
+
* Downmix N channels to 1 by averaging all channels equally.
|
|
609
|
+
*/
|
|
610
|
+
declare class DownmixMonoStream extends BufferedTransformStream {
|
|
611
|
+
_unbuffer(chunk: AudioChunk): AudioChunk;
|
|
612
|
+
}
|
|
613
|
+
declare class DownmixMonoNode extends TransformNode {
|
|
614
|
+
static readonly moduleName = "Downmix Mono";
|
|
615
|
+
static readonly packageName: string;
|
|
616
|
+
static readonly packageVersion: string;
|
|
617
|
+
static readonly moduleDescription = "Mix all input channels to a single mono channel by averaging";
|
|
618
|
+
static readonly schema: z.ZodObject<{}, z.core.$strip>;
|
|
619
|
+
static is(value: unknown): value is DownmixMonoNode;
|
|
620
|
+
readonly type: readonly ["buffered-audio-node", "transform", "downmix-mono"];
|
|
621
|
+
createStream(): DownmixMonoStream;
|
|
622
|
+
clone(overrides?: Partial<TransformNodeProperties>): DownmixMonoNode;
|
|
623
|
+
}
|
|
624
|
+
declare function downmixMono(options?: {
|
|
625
|
+
id?: string;
|
|
626
|
+
}): DownmixMonoNode;
|
|
627
|
+
|
|
628
|
+
declare const schema$b: z.ZodObject<{
|
|
629
|
+
channels: z.ZodDefault<z.ZodNumber>;
|
|
630
|
+
}, z.core.$strip>;
|
|
631
|
+
interface DuplicateChannelsProperties extends z.infer<typeof schema$b>, TransformNodeProperties {
|
|
632
|
+
}
|
|
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;
|
|
639
|
+
}
|
|
640
|
+
declare class DuplicateChannelsNode extends TransformNode<DuplicateChannelsProperties> {
|
|
641
|
+
static readonly moduleName = "Duplicate Channels";
|
|
642
|
+
static readonly packageName: string;
|
|
643
|
+
static readonly packageVersion: string;
|
|
644
|
+
static readonly moduleDescription = "Duplicate a mono signal into multiple identical output channels";
|
|
645
|
+
static readonly schema: z.ZodObject<{
|
|
646
|
+
channels: z.ZodDefault<z.ZodNumber>;
|
|
647
|
+
}, z.core.$strip>;
|
|
648
|
+
static is(value: unknown): value is DuplicateChannelsNode;
|
|
649
|
+
readonly type: readonly ["buffered-audio-node", "transform", "duplicate-channels"];
|
|
650
|
+
createStream(): DuplicateChannelsStream;
|
|
651
|
+
clone(overrides?: Partial<DuplicateChannelsProperties>): DuplicateChannelsNode;
|
|
652
|
+
}
|
|
653
|
+
declare function duplicateChannels(options?: {
|
|
654
|
+
channels?: number;
|
|
655
|
+
id?: string;
|
|
656
|
+
}): DuplicateChannelsNode;
|
|
657
|
+
|
|
658
|
+
declare const schema$a: z.ZodObject<{
|
|
659
|
+
gain: z.ZodDefault<z.ZodNumber>;
|
|
660
|
+
}, z.core.$strip>;
|
|
661
|
+
interface GainProperties extends z.infer<typeof schema$a>, TransformNodeProperties {
|
|
662
|
+
}
|
|
663
|
+
declare class GainStream extends BufferedTransformStream<GainProperties> {
|
|
664
|
+
_unbuffer(chunk: AudioChunk): AudioChunk;
|
|
665
|
+
}
|
|
666
|
+
declare class GainNode extends TransformNode<GainProperties> {
|
|
667
|
+
static readonly moduleName = "Gain";
|
|
668
|
+
static readonly packageName: string;
|
|
669
|
+
static readonly packageVersion: string;
|
|
670
|
+
static readonly moduleDescription = "Adjust signal level by a fixed amount in dB";
|
|
671
|
+
static readonly schema: z.ZodObject<{
|
|
672
|
+
gain: z.ZodDefault<z.ZodNumber>;
|
|
673
|
+
}, z.core.$strip>;
|
|
674
|
+
static is(value: unknown): value is GainNode;
|
|
675
|
+
readonly type: readonly ["buffered-audio-node", "transform", "gain"];
|
|
676
|
+
createStream(): GainStream;
|
|
677
|
+
clone(overrides?: Partial<GainProperties>): GainNode;
|
|
678
|
+
}
|
|
679
|
+
declare function gain(options?: {
|
|
680
|
+
gain?: number;
|
|
681
|
+
id?: string;
|
|
682
|
+
}): GainNode;
|
|
683
|
+
|
|
684
|
+
declare const schema$9: z.ZodObject<{
|
|
685
|
+
pan: z.ZodDefault<z.ZodNumber>;
|
|
686
|
+
}, z.core.$strip>;
|
|
687
|
+
interface PanProperties extends z.infer<typeof schema$9>, TransformNodeProperties {
|
|
688
|
+
}
|
|
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;
|
|
699
|
+
}
|
|
700
|
+
declare class PanNode extends TransformNode<PanProperties> {
|
|
701
|
+
static readonly moduleName = "Pan";
|
|
702
|
+
static readonly packageName: string;
|
|
703
|
+
static readonly packageVersion: string;
|
|
704
|
+
static readonly moduleDescription = "Position mono signal in stereo field or adjust stereo balance";
|
|
705
|
+
static readonly schema: z.ZodObject<{
|
|
706
|
+
pan: z.ZodDefault<z.ZodNumber>;
|
|
707
|
+
}, z.core.$strip>;
|
|
708
|
+
static is(value: unknown): value is PanNode;
|
|
709
|
+
readonly type: readonly ["buffered-audio-node", "transform", "pan"];
|
|
710
|
+
createStream(): PanStream;
|
|
711
|
+
clone(overrides?: Partial<PanProperties>): PanNode;
|
|
712
|
+
}
|
|
713
|
+
declare function pan(options?: {
|
|
714
|
+
pan?: number;
|
|
715
|
+
id?: string;
|
|
716
|
+
}): PanNode;
|
|
717
|
+
|
|
718
|
+
interface FfmpegProperties extends TransformNodeProperties {
|
|
719
|
+
readonly ffmpegPath: string;
|
|
720
|
+
readonly args?: Array<string> | ((context: StreamContext) => Array<string>);
|
|
721
|
+
readonly outputSampleRate?: number;
|
|
722
|
+
}
|
|
723
|
+
declare class FfmpegStream<P extends FfmpegProperties = FfmpegProperties> extends BufferedTransformStream<P> {
|
|
724
|
+
private streamContext?;
|
|
725
|
+
private _sourceTotalFrames?;
|
|
726
|
+
private child?;
|
|
727
|
+
private stdoutStash;
|
|
728
|
+
private outputOffset;
|
|
729
|
+
private stderr;
|
|
730
|
+
private exitPromise?;
|
|
731
|
+
private stdoutEndPromise?;
|
|
732
|
+
private pendingDrain?;
|
|
733
|
+
private inputSampleRate;
|
|
734
|
+
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>;
|
|
740
|
+
private spawnChild;
|
|
741
|
+
private handleStdoutBytes;
|
|
742
|
+
private handleChunk;
|
|
743
|
+
private handleFlushStream;
|
|
744
|
+
_teardown(): Promise<void>;
|
|
745
|
+
}
|
|
746
|
+
declare class FfmpegNode<P extends FfmpegProperties = FfmpegProperties> extends TransformNode<P> {
|
|
747
|
+
static readonly moduleName: string;
|
|
748
|
+
static readonly packageName: string;
|
|
749
|
+
static readonly packageVersion: string;
|
|
750
|
+
static readonly moduleDescription: string;
|
|
751
|
+
static readonly schema: z.ZodType;
|
|
752
|
+
static is(value: unknown): value is FfmpegNode;
|
|
753
|
+
readonly type: ReadonlyArray<string>;
|
|
754
|
+
constructor(properties: P);
|
|
755
|
+
createStream(): FfmpegStream<P>;
|
|
756
|
+
clone(overrides?: Partial<P>): FfmpegNode<P>;
|
|
757
|
+
}
|
|
758
|
+
declare function ffmpeg(options: {
|
|
759
|
+
ffmpegPath: string;
|
|
760
|
+
args: Array<string> | ((context: StreamContext) => Array<string>);
|
|
761
|
+
outputSampleRate?: number;
|
|
762
|
+
id?: string;
|
|
763
|
+
}): FfmpegNode;
|
|
764
|
+
|
|
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
|
+
declare const schema$8: z.ZodObject<{
|
|
816
|
+
targetLufs: z.ZodDefault<z.ZodNumber>;
|
|
817
|
+
pivot: z.ZodOptional<z.ZodNumber>;
|
|
818
|
+
floor: z.ZodOptional<z.ZodNumber>;
|
|
819
|
+
limitPercentile: z.ZodDefault<z.ZodNumber>;
|
|
820
|
+
limitDb: z.ZodOptional<z.ZodNumber>;
|
|
821
|
+
maxAttempts: z.ZodDefault<z.ZodNumber>;
|
|
822
|
+
targetTp: z.ZodOptional<z.ZodNumber>;
|
|
823
|
+
smoothing: z.ZodDefault<z.ZodNumber>;
|
|
824
|
+
tolerance: z.ZodDefault<z.ZodNumber>;
|
|
825
|
+
peakTolerance: z.ZodDefault<z.ZodNumber>;
|
|
826
|
+
}, z.core.$strip>;
|
|
827
|
+
interface LoudnessTargetProperties extends z.infer<typeof schema$8>, TransformNodeProperties {
|
|
828
|
+
}
|
|
829
|
+
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
|
+
*/
|
|
840
|
+
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
|
+
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
|
+
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
|
+
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
|
+
*/
|
|
882
|
+
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
|
+
learnTimingMs: {
|
|
890
|
+
sourceMeasurement: number;
|
|
891
|
+
detection: number;
|
|
892
|
+
iteration: number;
|
|
893
|
+
};
|
|
894
|
+
_process(buffer: ChunkBuffer): Promise<void>;
|
|
895
|
+
_teardown(): Promise<void>;
|
|
896
|
+
_unbuffer(chunk: AudioChunk): Promise<AudioChunk>;
|
|
897
|
+
}
|
|
898
|
+
declare class LoudnessTargetNode extends TransformNode<LoudnessTargetProperties> {
|
|
899
|
+
static readonly moduleName = "Loudness Target";
|
|
900
|
+
static readonly packageName: string;
|
|
901
|
+
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.";
|
|
903
|
+
static readonly schema: z.ZodObject<{
|
|
904
|
+
targetLufs: z.ZodDefault<z.ZodNumber>;
|
|
905
|
+
pivot: z.ZodOptional<z.ZodNumber>;
|
|
906
|
+
floor: z.ZodOptional<z.ZodNumber>;
|
|
907
|
+
limitPercentile: z.ZodDefault<z.ZodNumber>;
|
|
908
|
+
limitDb: z.ZodOptional<z.ZodNumber>;
|
|
909
|
+
maxAttempts: z.ZodDefault<z.ZodNumber>;
|
|
910
|
+
targetTp: z.ZodOptional<z.ZodNumber>;
|
|
911
|
+
smoothing: z.ZodDefault<z.ZodNumber>;
|
|
912
|
+
tolerance: z.ZodDefault<z.ZodNumber>;
|
|
913
|
+
peakTolerance: z.ZodDefault<z.ZodNumber>;
|
|
914
|
+
}, z.core.$strip>;
|
|
915
|
+
static is(value: unknown): value is LoudnessTargetNode;
|
|
916
|
+
readonly type: readonly ["buffered-audio-node", "transform", "loudness-target"];
|
|
917
|
+
constructor(properties: LoudnessTargetProperties);
|
|
918
|
+
createStream(): LoudnessTargetStream;
|
|
919
|
+
clone(overrides?: Partial<LoudnessTargetProperties>): LoudnessTargetNode;
|
|
920
|
+
}
|
|
921
|
+
declare function loudnessTarget(options: {
|
|
922
|
+
targetLufs?: number;
|
|
923
|
+
pivot?: number;
|
|
924
|
+
floor?: number;
|
|
925
|
+
targetTp?: number;
|
|
926
|
+
limitPercentile?: number;
|
|
927
|
+
limitDb?: number;
|
|
928
|
+
smoothing?: number;
|
|
929
|
+
tolerance?: number;
|
|
930
|
+
peakTolerance?: number;
|
|
931
|
+
maxAttempts?: number;
|
|
932
|
+
id?: string;
|
|
933
|
+
}): LoudnessTargetNode;
|
|
934
|
+
|
|
935
|
+
declare const schema$7: z.ZodObject<{
|
|
936
|
+
target: z.ZodDefault<z.ZodNumber>;
|
|
937
|
+
}, z.core.$strip>;
|
|
938
|
+
interface LoudnessNormalizeProperties extends z.infer<typeof schema$7>, TransformNodeProperties {
|
|
939
|
+
}
|
|
940
|
+
declare class LoudnessNormalizeStream extends BufferedTransformStream<LoudnessNormalizeProperties> {
|
|
941
|
+
private gain;
|
|
942
|
+
_process(buffer: ChunkBuffer): Promise<void>;
|
|
943
|
+
_unbuffer(chunk: AudioChunk): AudioChunk;
|
|
944
|
+
}
|
|
945
|
+
declare class LoudnessNormalizeNode extends TransformNode<LoudnessNormalizeProperties> {
|
|
946
|
+
static readonly moduleName = "Loudness Normalize";
|
|
947
|
+
static readonly packageName: string;
|
|
948
|
+
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";
|
|
950
|
+
static readonly schema: z.ZodObject<{
|
|
951
|
+
target: z.ZodDefault<z.ZodNumber>;
|
|
952
|
+
}, z.core.$strip>;
|
|
953
|
+
static is(value: unknown): value is LoudnessNormalizeNode;
|
|
954
|
+
readonly type: readonly ["buffered-audio-node", "transform", "loudness-normalize"];
|
|
955
|
+
constructor(properties: LoudnessNormalizeProperties);
|
|
956
|
+
createStream(): LoudnessNormalizeStream;
|
|
957
|
+
clone(overrides?: Partial<LoudnessNormalizeProperties>): LoudnessNormalizeNode;
|
|
958
|
+
}
|
|
959
|
+
declare function loudnessNormalize(options?: {
|
|
960
|
+
target?: number;
|
|
961
|
+
id?: string;
|
|
962
|
+
}): LoudnessNormalizeNode;
|
|
963
|
+
|
|
964
|
+
declare const schema$6: z.ZodObject<{
|
|
965
|
+
target: z.ZodDefault<z.ZodNumber>;
|
|
966
|
+
}, z.core.$strip>;
|
|
967
|
+
interface TruePeakNormalizeProperties extends z.infer<typeof schema$6>, TransformNodeProperties {
|
|
968
|
+
}
|
|
969
|
+
declare class TruePeakNormalizeStream extends BufferedTransformStream<TruePeakNormalizeProperties> {
|
|
970
|
+
private gain;
|
|
971
|
+
_process(buffer: ChunkBuffer): Promise<void>;
|
|
972
|
+
_unbuffer(chunk: AudioChunk): AudioChunk;
|
|
973
|
+
}
|
|
974
|
+
declare class TruePeakNormalizeNode extends TransformNode<TruePeakNormalizeProperties> {
|
|
975
|
+
static readonly moduleName = "True Peak Normalize";
|
|
976
|
+
static readonly packageName: string;
|
|
977
|
+
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";
|
|
979
|
+
static readonly schema: z.ZodObject<{
|
|
980
|
+
target: z.ZodDefault<z.ZodNumber>;
|
|
981
|
+
}, z.core.$strip>;
|
|
982
|
+
static is(value: unknown): value is TruePeakNormalizeNode;
|
|
983
|
+
readonly type: readonly ["buffered-audio-node", "transform", "true-peak-normalize"];
|
|
984
|
+
constructor(properties: TruePeakNormalizeProperties);
|
|
985
|
+
createStream(): TruePeakNormalizeStream;
|
|
986
|
+
clone(overrides?: Partial<TruePeakNormalizeProperties>): TruePeakNormalizeNode;
|
|
987
|
+
}
|
|
988
|
+
declare function truePeakNormalize(options?: {
|
|
989
|
+
target?: number;
|
|
990
|
+
id?: string;
|
|
991
|
+
}): TruePeakNormalizeNode;
|
|
992
|
+
|
|
993
|
+
declare const schema$5: z.ZodObject<{
|
|
994
|
+
smoothing: z.ZodDefault<z.ZodNumber>;
|
|
995
|
+
frameSize: z.ZodDefault<z.ZodNumber>;
|
|
996
|
+
vkfftAddonPath: z.ZodDefault<z.ZodString>;
|
|
997
|
+
fftwAddonPath: z.ZodDefault<z.ZodString>;
|
|
998
|
+
}, z.core.$strip>;
|
|
999
|
+
interface CrestReduceProperties extends z.infer<typeof schema$5>, TransformNodeProperties {
|
|
1000
|
+
}
|
|
1001
|
+
declare class CrestReduceStream extends BufferedTransformStream<CrestReduceProperties> {
|
|
1002
|
+
private fftBackend?;
|
|
1003
|
+
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>>;
|
|
1027
|
+
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>;
|
|
1141
|
+
}
|
|
1142
|
+
declare class CrestReduceNode extends TransformNode<CrestReduceProperties> {
|
|
1143
|
+
static readonly moduleName = "Crest Reduce";
|
|
1144
|
+
static readonly packageName: string;
|
|
1145
|
+
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";
|
|
1147
|
+
static readonly schema: z.ZodObject<{
|
|
1148
|
+
smoothing: z.ZodDefault<z.ZodNumber>;
|
|
1149
|
+
frameSize: z.ZodDefault<z.ZodNumber>;
|
|
1150
|
+
vkfftAddonPath: z.ZodDefault<z.ZodString>;
|
|
1151
|
+
fftwAddonPath: z.ZodDefault<z.ZodString>;
|
|
1152
|
+
}, z.core.$strip>;
|
|
1153
|
+
static is(value: unknown): value is CrestReduceNode;
|
|
1154
|
+
readonly type: readonly ["buffered-audio-node", "transform", "crest-reduce"];
|
|
1155
|
+
constructor(properties: CrestReduceProperties);
|
|
1156
|
+
createStream(): CrestReduceStream;
|
|
1157
|
+
clone(overrides?: Partial<CrestReduceProperties>): CrestReduceNode;
|
|
1158
|
+
}
|
|
1159
|
+
declare function crestReduce(options?: {
|
|
1160
|
+
smoothing?: number;
|
|
1161
|
+
frameSize?: number;
|
|
1162
|
+
vkfftAddonPath?: string;
|
|
1163
|
+
fftwAddonPath?: string;
|
|
1164
|
+
id?: string;
|
|
1165
|
+
}): CrestReduceNode;
|
|
1166
|
+
|
|
1167
|
+
declare const schema$4: z.ZodObject<{
|
|
1168
|
+
references: z.ZodDefault<z.ZodArray<z.ZodString>>;
|
|
1169
|
+
reductionStrength: z.ZodDefault<z.ZodNumber>;
|
|
1170
|
+
artifactSmoothing: z.ZodDefault<z.ZodNumber>;
|
|
1171
|
+
adaptationSpeed: z.ZodDefault<z.ZodNumber>;
|
|
1172
|
+
fftSize: z.ZodDefault<z.ZodNumber>;
|
|
1173
|
+
hopSize: z.ZodDefault<z.ZodNumber>;
|
|
1174
|
+
vkfftAddonPath: z.ZodDefault<z.ZodString>;
|
|
1175
|
+
fftwAddonPath: z.ZodDefault<z.ZodString>;
|
|
1176
|
+
dfttBackend: z.ZodDefault<z.ZodEnum<{
|
|
1177
|
+
"": "";
|
|
1178
|
+
vkfft: "vkfft";
|
|
1179
|
+
fftw: "fftw";
|
|
1180
|
+
js: "js";
|
|
1181
|
+
}>>;
|
|
1182
|
+
}, z.core.$strip>;
|
|
1183
|
+
interface DeBleedProperties extends z.infer<typeof schema$4>, TransformNodeProperties {
|
|
1184
|
+
}
|
|
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
|
+
declare class DeBleedStream extends BufferedTransformStream<DeBleedProperties> {
|
|
1222
|
+
private fftBackend?;
|
|
1223
|
+
private fftAddonOptions?;
|
|
1224
|
+
private dfttFftBackend?;
|
|
1225
|
+
private dfttFftAddonOptions?;
|
|
1226
|
+
private referenceBuffers;
|
|
1227
|
+
private chunkFrames;
|
|
1228
|
+
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
|
+
*/
|
|
1245
|
+
private warmupSeedsAllChannels;
|
|
1246
|
+
_process(buffer: ChunkBuffer): Promise<void>;
|
|
1247
|
+
}
|
|
1248
|
+
declare class DeBleedNode extends TransformNode<DeBleedProperties> {
|
|
1249
|
+
static readonly moduleName = "De-Bleed Adaptive";
|
|
1250
|
+
static readonly packageName: string;
|
|
1251
|
+
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.";
|
|
1253
|
+
static readonly schema: z.ZodObject<{
|
|
1254
|
+
references: z.ZodDefault<z.ZodArray<z.ZodString>>;
|
|
1255
|
+
reductionStrength: z.ZodDefault<z.ZodNumber>;
|
|
1256
|
+
artifactSmoothing: z.ZodDefault<z.ZodNumber>;
|
|
1257
|
+
adaptationSpeed: z.ZodDefault<z.ZodNumber>;
|
|
1258
|
+
fftSize: z.ZodDefault<z.ZodNumber>;
|
|
1259
|
+
hopSize: z.ZodDefault<z.ZodNumber>;
|
|
1260
|
+
vkfftAddonPath: z.ZodDefault<z.ZodString>;
|
|
1261
|
+
fftwAddonPath: z.ZodDefault<z.ZodString>;
|
|
1262
|
+
dfttBackend: z.ZodDefault<z.ZodEnum<{
|
|
1263
|
+
"": "";
|
|
1264
|
+
vkfft: "vkfft";
|
|
1265
|
+
fftw: "fftw";
|
|
1266
|
+
js: "js";
|
|
1267
|
+
}>>;
|
|
1268
|
+
}, z.core.$strip>;
|
|
1269
|
+
static is(value: unknown): value is DeBleedNode;
|
|
1270
|
+
readonly type: readonly ["buffered-audio-node", "transform", "de-bleed"];
|
|
1271
|
+
constructor(properties: DeBleedProperties);
|
|
1272
|
+
createStream(): DeBleedStream;
|
|
1273
|
+
clone(overrides?: Partial<DeBleedProperties>): DeBleedNode;
|
|
1274
|
+
}
|
|
1275
|
+
declare function deBleed(references: string | ReadonlyArray<string>, options?: {
|
|
1276
|
+
reductionStrength?: number;
|
|
1277
|
+
artifactSmoothing?: number;
|
|
1278
|
+
adaptationSpeed?: number;
|
|
1279
|
+
fftSize?: number;
|
|
1280
|
+
hopSize?: number;
|
|
1281
|
+
vkfftAddonPath?: string;
|
|
1282
|
+
fftwAddonPath?: string;
|
|
1283
|
+
dfttBackend?: "" | "js" | "fftw" | "vkfft";
|
|
1284
|
+
id?: string;
|
|
1285
|
+
}): DeBleedNode;
|
|
1286
|
+
|
|
1287
|
+
declare const schema$3: z.ZodObject<{
|
|
1288
|
+
modelPath: z.ZodDefault<z.ZodString>;
|
|
1289
|
+
ffmpegPath: z.ZodDefault<z.ZodString>;
|
|
1290
|
+
onnxAddonPath: z.ZodDefault<z.ZodString>;
|
|
1291
|
+
sampleRate: z.ZodNumber;
|
|
1292
|
+
attenuation: z.ZodDefault<z.ZodNumber>;
|
|
1293
|
+
}, z.core.$strip>;
|
|
1294
|
+
interface DeepFilterNet3Properties extends z.infer<typeof schema$3>, TransformNodeProperties {
|
|
1295
|
+
}
|
|
1296
|
+
declare class DeepFilterNet3Stream extends BufferedTransformStream<DeepFilterNet3Properties> {
|
|
1297
|
+
private session?;
|
|
1298
|
+
private dfnStates;
|
|
1299
|
+
_setup(input: ReadableStream<AudioChunk>, context: StreamContext): Promise<ReadableStream<AudioChunk>>;
|
|
1300
|
+
_process(buffer: ChunkBuffer): Promise<void>;
|
|
1301
|
+
_teardown(): void;
|
|
1302
|
+
}
|
|
1303
|
+
declare class DeepFilterNet3Node extends TransformNode<DeepFilterNet3Properties> {
|
|
1304
|
+
static readonly moduleName = "DeepFilterNet3 (Denoiser)";
|
|
1305
|
+
static readonly packageName: string;
|
|
1306
|
+
static readonly packageVersion: string;
|
|
1307
|
+
static readonly moduleDescription = "Remove background noise from speech using DeepFilterNet3 (48 kHz full-band CRN)";
|
|
1308
|
+
static readonly schema: z.ZodObject<{
|
|
1309
|
+
modelPath: z.ZodDefault<z.ZodString>;
|
|
1310
|
+
ffmpegPath: z.ZodDefault<z.ZodString>;
|
|
1311
|
+
onnxAddonPath: z.ZodDefault<z.ZodString>;
|
|
1312
|
+
sampleRate: z.ZodNumber;
|
|
1313
|
+
attenuation: z.ZodDefault<z.ZodNumber>;
|
|
1314
|
+
}, z.core.$strip>;
|
|
1315
|
+
static is(value: unknown): value is DeepFilterNet3Node;
|
|
1316
|
+
readonly type: readonly ["buffered-audio-node", "transform", "deep-filter-net-3"];
|
|
1317
|
+
constructor(properties: DeepFilterNet3Properties);
|
|
1318
|
+
createStream(): DeepFilterNet3Stream;
|
|
1319
|
+
clone(overrides?: Partial<DeepFilterNet3Properties>): DeepFilterNet3Node;
|
|
1320
|
+
}
|
|
1321
|
+
declare function deepFilterNet3(options: {
|
|
1322
|
+
modelPath: string;
|
|
1323
|
+
sampleRate: number;
|
|
1324
|
+
ffmpegPath?: string;
|
|
1325
|
+
onnxAddonPath?: string;
|
|
1326
|
+
attenuation?: number;
|
|
1327
|
+
id?: string;
|
|
1328
|
+
}): DeepFilterNet3Node;
|
|
1329
|
+
|
|
1330
|
+
declare const schema$2: z.ZodObject<{
|
|
1331
|
+
modelPath1: z.ZodDefault<z.ZodString>;
|
|
1332
|
+
modelPath2: z.ZodDefault<z.ZodString>;
|
|
1333
|
+
ffmpegPath: z.ZodDefault<z.ZodString>;
|
|
1334
|
+
onnxAddonPath: z.ZodDefault<z.ZodString>;
|
|
1335
|
+
vkfftAddonPath: z.ZodDefault<z.ZodString>;
|
|
1336
|
+
fftwAddonPath: z.ZodDefault<z.ZodString>;
|
|
1337
|
+
}, z.core.$strip>;
|
|
1338
|
+
interface DtlnProperties extends z.infer<typeof schema$2>, TransformNodeProperties {
|
|
1339
|
+
}
|
|
1340
|
+
declare class DtlnStream extends BufferedTransformStream<DtlnProperties> {
|
|
1341
|
+
private session1;
|
|
1342
|
+
private session2;
|
|
1343
|
+
private fftBackend?;
|
|
1344
|
+
private fftAddonOptions?;
|
|
1345
|
+
_setup(input: ReadableStream<AudioChunk>, context: StreamContext): Promise<ReadableStream<AudioChunk>>;
|
|
1346
|
+
_process(buffer: ChunkBuffer): Promise<void>;
|
|
1347
|
+
private runMainPass;
|
|
1348
|
+
}
|
|
1349
|
+
declare class DtlnNode extends TransformNode<DtlnProperties> {
|
|
1350
|
+
static readonly moduleName = "DTLN (Denoiser)";
|
|
1351
|
+
static readonly packageName: string;
|
|
1352
|
+
static readonly packageVersion: string;
|
|
1353
|
+
static readonly moduleDescription = "Remove background noise from speech using DTLN neural network";
|
|
1354
|
+
static readonly schema: z.ZodObject<{
|
|
1355
|
+
modelPath1: z.ZodDefault<z.ZodString>;
|
|
1356
|
+
modelPath2: z.ZodDefault<z.ZodString>;
|
|
1357
|
+
ffmpegPath: z.ZodDefault<z.ZodString>;
|
|
1358
|
+
onnxAddonPath: z.ZodDefault<z.ZodString>;
|
|
1359
|
+
vkfftAddonPath: z.ZodDefault<z.ZodString>;
|
|
1360
|
+
fftwAddonPath: z.ZodDefault<z.ZodString>;
|
|
1361
|
+
}, z.core.$strip>;
|
|
1362
|
+
static is(value: unknown): value is DtlnNode;
|
|
1363
|
+
readonly type: readonly ["buffered-audio-node", "transform", "dtln"];
|
|
1364
|
+
constructor(properties: DtlnProperties);
|
|
1365
|
+
createStream(): DtlnStream;
|
|
1366
|
+
clone(overrides?: Partial<DtlnProperties>): DtlnNode;
|
|
1367
|
+
}
|
|
1368
|
+
declare function dtln(options: {
|
|
1369
|
+
modelPath1: string;
|
|
1370
|
+
modelPath2: string;
|
|
1371
|
+
ffmpegPath: string;
|
|
1372
|
+
onnxAddonPath?: string;
|
|
1373
|
+
vkfftAddonPath?: string;
|
|
1374
|
+
fftwAddonPath?: string;
|
|
1375
|
+
id?: string;
|
|
1376
|
+
}): DtlnNode;
|
|
1377
|
+
|
|
1378
|
+
interface StemGains {
|
|
1379
|
+
readonly vocals: number;
|
|
1380
|
+
readonly drums: number;
|
|
1381
|
+
readonly bass: number;
|
|
1382
|
+
readonly other: number;
|
|
1383
|
+
}
|
|
1384
|
+
declare const schema$1: z.ZodObject<{
|
|
1385
|
+
modelPath: z.ZodDefault<z.ZodString>;
|
|
1386
|
+
ffmpegPath: z.ZodDefault<z.ZodString>;
|
|
1387
|
+
onnxAddonPath: z.ZodDefault<z.ZodString>;
|
|
1388
|
+
highPass: z.ZodDefault<z.ZodNumber>;
|
|
1389
|
+
lowPass: z.ZodDefault<z.ZodNumber>;
|
|
1390
|
+
}, z.core.$strip>;
|
|
1391
|
+
interface HtdemucsProperties extends z.infer<typeof schema$1>, TransformNodeProperties {
|
|
1392
|
+
readonly stems: StemGains;
|
|
1393
|
+
}
|
|
1394
|
+
declare class HtdemucsStream extends BufferedTransformStream<HtdemucsProperties> {
|
|
1395
|
+
private session;
|
|
1396
|
+
_setup(input: ReadableStream<AudioChunk>, context: StreamContext): Promise<ReadableStream<AudioChunk>>;
|
|
1397
|
+
_process(buffer: ChunkBuffer): Promise<void>;
|
|
1398
|
+
private runMainPass;
|
|
1399
|
+
private emitStable;
|
|
1400
|
+
}
|
|
1401
|
+
declare class HtdemucsNode extends TransformNode<HtdemucsProperties> {
|
|
1402
|
+
static readonly moduleName = "HTDemucs (Stem Separator)";
|
|
1403
|
+
static readonly packageName: string;
|
|
1404
|
+
static readonly packageVersion: string;
|
|
1405
|
+
static readonly moduleDescription = "Rebalance stem volumes using HTDemucs source separation";
|
|
1406
|
+
static readonly schema: z.ZodObject<{
|
|
1407
|
+
modelPath: z.ZodDefault<z.ZodString>;
|
|
1408
|
+
ffmpegPath: z.ZodDefault<z.ZodString>;
|
|
1409
|
+
onnxAddonPath: z.ZodDefault<z.ZodString>;
|
|
1410
|
+
highPass: z.ZodDefault<z.ZodNumber>;
|
|
1411
|
+
lowPass: z.ZodDefault<z.ZodNumber>;
|
|
1412
|
+
}, z.core.$strip>;
|
|
1413
|
+
static is(value: unknown): value is HtdemucsNode;
|
|
1414
|
+
readonly type: readonly ["buffered-audio-node", "transform", "htdemucs"];
|
|
1415
|
+
constructor(properties: HtdemucsProperties);
|
|
1416
|
+
createStream(): HtdemucsStream;
|
|
1417
|
+
clone(overrides?: Partial<HtdemucsProperties>): HtdemucsNode;
|
|
1418
|
+
}
|
|
1419
|
+
declare function htdemucs(modelPath: string, stems: Partial<StemGains>, options?: {
|
|
1420
|
+
ffmpegPath?: string;
|
|
1421
|
+
onnxAddonPath?: string;
|
|
1422
|
+
id?: string;
|
|
1423
|
+
}): HtdemucsNode;
|
|
1424
|
+
|
|
1425
|
+
declare const schema: z.ZodObject<{
|
|
1426
|
+
modelPath: z.ZodDefault<z.ZodString>;
|
|
1427
|
+
ffmpegPath: z.ZodDefault<z.ZodString>;
|
|
1428
|
+
onnxAddonPath: z.ZodDefault<z.ZodString>;
|
|
1429
|
+
highPass: z.ZodDefault<z.ZodNumber>;
|
|
1430
|
+
lowPass: z.ZodDefault<z.ZodNumber>;
|
|
1431
|
+
}, z.core.$strip>;
|
|
1432
|
+
interface KimVocal2Properties extends z.infer<typeof schema>, TransformNodeProperties {
|
|
1433
|
+
}
|
|
1434
|
+
declare class KimVocal2Stream extends BufferedTransformStream<KimVocal2Properties> {
|
|
1435
|
+
private session;
|
|
1436
|
+
private fftInstance;
|
|
1437
|
+
constructor(properties: KimVocal2Properties);
|
|
1438
|
+
_setup(input: ReadableStream<AudioChunk>, context: StreamContext): Promise<ReadableStream<AudioChunk>>;
|
|
1439
|
+
_process(buffer: ChunkBuffer): Promise<void>;
|
|
1440
|
+
private runMainPass;
|
|
1441
|
+
private emitStable;
|
|
1442
|
+
}
|
|
1443
|
+
declare class KimVocal2Node extends TransformNode<KimVocal2Properties> {
|
|
1444
|
+
static readonly moduleName = "Kim Vocal 2 (Stem Separator)";
|
|
1445
|
+
static readonly packageName: string;
|
|
1446
|
+
static readonly packageVersion: string;
|
|
1447
|
+
static readonly moduleDescription = "Isolate dialogue from background using MDX-Net vocal separation";
|
|
1448
|
+
static readonly schema: z.ZodObject<{
|
|
1449
|
+
modelPath: z.ZodDefault<z.ZodString>;
|
|
1450
|
+
ffmpegPath: z.ZodDefault<z.ZodString>;
|
|
1451
|
+
onnxAddonPath: z.ZodDefault<z.ZodString>;
|
|
1452
|
+
highPass: z.ZodDefault<z.ZodNumber>;
|
|
1453
|
+
lowPass: z.ZodDefault<z.ZodNumber>;
|
|
1454
|
+
}, z.core.$strip>;
|
|
1455
|
+
static is(value: unknown): value is KimVocal2Node;
|
|
1456
|
+
readonly type: readonly ["buffered-audio-node", "transform", "kim-vocal-2"];
|
|
1457
|
+
constructor(properties: KimVocal2Properties);
|
|
1458
|
+
createStream(): KimVocal2Stream;
|
|
1459
|
+
clone(overrides?: Partial<KimVocal2Properties>): KimVocal2Node;
|
|
1460
|
+
}
|
|
1461
|
+
declare function kimVocal2(options: {
|
|
1462
|
+
modelPath: string;
|
|
1463
|
+
ffmpegPath: string;
|
|
1464
|
+
onnxAddonPath?: string;
|
|
1465
|
+
highPass?: number;
|
|
1466
|
+
lowPass?: number;
|
|
1467
|
+
id?: string;
|
|
1468
|
+
}): KimVocal2Node;
|
|
1469
|
+
|
|
1470
|
+
interface VstStage {
|
|
1471
|
+
readonly pluginPath: string;
|
|
1472
|
+
readonly pluginName?: string;
|
|
1473
|
+
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
|
+
}
|
|
1484
|
+
|
|
1485
|
+
interface Vst3Properties extends TransformNodeProperties {
|
|
1486
|
+
readonly vstHostPath: string;
|
|
1487
|
+
readonly stages: ReadonlyArray<VstStage>;
|
|
1488
|
+
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
|
+
readonly extraArgs?: ReadonlyArray<string>;
|
|
1495
|
+
}
|
|
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
|
+
declare class Vst3Stream<P extends Vst3Properties = Vst3Properties> extends BufferedTransformStream<P> {
|
|
1516
|
+
private streamContext?;
|
|
1517
|
+
private stagesJsonPath?;
|
|
1518
|
+
private stagesJsonCleanup?;
|
|
1519
|
+
_setup(input: ReadableStream<AudioChunk>, context: StreamContext): Promise<ReadableStream<AudioChunk>>;
|
|
1520
|
+
_process(buffer: ChunkBuffer): Promise<void>;
|
|
1521
|
+
_teardown(): Promise<void>;
|
|
1522
|
+
}
|
|
1523
|
+
declare class Vst3Node<P extends Vst3Properties = Vst3Properties> extends TransformNode<P> {
|
|
1524
|
+
static readonly moduleName: string;
|
|
1525
|
+
static readonly packageName: string;
|
|
1526
|
+
static readonly packageVersion: string;
|
|
1527
|
+
static readonly moduleDescription: string;
|
|
1528
|
+
static readonly schema: z.ZodType;
|
|
1529
|
+
static is(value: unknown): value is Vst3Node;
|
|
1530
|
+
readonly type: ReadonlyArray<string>;
|
|
1531
|
+
constructor(properties: P);
|
|
1532
|
+
createStream(): BufferedTransformStream<P>;
|
|
1533
|
+
clone(overrides?: Partial<P>): Vst3Node<P>;
|
|
1534
|
+
}
|
|
1535
|
+
declare function vst3(options: {
|
|
1536
|
+
vstHostPath: string;
|
|
1537
|
+
stages: ReadonlyArray<VstStage>;
|
|
1538
|
+
bypass?: boolean;
|
|
1539
|
+
id?: string;
|
|
1540
|
+
extraArgs?: ReadonlyArray<string>;
|
|
1541
|
+
}): Vst3Node;
|
|
1542
|
+
|
|
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;
|
|
1556
|
+
|
|
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 };
|