Skip to main content

Denoise a File

client.denoise.process() uploads an audio file and returns clean, noise-free audio.


Signature

client.denoise.process(
file: FileInput,
options?: DenoiseOptions,
requestOptions?: RequestOptions
): Promise<DenoisingResult>

Parameters

fileFileInput

The audio to denoise. Accepts Buffer, Uint8Array, ArrayBuffer, Blob, File, or ReadableStream.

optionsDenoiseOptions

PropertyTypeDefaultDescription
modelstringautoModel name. Omit to let the server pick the best model for your plan.
outputFormatOutputFormatplan defaultStorage format: 'wav', 'mp3', 'flac', or 'opus_ogg'. Availability depends on your plan — see client.denoise.formats(). Cannot be changed after the job is created.

requestOptionsRequestOptions

PropertyTypeDefaultDescription
timeoutnumber300000Request timeout in ms
maxRetriesnumber2Retry count override
signalAbortSignalCancellation signal

Response — DenoisingResult

{
jobId: string;
status: 'completed';
createdAt: string;
completedAt: string | undefined;

// Timing
processingTimeMs: number | undefined;
tritonProcessingTimeMs: number | undefined;

// Input file
inputUrl: string | null; // Presigned URL to the original audio (24h TTL)
inputUrlExpiresAt: string | null;
inputFileSize: number | undefined;

// Output file
outputUrl: string | null; // Presigned URL to the cleaned audio (24h TTL)
outputUrlExpiresAt: string | null;
outputFileSize: number | undefined;
outputEphemeral: boolean; // true = URL expires in ~1h, not stored long-term
outputFormat: OutputFormat | undefined;

// Metadata
audioMetadata: AudioMetadata | undefined;
processingMetadata: {
tritonProcessingTimeMs: number | undefined;
realTimeFactor: number | undefined;
modelName: string | undefined;
} | undefined;
}

Examples

Basic denoising

import { readFileSync } from 'fs';
import { Decrackle } from '@decrackle/sdk';

const client = new Decrackle({ apiKey: process.env.DECRACKLE_API_KEY });
const audio = readFileSync('./noisy-call.wav');

const result = await client.denoise.process(audio);

console.log('Clean audio:', result.outputUrl);
console.log('Processing time:', result.processingTimeMs, 'ms');

Download the cleaned file

const result = await client.denoise.process(audio);

if (result.outputUrl) {
const response = await fetch(result.outputUrl);
const cleanAudio = Buffer.from(await response.arrayBuffer());
writeFileSync('./clean-audio.wav', cleanAudio);
}

Choose an output format

// Check what your plan allows (optional)
const { formats, defaultFormat } = await client.denoise.formats();

// Store the cleaned audio as FLAC instead of your plan's default
const result = await client.denoise.process(audio, { outputFormat: 'flac' });

console.log(result.outputFormat); // 'flac'
console.log(result.outputUrl); // presigned URL to a .flac file

Detect ephemeral output

const result = await client.denoise.process(audio);

if (result.outputEphemeral) {
// Download immediately — URL only valid for ~1 hour
console.warn('Ephemeral output: download now before it expires');
}

With extended timeout for large files

const result = await client.denoise.process(
largeAudioBuffer,
{},
{ timeout: 600_000 } // 10 minutes
);

With cancellation

const controller = new AbortController();
setTimeout(() => controller.abort(), 60_000);

const result = await client.denoise.process(audio, {}, { signal: controller.signal });

Errors

Error classWhen
DecracklePermissionErrorPlan does not include denoising, or outputFormat isn't available
DecrackleValidationErrorInvalid format, file too large, or storage quota exceeded
DecrackleServiceUnavailableErrorModel temporarily unavailable
DecrackleTimeoutErrorRequest timed out