Quickstart - AudioShake Developers

Prerequisites

File-based separation

Use SourceSeparationTask for file-to-file processing:

#include "AudioShakeSDK.h"

AudioFileReader* input = new AudioFileReader("input.wav");
WAVOutput* output = new WAVOutput("./output/");

SourceSeparationTask task(
    "your_client_id",
    "your_client_secret",
    input,
    output,
    "path/to/model.crypt"
);

void onProgress(SourceSeparationTask* task, double progress, void* data) {
    printf("Progress: %.0f%%\n", progress * 100);
}

if (!task.run(onProgress)) {
    fprintf(stderr, "Error: %s\n", task.getErrorMessage());
}

Streaming separation

Use RingBufferInput and RingBufferOutput for real-time or streaming use cases:

RingBufferInput* input = new RingBufferInput(4096, true, 44100);
RingBufferOutput* output = new RingBufferOutput(4096, false);

SourceSeparationTask task(
    "your_client_id",
    "your_client_secret",
    input,
    output,
    "path/to/model.crypt"
);

Write audio frames into the input ring buffer, then read separated stems from the output ring buffer as processing proceeds.

Choosing a chunk size

Chunk size controls the trade-off between latency and throughput. Durations are approximate and vary by model.

Flag Approx. duration Use when
chunkNormal (default) ~3 sec Batch or file processing
chunk2X ~1.5 sec Moderate latency
chunk4X ~0.75 sec Low latency
chunk8X ~375 ms Real-time
chunk16X ~185 ms Ultra low latency
chunk32X ~92 ms Ultra low latency
chunk64X ~46 ms Lowest latency

Smaller chunks reduce latency but increase CPU/GPU overhead per unit of audio.