longpipe 0.0.11 → 0.0.12

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.cts CHANGED
@@ -194,7 +194,7 @@ interface RendererStats {
194
194
  inputPath: string;
195
195
  outputPath: string;
196
196
  }
197
- type ErrorSource = 'backend-lost' | 'worker' | 'adaptive' | 'background' | 'unknown';
197
+ type ErrorSource = 'backend-lost' | 'worker' | 'adaptive' | 'background' | 'audio' | 'unknown';
198
198
  interface PipelineError {
199
199
  message: string;
200
200
  source: ErrorSource;
@@ -202,13 +202,35 @@ interface PipelineError {
202
202
  cause?: unknown;
203
203
  }
204
204
 
205
+ type DenoiseModel = 'rnnoise' | 'dfn' | 'dfnint8';
206
+ type DenoiseTier = 'high' | 'mid' | 'low';
207
+ type DenoiseModelOption = 'auto' | DenoiseTier | DenoiseModel;
208
+
209
+ interface DenoiseOptions {
210
+ model?: DenoiseModelOption;
211
+ postFilterBeta?: number;
212
+ gruLeak?: number;
213
+ enabled?: boolean;
214
+ }
215
+ type AudioInput = 'passthrough' | 'drop' | 'denoise' | {
216
+ denoise: DenoiseOptions;
217
+ };
205
218
  type AudioMode = 'passthrough' | 'drop';
206
219
 
220
+ interface AudioStats {
221
+ model: DenoiseModel;
222
+ p50Ms: number | null;
223
+ p95Ms: number | null;
224
+ latencyMs: number;
225
+ active: boolean;
226
+ sampleRate: number;
227
+ }
228
+
207
229
  interface PipelineOptions {
208
230
  background?: BackgroundInput;
209
231
  preset?: PresetName | ManualPreset;
210
232
  weightsBaseUrl?: string;
211
- audio?: AudioMode;
233
+ audio?: AudioInput;
212
234
  enabled?: boolean;
213
235
  outputResolution?: {
214
236
  w: number;
@@ -227,6 +249,7 @@ declare class Pipeline implements PromiseLike<Pipeline> {
227
249
  private inputCleanup;
228
250
  private outputCleanup;
229
251
  private adaptive;
252
+ private denoiser;
230
253
  private bgCleanup;
231
254
  private previewBgCleanup;
232
255
  constructor(inputStream: MediaStream, options: PipelineOptions);
@@ -242,6 +265,8 @@ declare class Pipeline implements PromiseLike<Pipeline> {
242
265
  clearPreview(): void;
243
266
  setEnabled(on: boolean): void;
244
267
  getStats(): Promise<RendererStats>;
268
+ setDenoise(input: boolean | DenoiseOptions): void;
269
+ getAudioStats(): AudioStats | null;
245
270
  destroy(): void;
246
271
  }
247
272
 
@@ -283,4 +308,4 @@ declare class WebGPUBackend implements Backend {
283
308
  destroy(): void;
284
309
  }
285
310
 
286
- export { type Activation, type AudioMode, type Backend, type Background, type BackgroundInput, type BlurInput, type ColorInput, type Conv2dParams, type DepthwiseParams, Pipeline as EffectsPipeline, type ErrorSource, type ImageInput, type ManualPreset, type ModelName, type Op, type PipelineError, type PipelineOptions, type PresetName, type Tensor, type VideoInput, WebGPUBackend };
311
+ export { type Activation, type AudioInput, type AudioMode, type AudioStats, type Backend, type Background, type BackgroundInput, type BlurInput, type ColorInput, type Conv2dParams, type DenoiseModel, type DenoiseModelOption, type DenoiseOptions, type DenoiseTier, type DepthwiseParams, Pipeline as EffectsPipeline, type ErrorSource, type ImageInput, type ManualPreset, type ModelName, type Op, type PipelineError, type PipelineOptions, type PresetName, type Tensor, type VideoInput, WebGPUBackend };
package/dist/index.d.ts CHANGED
@@ -194,7 +194,7 @@ interface RendererStats {
194
194
  inputPath: string;
195
195
  outputPath: string;
196
196
  }
197
- type ErrorSource = 'backend-lost' | 'worker' | 'adaptive' | 'background' | 'unknown';
197
+ type ErrorSource = 'backend-lost' | 'worker' | 'adaptive' | 'background' | 'audio' | 'unknown';
198
198
  interface PipelineError {
199
199
  message: string;
200
200
  source: ErrorSource;
@@ -202,13 +202,35 @@ interface PipelineError {
202
202
  cause?: unknown;
203
203
  }
204
204
 
205
+ type DenoiseModel = 'rnnoise' | 'dfn' | 'dfnint8';
206
+ type DenoiseTier = 'high' | 'mid' | 'low';
207
+ type DenoiseModelOption = 'auto' | DenoiseTier | DenoiseModel;
208
+
209
+ interface DenoiseOptions {
210
+ model?: DenoiseModelOption;
211
+ postFilterBeta?: number;
212
+ gruLeak?: number;
213
+ enabled?: boolean;
214
+ }
215
+ type AudioInput = 'passthrough' | 'drop' | 'denoise' | {
216
+ denoise: DenoiseOptions;
217
+ };
205
218
  type AudioMode = 'passthrough' | 'drop';
206
219
 
220
+ interface AudioStats {
221
+ model: DenoiseModel;
222
+ p50Ms: number | null;
223
+ p95Ms: number | null;
224
+ latencyMs: number;
225
+ active: boolean;
226
+ sampleRate: number;
227
+ }
228
+
207
229
  interface PipelineOptions {
208
230
  background?: BackgroundInput;
209
231
  preset?: PresetName | ManualPreset;
210
232
  weightsBaseUrl?: string;
211
- audio?: AudioMode;
233
+ audio?: AudioInput;
212
234
  enabled?: boolean;
213
235
  outputResolution?: {
214
236
  w: number;
@@ -227,6 +249,7 @@ declare class Pipeline implements PromiseLike<Pipeline> {
227
249
  private inputCleanup;
228
250
  private outputCleanup;
229
251
  private adaptive;
252
+ private denoiser;
230
253
  private bgCleanup;
231
254
  private previewBgCleanup;
232
255
  constructor(inputStream: MediaStream, options: PipelineOptions);
@@ -242,6 +265,8 @@ declare class Pipeline implements PromiseLike<Pipeline> {
242
265
  clearPreview(): void;
243
266
  setEnabled(on: boolean): void;
244
267
  getStats(): Promise<RendererStats>;
268
+ setDenoise(input: boolean | DenoiseOptions): void;
269
+ getAudioStats(): AudioStats | null;
245
270
  destroy(): void;
246
271
  }
247
272
 
@@ -283,4 +308,4 @@ declare class WebGPUBackend implements Backend {
283
308
  destroy(): void;
284
309
  }
285
310
 
286
- export { type Activation, type AudioMode, type Backend, type Background, type BackgroundInput, type BlurInput, type ColorInput, type Conv2dParams, type DepthwiseParams, Pipeline as EffectsPipeline, type ErrorSource, type ImageInput, type ManualPreset, type ModelName, type Op, type PipelineError, type PipelineOptions, type PresetName, type Tensor, type VideoInput, WebGPUBackend };
311
+ export { type Activation, type AudioInput, type AudioMode, type AudioStats, type Backend, type Background, type BackgroundInput, type BlurInput, type ColorInput, type Conv2dParams, type DenoiseModel, type DenoiseModelOption, type DenoiseOptions, type DenoiseTier, type DepthwiseParams, Pipeline as EffectsPipeline, type ErrorSource, type ImageInput, type ManualPreset, type ModelName, type Op, type PipelineError, type PipelineOptions, type PresetName, type Tensor, type VideoInput, WebGPUBackend };