### Example API Request
Source: https://developer.audioshake.ai/api-reference/authentication
All API requests require an `x-api-key` header. This example shows how to include it in a curl request.
```APIDOC
## GET /tasks
### Description
This endpoint retrieves a list of tasks. All API requests require an `x-api-key` header.
### Method
GET
### Endpoint
/tasks
### Parameters
#### Request Headers
- **x-api-key** (string) - Required - Your API key for authentication.
### Request Example
```bash
curl -X GET "https://api.audioshake.ai/tasks" \
-H "x-api-key: your_api_key"
```
```
--------------------------------
### Authenticate API Request with API Key
Source: https://developer.audioshake.ai/api-reference/authentication
Include your API key in the `x-api-key` header for all requests to the AudioShake API. This example shows how to authenticate a GET request to the tasks endpoint.
```bash
curl -X GET "https://api.audioshake.ai/tasks" \
-H "x-api-key: your_api_key"
```
--------------------------------
### Create Karaoke Task (JavaScript)
Source: https://developer.audioshake.ai/create-karaoke-tracks
This JavaScript example demonstrates how to initiate a karaoke track creation task using the AudioShake API. Remember to substitute placeholder values for API key and asset ID.
```javascript
const API_KEY = "your_api_key";
const headers = { "Content-Type": "application/json", "x-api-key": API_KEY };
const createRes = await fetch("https://api.audioshake.ai/tasks", {
method: "POST",
headers,
body: JSON.stringify({
assetId: "your_asset_id",
targets: [
{ model: "instrumental", formats: ["wav"] },
{ model: "vocals", formats: ["wav"] },
{ model: "alignment", formats: ["json"] }
]
})
});
const { id: taskId } = await createRes.json();
console.log(`Task created: ${taskId}`);
```
--------------------------------
### Upload and create a Task
Source: https://developer.audioshake.ai/upload-file
This snippet demonstrates the process of uploading a local file to create an Asset and then using the Asset ID to create a Task. It includes examples for Python, JavaScript, and cURL.
```APIDOC
## Upload and create a Task
### Description
Upload a local file to create an Asset, then use the returned `assetId` to create a Task.
### Method
POST
### Endpoint
`/assets` (for file upload)
`/tasks` (for task creation)
### Parameters
#### Request Body (for `/assets` POST)
- **file** (file) - Required - The local media file to upload.
#### Headers (for `/assets` POST)
- **x-api-key** (string) - Required - Your API key.
#### Request Body (for `/tasks` POST)
- **assetId** (string) - Required - The ID of the uploaded asset.
- **targets** (array) - Required - A list of target models and formats for the task.
- **model** (string) - Required - The model to use (e.g., "vocals", "instrumental").
- **formats** (array) - Required - A list of desired output formats (e.g., ["wav"]).
#### Headers (for `/tasks` POST)
- **Content-Type** (string) - Required - `application/json`
- **x-api-key** (string) - Required - Your API key.
### Request Example
```python
import requests
API_KEY = "your_api_key"
# 1. Upload the file
upload_res = requests.post(
"https://api.audioshake.ai/assets",
headers={"x-api-key": API_KEY},
files={"file": open("song.mp3", "rb")}
)
asset_id = upload_res.json()["id"]
print(f"Asset created: {asset_id}")
# 2. Create a Task using the assetId
task_res = requests.post(
"https://api.audioshake.ai/tasks",
headers={"Content-Type": "application/json", "x-api-key": API_KEY},
json={
"assetId": asset_id,
"targets": [
{"model": "vocals", "formats": ["wav"]},
{"model": "instrumental", "formats": ["wav"]}
]
}
)
task_id = task_res.json()["id"]
print(f"Task created: {task_id}")
```
### Response
#### Success Response (200)
- **id** (string) - The ID of the created asset or task.
#### Response Example
```json
{
"id": "asset_or_task_id"
}
```
Maximum file size is 2GB. Uploaded Assets expire after 72 hours.
See the [Formats](/api-reference/formats) page for supported input file types.
```
--------------------------------
### Upload File and Create Task (Python)
Source: https://developer.audioshake.ai/upload-file
Use this Python script to upload a local file and create a processing task. Ensure you have the 'requests' library installed. Replace 'your_api_key' with your actual API key.
```python
import requests
API_KEY = "your_api_key"
# 1. Upload the file
upload_res = requests.post(
"https://api.audioshake.ai/assets",
headers={"x-api-key": API_KEY},
files={"file": open("song.mp3", "rb")}
)
asset_id = upload_res.json()["id"]
print(f"Asset created: {asset_id}")
# 2. Create a Task using the assetId
task_res = requests.post(
"https://api.audioshake.ai/tasks",
headers={"Content-Type": "application/json", "x-api-key": API_KEY},
json={
"assetId": asset_id,
"targets": [
{"model": "vocals", "formats": ["wav"]},
{"model": "instrumental", "formats": ["wav"]}
]
}
)
task_id = task_res.json()["id"]
print(f"Task created: {task_id}")
```
--------------------------------
### Get AudioShakeSeparator Version
Source: https://developer.audioshake.ai/sdk/api-reference
Retrieves the version string for the SDK and the loaded model.
```cpp
const char* getVersion(); // SDK and model version string
```
--------------------------------
### Get AudioShakeSeparator Initialization Status
Source: https://developer.audioshake.ai/sdk/api-reference
Retrieves the initialization status of the AudioShakeSeparator. Returns NULL on success or an error string on failure.
```cpp
const char* getInitializationError(); // NULL on success, error string on failure
```
--------------------------------
### Create a new AudioShake task using Python
Source: https://developer.audioshake.ai/quickstart
This Python script sends a POST request to create a new audio separation task. Ensure you have the 'requests' library installed and replace 'your_api_key' with your actual API key.
```python
import requests
response = requests.post(
"https://api.audioshake.ai/tasks",
headers={
"Content-Type": "application/json",
"x-api-key": "your_api_key"
},
json={
"url": "https://demos.audioshake.ai/demo-assets/shakeitup.mp3",
"targets": [
{"model": "vocals", "formats": ["wav"]},
{"model": "instrumental", "formats": ["wav"]}
]
}
)
print(response.json()["id"])
```
--------------------------------
### Get AudioShakeSeparator Backend Information
Source: https://developer.audioshake.ai/sdk/api-reference
Retrieves the name of the active backend used by AudioShakeSeparator (e.g., "LiteRT GPU", "Metal", "CPU").
```cpp
const char* getBackendName(); // Active backend (e.g. "LiteRT GPU", "Metal", "CPU")
```
--------------------------------
### Initialize WAVOutput
Source: https://developer.audioshake.ai/sdk/api-reference
Constructs a WAVOutput to write separated audio stems as individual WAV files to a specified output path.
```cpp
WAVOutput(const char* outputPath);
```
--------------------------------
### Upload File and Create Task (cURL)
Source: https://developer.audioshake.ai/upload-file
Use these cURL commands to upload a local file and create a processing task. Ensure the `AUDIOSHAKE_API_KEY` environment variable is set. Replace 'your_asset_id' with the ID obtained from the upload step.
```bash
# 1. Upload the file
curl -X POST "https://api.audioshake.ai/assets" \
-H "x-api-key: $AUDIOSHAKE_API_KEY" \
-F 'file=@song.mp3'
# 2. Create a Task with the returned assetId
curl -X POST "https://api.audioshake.ai/tasks" \
-H "Content-Type: application/json" \
-H "x-api-key: $AUDIOSHAKE_API_KEY" \
-d '{
"assetId": "your_asset_id",
"targets": [
{ "model": "vocals", "formats": ["wav"] },
{ "model": "instrumental", "formats": ["wav"] }
]
}'
```
--------------------------------
### Initialize AudioFileReader
Source: https://developer.audioshake.ai/sdk/api-reference
Constructs an AudioFileReader to read audio data from a specified file path. Supports formats like WAV and MP3.
```cpp
AudioFileReader(const char* filePath);
```
--------------------------------
### Webhook Payload Example
Source: https://developer.audioshake.ai/api-reference/tasks/webhooks
The payload sent to your webhook URL is the full Task object, reflecting the current status of its targets. This example shows a task with one completed target and one still processing.
```json
{
"id": "cmn5h1wv600edx8fgoboeeg06",
"createdAt": "2026-03-25T03:16:17.442Z",
"clientId": "cm4lousna0yurbk8ngu31n8bb",
"assetId": "cmn5gz2s800xp01phe9v3bm5r",
"targets": [
{
"id": "cmn5h1vsn010001pv1cjg2n4t",
"model": "bass",
"cost": 4,
"formats": ["wav"],
"status": "completed",
"duration": 200.53,
"output": [
{
"name": "bass",
"format": "wav",
"link": "https://cdn.audioshake.ai/..."
}
]
},
{
"id": "cmn5h1vsn00zz01pv6xjn3hxd",
"model": "drums",
"formats": ["wav"],
"status": "processing",
"output": []
}
]
}
```
--------------------------------
### Initialize AudioShakeSeparator
Source: https://developer.audioshake.ai/sdk/api-reference
Constructs an AudioShakeSeparator instance. Requires client credentials, model data, and audio parameters. Flags configure processing behavior.
```cpp
AudioShakeSeparator(
const char* clientID,
const char* clientSecret,
void* model,
unsigned int modelSizeBytes,
unsigned int inputSamplerate,
unsigned int flags = useFastestBackend | inputFloat |
inputNonInterleaved | outputFloat |
outputNonInterleaved | chunkNormal
);
```
--------------------------------
### Get Task Statistics (OpenAPI)
Source: https://developer.audioshake.ai/api-reference/tasks/statistics
This OpenAPI definition describes the GET /tasks/statistics endpoint. It allows retrieval of either monthly usage breakdown by setting `name=usage` or per-model usage distribution by setting `name=distribution`.
```yaml
openapi: 3.1.0
info:
title: AudioShake API
version: 1.0.0
description: >-
API for AI-powered audio source separation, stem extraction, and
transcription.
license:
name: Proprietary
url: https://www.audioshake.ai/terms
contact:
name: AudioShake
url: https://audioshake.ai
servers:
- url: https://api.audioshake.ai
security:
- apiKey: []
tags:
- name: assets
description: Audio and media file assets managed by AudioShake
- name: tasks
description: Stem separation, source separation, and transcription alignment tasks
paths:
/tasks/statistics:
get:
tags:
- tasks
summary: Get Task Statistics
operationId: getTaskStatistics
parameters:
- schema:
enum:
- usage
- distribution
default: usage
type: string
in: query
name: name
required: true
description: Type of statistics to retrieve
responses:
'200':
description: Default Response
content:
application/json:
schema:
oneOf:
- title: Usage
description: Monthly usage breakdown. Returned when name=usage.
type: array
items:
type: object
properties:
month:
description: Month in YYYY-MM format
type: string
totalTargets:
description: Total number of targets processed
type: number
totalMinutes:
description: Total minutes of audio processed
type: string
- title: Distribution
description: Model usage distribution. Returned when name=distribution.
type: array
items:
type: object
properties:
model:
description: Model name
type: string
count:
description: Number of times the model was used
type: number
percentage:
description: Percentage of total usage
type: string
components:
securitySchemes:
apiKey:
type: apiKey
name: x-api-key
in: header
```
--------------------------------
### Get Asset by ID OpenAPI Specification
Source: https://developer.audioshake.ai/api-reference/assets/get
This OpenAPI specification defines the GET /assets/{id} endpoint for retrieving a single Asset by its unique identifier. It includes parameter details, request/response schemas, and security information.
```yaml
GET /assets/{id}
openapi: 3.1.0
info:
title: AudioShake API
version: 1.0.0
description: >-
API for AI-powered audio source separation, stem extraction, and
transcription.
license:
name: Proprietary
url: https://www.audioshake.ai/terms
contact:
name: AudioShake
url: https://audioshake.ai
servers:
- url: https://api.audioshake.ai
security:
- apiKey: []
tags:
- name: assets
description: Audio and media file assets managed by AudioShake
- name: tasks
description: Stem separation, source separation, and transcription alignment tasks
paths:
/assets/{id}:
get:
tags:
- assets
summary: Get Asset by ID
operationId: getAsset
parameters:
- schema:
minLength: 3
maxLength: 60
type: string
in: path
name: id
required: true
description: Unique identifier of the Asset
responses:
'200':
description: Default Response
content:
application/json:
schema:
type: object
properties:
id:
description: >-
Unique identifier of the Asset. Use this id in the assetId
field when creating a Task.
type: string
format:
description: Format of the Asset
type: string
name:
description: Name of the Asset
type: string
components:
securitySchemes:
apiKey:
type: apiKey
name: x-api-key
in: header
```
--------------------------------
### Get Asset by ID
Source: https://developer.audioshake.ai/api-reference/assets/get
Fetches a single Asset by its unique identifier.
```APIDOC
## GET /assets/{id}
### Description
Fetches a single Asset by its unique identifier.
### Method
GET
### Endpoint
/assets/{id}
### Parameters
#### Path Parameters
- **id** (string) - Required - Unique identifier of the Asset
### Responses
#### Success Response (200)
- **id** (string) - Unique identifier of the Asset. Use this id in the assetId field when creating a Task.
- **format** (string) - Format of the Asset
- **name** (string) - Name of the Asset
```
--------------------------------
### Create Task
Source: https://developer.audioshake.ai/api-reference/tasks/create
Initiates a new task for audio processing. This can be done by referencing an existing asset or providing a direct URL to the media file.
```APIDOC
## POST /tasks
### Description
Creates a new task for audio processing, such as stem separation, source separation, or transcription alignment.
### Method
POST
### Endpoint
/tasks
### Request Body
- **assetId** (string) - Required - Asset ID of an input media file.
- **url** (string) - Required - Public HTTPS URL of an input media file.
- **metadata** (string) - Optional - Client-provided metadata. Stored and returned as-is in responses and webhooks. Max length: 4096.
- **targets** (array) - Required - One or more model targets to process. Min items: 1, Max items: 20.
- **model** (string) - Required - Model to run. Min length: 2, Max length: 255.
- **formats** (array) - Required - Output file formats: "wav", "mp3" for audio models, "json" for transcription and detection models. Items must be unique.
- **residual** (boolean) - Optional - Return the residual (everything not in the target stem).
- **language** (string) - Optional - ISO 639-1 language code (e.g. "en"). Only applies to transcription and alignment models. Auto-detected if omitted. Min length: 2, Max length: 2.
- **transcriptAssetId** (string) - Optional - Asset ID of an existing transcript to align against. Mutually exclusive with transcriptUrl. Min length: 2.
- **transcriptUrl** (string) - Optional - HTTPS URL of an existing transcript to align against. Mutually exclusive with transcriptAssetId. Format: uri. Min length: 2.
### Request Example
```json
{
"assetId": "your_asset_id",
"targets": [
{
"model": "vocals",
"formats": [
"wav"
]
},
{
"model": "instrumental",
"formats": [
"wav"
]
}
]
}
```
### Request Example (using URL)
```json
{
"url": "https://example.com/audio.mp3",
"targets": [
{
"model": "transcription",
"formats": [
"json"
]
}
]
}
```
```
--------------------------------
### Create a Task
Source: https://developer.audioshake.ai/create-karaoke-tracks
Build a complete karaoke package in one API call by creating a task. This task can include instrumental, vocals, and alignment models running in parallel.
```APIDOC
## POST /tasks
### Description
Creates a new task to process an asset for karaoke track generation, including instrumental, vocals, and alignment.
### Method
POST
### Endpoint
https://api.audioshake.ai/tasks
### Parameters
#### Request Body
- **assetId** (string) - Required - The ID of the asset to process.
- **targets** (array) - Required - A list of models to run and their desired formats.
- **model** (string) - Required - The name of the model (e.g., "instrumental", "vocals", "alignment").
- **formats** (array) - Required - A list of desired output formats (e.g., ["wav"], ["json"])
### Request Example
```json
{
"assetId": "your_asset_id",
"targets": [
{"model": "instrumental", "formats": ["wav"]},
{"model": "vocals", "formats": ["wav"]},
{"model": "alignment", "formats": ["json"]}
]
}
```
### Response
#### Success Response (200)
- **id** (string) - The ID of the created task.
#### Response Example
```json
{
"id": "task_id_string"
}
```
```
--------------------------------
### Get Task by ID
Source: https://developer.audioshake.ai/api-reference/tasks/get
Fetches the details of a specific task using its ID.
```APIDOC
## GET /tasks/{id}
### Description
Retrieves the status and details of a specific audio processing task.
### Method
GET
### Endpoint
/tasks/{id}
### Parameters
#### Path Parameters
- **id** (string) - Required - Unique identifier of the Task
### Responses
#### Success Response (200)
- **id** (string) - Unique identifier of the Task
- **createdAt** (string) - Timestamp of when the Task was created
- **completedAt** (string) - Timestamp of when the Task was completed (can be null)
- **clientId** (string) - Unique identifier of the client
- **cost** (number) - Processing cost in credits
- **assetId** (string) - Asset ID of an input media file. Mutually exclusive with url
- **url** (string) - URL of an input media file. Mutually exclusive with assetId (can be null)
- **metadata** (string) - Client-provided metadata. Stored and returned as-is in responses and webhooks.
- **targets** (array) - Processing targets and their current status
- **id** (string) - Unique identifier of the target
- **model** (string) - Model to run. See the Models page for available options.
- **status** (string) - Status of the target: 'processing', 'completed', or 'error'
- **formats** (array) - Output file formats (e.g. "wav", "mp3", "json")
- (string) - Output file format
- **output** (array) - Downloadable output files for this target. Populated when status is "completed".
- **name** (string) - Filename of the output asset
- **format** (string) - Format of the output file
- **link** (string) - Presigned download URL. Expires after one hour — re-fetch the Task for a fresh link.
#### Response Example
{
"id": "task_abc123",
"createdAt": "2023-10-27T10:00:00Z",
"completedAt": "2023-10-27T10:05:00Z",
"clientId": "client_xyz789",
"cost": 10,
"assetId": "asset_def456",
"url": null,
"metadata": "User provided metadata",
"targets": [
{
"id": "target_ghi789",
"model": "vocals",
"status": "completed",
"formats": ["wav", "mp3"],
"output": [
{
"name": "vocals.wav",
"format": "wav",
"link": "https://api.audioshake.ai/download/vocals.wav?token=..."
},
{
"name": "vocals.mp3",
"format": "mp3",
"link": "https://api.audioshake.ai/download/vocals.mp3?token=..."
}
]
}
]
}
```
--------------------------------
### Get Stem Name from AudioShakeSeparator
Source: https://developer.audioshake.ai/sdk/api-reference
Retrieves the name of a specific audio stem by its index.
```cpp
const char* getStemName(unsigned char stemIndex);
```
--------------------------------
### Get SourceSeparationTask Progress
Source: https://developer.audioshake.ai/sdk/api-reference
Returns the current progress of the separation task as a value between 0.0 and 1.0.
```cpp
double getProgress(); // 0.0–1.0
```
--------------------------------
### Initialize RingBufferInput
Source: https://developer.audioshake.ai/sdk/api-reference
Constructs a RingBufferInput for streaming audio frames from a ring buffer. Configurable for size, stereo/mono, and sample rate.
```cpp
RingBufferInput(size_t size, bool isStereoInterleaved, int sampleRate);
```
--------------------------------
### Get Number of Stems from AudioShakeSeparator
Source: https://developer.audioshake.ai/sdk/api-reference
Returns the number of audio stems the separator is configured to output.
```cpp
unsigned char getNumberOfStems();
```
--------------------------------
### Get SourceSeparationTask Error Message
Source: https://developer.audioshake.ai/sdk/api-reference
Retrieves the error message if the separation task failed. Returns NULL on success.
```cpp
const char* getErrorMessage(); // NULL on success
```
--------------------------------
### Make First API Call to Separate Track
Source: https://developer.audioshake.ai/
Use this cURL command to make your first API call to separate a track into vocals and instrumental components. Ensure you replace 'your_api_key' with your actual API key.
```bash
curl -X POST "https://api.audioshake.ai/tasks" \
-H "Content-Type: application/json" \
-H "x-api-key: your_api_key" \
-d '{
"url": "https://demos.audioshake.ai/demo-assets/shakeitup.mp3",
"targets": [
{ "model": "vocals", "formats": ["wav"] },
{ "model": "instrumental", "formats": ["wav"] }
]
}'
```
--------------------------------
### Initialize RingBufferOutput
Source: https://developer.audioshake.ai/sdk/api-reference
Constructs a RingBufferOutput to expose separated audio stems via a ring buffer. Configurable for size and stereo/mono format.
```cpp
RingBufferOutput(size_t size, bool isStereoInterleaved);
```
--------------------------------
### Get Task by ID
Source: https://developer.audioshake.ai/api-reference/tasks/get
Retrieves a single task by its ID. This is useful for checking the status of a task and obtaining links to download its output.
```APIDOC
## Get Task by ID
### Description
Fetch a single Task by its `id`. Use this to check target status and retrieve output download links.
### Method
GET
### Endpoint
`/tasks/{id}`
### Parameters
#### Path Parameters
- **id** (string) - Required - The unique identifier of the task.
```
--------------------------------
### Upload File and Create Task (JavaScript)
Source: https://developer.audioshake.ai/upload-file
This JavaScript code snippet shows how to upload a local file and create a task using the Fetch API. It requires a `fileBlob` to be defined in your environment. Replace 'your_api_key' with your actual API key.
```javascript
const API_KEY = "your_api_key";
// 1. Upload the file
const formData = new FormData();
formData.append("file", fileBlob, "song.mp3");
const uploadRes = await fetch("https://api.audioshake.ai/assets", {
method: "POST",
headers: { "x-api-key": API_KEY },
body: formData
});
const { id: assetId } = await uploadRes.json();
console.log(`Asset created: ${assetId}`);
// 2. Create a Task using the assetId
const taskRes = await fetch("https://api.audioshake.ai/tasks", {
method: "POST",
headers: {
"Content-Type": "application/json",
"x-api-key": API_KEY
},
body: JSON.stringify({
assetId,
targets: [
{ model: "vocals", formats: ["wav"] },
{ model: "instrumental", formats: ["wav"] }
]
})
});
const { id: taskId } = await taskRes.json();
console.log(`Task created: ${taskId}`);
```
--------------------------------
### Create a Task
Source: https://developer.audioshake.ai/music-removal
Initiates a music removal task by specifying the asset ID and desired output format. The response includes a task ID to monitor progress.
```APIDOC
## Create a Task
### Description
Initiates a music removal task by specifying the asset ID and desired output format. The response includes a task ID to monitor progress.
### Method
POST
### Endpoint
https://api.audioshake.ai/tasks
### Request Body
- **assetId** (string) - Required - The ID of the asset to process.
- **targets** (array) - Required - A list of processing targets.
- **model** (string) - Required - The model to use, e.g., "music_removal".
- **formats** (array) - Required - A list of desired output formats, e.g., ["wav"].
### Request Example
```json
{
"assetId": "your_asset_id",
"targets": [
{
"model": "music_removal",
"formats": ["wav"]
}
]
}
```
### Response
#### Success Response (200)
- **id** (string) - The ID of the created task.
#### Response Example
```json
{
"id": "task_id"
}
```
```
--------------------------------
### Get Task Statistics
Source: https://developer.audioshake.ai/api-reference/tasks/statistics
Retrieve aggregate statistics for your account's Task usage. Pass `name=usage` for a monthly breakdown or `name=distribution` for per-model usage.
```APIDOC
## GET /tasks/statistics
### Description
Retrieve aggregate statistics for your account's Task usage. Pass `name=usage` for a monthly breakdown or `name=distribution` for per-model usage.
### Method
GET
### Endpoint
/tasks/statistics
### Parameters
#### Query Parameters
- **name** (string) - Required - Type of statistics to retrieve. Enum: `usage`, `distribution`. Default: `usage`.
### Response
#### Success Response (200)
- **Usage** (array) - Monthly usage breakdown. Returned when name=usage.
- **month** (string) - Month in YYYY-MM format
- **totalTargets** (number) - Total number of targets processed
- **totalMinutes** (string) - Total minutes of audio processed
- **Distribution** (array) - Model usage distribution. Returned when name=distribution.
- **model** (string) - Model name
- **count** (number) - Number of times the model was used
- **percentage** (string) - Percentage of total usage
```
--------------------------------
### File-based Stem Separation with AudioShake SDK
Source: https://developer.audioshake.ai/sdk/quickstart
Use `SourceSeparationTask` for file-to-file processing. Ensure you have a Client ID, Client Secret, and a `.crypt` model file. The `run` method accepts an optional progress callback.
```cpp
#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());
}
```
--------------------------------
### Music Detection Output Format
Source: https://developer.audioshake.ai/detect-music-in-content
The output is a JSON array detailing segments where music is detected. Each segment includes start and end times in seconds, and a confidence score.
```json
[
{
"start_time": 20.0,
"end_time": 30.0,
"confidence": 0.18
},
{
"start_time": 40.0,
"end_time": 60.0,
"confidence": 0.32
}
]
```
--------------------------------
### Create a Job Request
Source: https://developer.audioshake.ai/legacy-api
Create a job to process an asset with a specified model and output format. The callbackUrl is optional for receiving webhooks upon completion.
```bash
curl -X POST "https://groovy.audioshake.ai/job" \
-H "Authorization: Bearer YOUR_API_TOKEN" \
-H "Content-Type: application/json" \
-H "Accept: application/json" \
-d '{
"metadata": {
"format": "wav",
"name": "vocals"
},
"assetId": "clyxaywtp00ne0jpi4nf435dv",
"callbackUrl": "https://your-app.com/webhooks"
}'
```
--------------------------------
### Get Audio Output Configuration from AudioShakeSeparator
Source: https://developer.audioshake.ai/sdk/api-reference
Retrieves the number of channels per output stem, the output sample rate, and the number of frames required per processing call.
```cpp
unsigned int getNumberOfChannels(); // Channels per output stem
unsigned int getOutputSamplerate(); // May differ from input
unsigned int getFramesNeeded(); // Frames required per process() call
```
--------------------------------
### Include and Initialize Lyrics Editor Widget
Source: https://developer.audioshake.ai/tools/lyrics-editor
Include the widget library script and initialize the LyricsWidget with your license ID, a custom session identifier, and the iframe element ID. Optional parameters for max requests and timing mode can also be provided.
```html
```
```javascript
document.addEventListener("DOMContentLoaded", () => {
const lyricsWidget = new AudioShakeLyricsWidgetLib.LyricsWidget(
"your_license_id", // 25-character license ID
"your_session_id", // Custom session identifier
"lyricsWidget", // iframe element ID
5, // Max requests per audio (optional, default: 5)
"word" // Timing mode: "line" or "word" (optional)
);
});
```
--------------------------------
### Create Task
Source: https://developer.audioshake.ai/api-reference/tasks/create
Submit a media source and up to 20 model targets for processing. Each target specifies a model and output format. Provide exactly one source—either a public `url` or an `assetId` from a previous upload.
```APIDOC
## Create Task
### Description
Submit a media source and up to 20 model targets for processing. Each target specifies a model and output format. Provide exactly one source—either a public `url` or an `assetId` from a previous upload.
### Method
POST
### Endpoint
/tasks
### Request Body
- **source** (object) - Required - An object containing either a `url` or an `assetId`.
- **url** (string) - Required if `assetId` is not provided - The public URL of the media source.
- **assetId** (string) - Required if `url` is not provided - The ID of a previously uploaded asset.
- **targets** (array) - Required - An array of target processing configurations. Maximum 20 targets.
- **model** (string) - Required - The name of the model to use for processing (e.g., "vocals", "instrumental", "transcription").
- **formats** (array) - Required - An array of desired output formats (e.g., ["wav"], ["json"]).
### Request Example
```json
{
"assetId": "your_asset_id",
"targets": [
{ "model": "vocals", "formats": ["wav"] },
{ "model": "instrumental", "formats": ["wav"] }
]
}
```
### Response
#### Success Response (201 Created)
- **id** (string) - The unique identifier for the created task.
- **status** (string) - The initial status of the task (e.g., "processing").
- **targets** (array) - An array of target objects, each with an initial status.
#### Response Example
```json
{
"id": "task_12345abcde",
"status": "processing",
"targets": [
{ "model": "vocals", "formats": ["wav"], "status": "processing" },
{ "model": "instrumental", "formats": ["wav"], "status": "processing" }
]
}
```
```
--------------------------------
### Upload a file
Source: https://developer.audioshake.ai/legacy-api
Before creating a job, upload your audio file to receive an asset ID.
```APIDOC
## Upload a file
Before creating a job, upload your audio file to receive an asset ID.
### Upload from disk
```bash
curl -X POST "https://groovy.audioshake.ai/upload" \
-H "Authorization: Bearer YOUR_API_TOKEN" \
-H "Content-Type: multipart/form-data" \
-H "Accept: application/json" \
-F 'file=@song.mp3;type=audio/mpeg'
```
### Upload from URL
```bash
curl -X POST "https://groovy.audioshake.ai/upload/link" \
-H "Authorization: Bearer YOUR_API_TOKEN" \
-H "Content-Type: application/json" \
-d '{
"link": "https://example.com/audio.mp3",
"name": "song"
}'
```
### Upload response
```json
{
"name": "song",
"id": "clyxaywtp00ne0jpi4nf435dv",
"fileType": "audio/mpeg",
"format": "mp3",
"link": "https://..."
}
```
Save the `id` — you will use it as `assetId` when creating a job.
```
--------------------------------
### AudioShakeSeparator Methods
Source: https://developer.audioshake.ai/sdk/api-reference
Provides methods to retrieve initialization status, backend information, SDK version, and details about the separated stems.
```APIDOC
## AudioShakeSeparator Methods
### Description
Provides methods to retrieve initialization status, backend information, SDK version, and details about the separated stems.
### Methods
- **getInitializationError()** (const char*) - Returns NULL on success, or an error string on failure.
- **getBackendName()** (const char*) - Returns the active backend (e.g., "LiteRT GPU", "Metal", "CPU").
- **getVersion()** (const char*) - Returns the SDK and model version string.
- **getNumberOfStems()** (unsigned char) - Returns the number of separated stems.
- **getStemName(unsigned char stemIndex)** (const char*) - Returns the name of the stem at the specified index.
- **getNumberOfChannels()** (unsigned int) - Returns the number of channels per output stem.
- **getOutputSamplerate()** (unsigned int) - Returns the output sample rate, which may differ from the input.
- **getFramesNeeded()** (unsigned int) - Returns the number of frames required per `process()` call.
```
--------------------------------
### Music Identification Response Structure
Source: https://developer.audioshake.ai/music-identification
This JSON output details detected music events, including start and end times, detection confidence, and identification details if available. Identification fields are only present when music is successfully identified.
```json
{
"events": [
{
"start_time_s": 0.0,
"end_time_s": 10.0,
"music_detected": true,
"music_identified": false,
"detection_confidence": 0.70
},
{
"start_time_s": 12.0,
"end_time_s": 18.0,
"music_detected": true,
"music_identified": true,
"detection_confidence": 0.99,
"identification_confidence": 0.76,
"title": "Schön Rosmarin",
"artists": [
"Gil Shaham",
"Orpheus Chamber Orchestra"
],
"album": "Violin Romances",
"label": "Deutsche Grammophon",
"release_date": "1996-09-02",
"isrc": "DEF059503430"
}
]
}
```
--------------------------------
### List All Assets
Source: https://developer.audioshake.ai/api-reference/assets/list
Retrieve a paginated list of all Assets in your account. You can control the pagination using the `skip` and `take` query parameters.
```APIDOC
## GET /assets
### Description
Retrieve a paginated list of all Assets in your account.
### Method
GET
### Endpoint
/assets
### Parameters
#### Query Parameters
- **skip** (number) - Optional - Number of records to skip for pagination. Defaults to 0.
- **take** (number) - Optional - Maximum number of records to return per page. Defaults to 10. Minimum is 1 and maximum is 100.
### Response
#### Success Response (200)
- **id** (string) - Unique identifier of the Asset. Use this id as assetId when creating a Task.
- **format** (string) - Format of the output file.
- **name** (string) - Name of the Asset.
#### Response Example
{
"example": "[\n {\n \"id\": \"asset_123\",\n \"format\": \"mp3\",\n \"name\": \"My Audio File\"\n }\n]"
}
```
--------------------------------
### Create a task with a local file using JSON
Source: https://developer.audioshake.ai/quickstart
This JSON object shows how to create a task using a local file. You need to first upload the file using the 'Upload File' endpoint and use the returned 'assetId'.
```json
{
"assetId": "your_asset_id",
"targets": [
{ "model": "vocals", "formats": ["wav"] },
{ "model": "instrumental", "formats": ["wav"] }
]
}
```
--------------------------------
### AudioShakeSeparator Constructor
Source: https://developer.audioshake.ai/sdk/api-reference
Initializes the AudioShakeSeparator with client credentials, model data, and audio processing parameters. Multiple instances can run in parallel, each in a single thread.
```APIDOC
## AudioShakeSeparator Constructor
### Description
Initializes the AudioShakeSeparator with client credentials, model data, and audio processing parameters. Multiple instances can run in parallel, each in a single thread.
### Parameters
#### Path Parameters
- **clientID** (const char*) - Your AudioShake Client ID
- **clientSecret** (const char*) - Your AudioShake Client Secret
- **model** (void*) - Pointer to the encrypted model data loaded into memory
- **modelSizeBytes** (unsigned int) - Size of the model data in bytes
- **inputSamplerate** (unsigned int) - Sample rate of input audio in Hz (e.g. `44100`, `48000`). Automatically resampled to match output.
- **flags** (unsigned int) - Configuration flags — see [Flags](#flags)
```
--------------------------------
### Compare Job Submission: Legacy vs. Tasks API
Source: https://developer.audioshake.ai/migrating-from-jobs
Demonstrates submitting multiple processing requests. The legacy API requires separate jobs for each model, while the Tasks API allows specifying multiple targets in a single task.
```bash
# Job 1: vocals
curl -X POST "https://groovy.audioshake.ai/job" \
-H "Authorization: Bearer YOUR_API_TOKEN" \
-d '{ "metadata": { "name": "vocals", "format": "wav" }, "assetId": "" }'
# Job 2: instrumental
curl -X POST "https://groovy. Audioshake.ai/job" \
-H "Authorization: Bearer YOUR_API_TOKEN" \
-d '{ "metadata": { "name": "instrumental", "format": "wav" }, "assetId": "" }'
# Job 3: drums
curl -X POST "https://groovy.audioshake.ai/job" \
-H "Authorization: Bearer YOUR_API_TOKEN" \
-d '{ "metadata": { "name": "drums", "format": "wav" }, "assetId": "" }'
```
```bash
curl -X POST "https://api.audioshake.ai/tasks" \
-H "x-api-key: $AUDIOSHAKE_API_KEY" \
-H "Content-Type: application/json" \
-d '{
"assetId": "",
"targets": [
{ "model": "vocals", "formats": ["wav"] },
{ "model": "instrumental", "formats": ["wav"] },
{ "model": "drums", "formats": ["wav"] }
]
}'
```
--------------------------------
### Create Music Detection Task
Source: https://developer.audioshake.ai/detect-music-in-content
Use this code to create a task for music detection. Replace 'your_api_key' and 'your_asset_id' with your actual credentials and asset identifier. The task will output results in JSON format.
```python
import requests
API_KEY = "your_api_key"
HEADERS = {"Content-Type": "application/json", "x-api-key": API_KEY}
response = requests.post(
"https://api.audioshake.ai/tasks",
headers=HEADERS,
json={
"assetId": "your_asset_id",
"targets": [
{"model": "music_detection", "formats": ["json"]}
]
}
)
task_id = response.json()["id"]
print(f"Task created: {task_id}")
```
```javascript
const API_KEY = "your_api_key";
const headers = { "Content-Type": "application/json", "x-api-key": API_KEY };
const createRes = await fetch("https://api.audioshake.ai/tasks", {
method: "POST",
headers,
body: JSON.stringify({
assetId: "your_asset_id",
targets: [
{ model: "music_detection", formats: ["json"] }
]
})
});
const { id: taskId } = await createRes.json();
console.log(`Task created: ${taskId}`);
```
```bash
curl -X POST "https://api.audioshake.ai/tasks" \
-H "Content-Type: application/json" \
-H "x-api-key: $AUDIOSHAKE_API_KEY" \
-d '{
"assetId": "your_asset_id",
"targets": [
{ "model": "music_detection", "formats": ["json"] }
]
}'
```
--------------------------------
### Create a Task
Source: https://developer.audioshake.ai/speech-denoising
Initiates a speech denoising task by sending a POST request to the /tasks endpoint. This task processes an asset and applies the 'speech_clarity' model, outputting in 'wav' format. The response includes a task ID that can be used to monitor progress.
```APIDOC
## Create a Task
### Description
Initiates a speech denoising task by sending a POST request to the /tasks endpoint. This task processes an asset and applies the 'speech_clarity' model, outputting in 'wav' format. The response includes a task ID that can be used to monitor progress.
### Method
POST
### Endpoint
https://api.audioshake.ai/tasks
### Parameters
#### Request Body
- **assetId** (string) - Required - The ID of the asset to process.
- **targets** (array) - Required - A list of targets to process.
- **model** (string) - Required - The model to use for processing (e.g., "speech_clarity").
- **formats** (array) - Required - The desired output formats (e.g., ["wav"]).
### Request Example
```json
{
"assetId": "your_asset_id",
"targets": [
{
"model": "speech_clarity",
"formats": ["wav"]
}
]
}
```
### Response
#### Success Response (200)
- **id** (string) - The ID of the created task.
### Response Example
```json
{
"id": "task_id"
}
```
```