2026-06-17 11:11:37 +08:00
|
|
|
---
|
|
|
|
|
description: Split audio by time intervals, equal parts, or silence detection.
|
|
|
|
|
---
|
|
|
|
|
|
2026-07-11 13:01:55 +08:00
|
|
|
# Split Audio {#split-audio}
|
2026-06-17 11:11:37 +08:00
|
|
|
|
|
|
|
|
Split an audio file into segments by fixed time intervals, equal parts, or automatic silence detection. Returns a ZIP archive of the segments.
|
|
|
|
|
|
2026-07-11 13:01:55 +08:00
|
|
|
## API Endpoint {#api-endpoint}
|
2026-06-17 11:11:37 +08:00
|
|
|
|
2026-06-21 00:12:59 +08:00
|
|
|
`POST /api/v1/tools/audio/split-audio`
|
2026-06-17 11:11:37 +08:00
|
|
|
|
|
|
|
|
Accepts multipart form data with an audio file and a JSON `settings` field.
|
|
|
|
|
|
2026-07-11 13:01:55 +08:00
|
|
|
## Parameters {#parameters}
|
2026-06-17 11:11:37 +08:00
|
|
|
|
|
|
|
|
| Parameter | Type | Required | Default | Description |
|
|
|
|
|
|-----------|------|----------|---------|-------------|
|
|
|
|
|
| mode | string | No | `"time"` | Split strategy: `time`, `parts`, `silence` |
|
|
|
|
|
| segmentS | number | No | `60` | Segment length in seconds, 1 to 3600 (used when mode is `time`) |
|
|
|
|
|
| parts | integer | No | `2` | Number of equal parts, 2 to 20 (used when mode is `parts`) |
|
|
|
|
|
| thresholdDb | number | No | `-40` | Silence threshold in dB, -80 to -20 (used when mode is `silence`) |
|
|
|
|
|
| minSilenceS | number | No | `0.3` | Minimum silence gap in seconds, 0.1 to 10 (used when mode is `silence`) |
|
|
|
|
|
|
2026-07-11 13:01:55 +08:00
|
|
|
## Example Request {#example-request}
|
2026-06-17 11:11:37 +08:00
|
|
|
|
|
|
|
|
Split into 30-second segments:
|
|
|
|
|
|
|
|
|
|
```bash
|
2026-06-21 00:12:59 +08:00
|
|
|
curl -X POST http://localhost:1349/api/v1/tools/audio/split-audio \
|
2026-06-17 11:11:37 +08:00
|
|
|
-H "Authorization: Bearer si_your-api-key" \
|
|
|
|
|
-F "file=@audio.mp3" \
|
|
|
|
|
-F 'settings={"mode": "time", "segmentS": 30}'
|
|
|
|
|
```
|
|
|
|
|
|
|
|
|
|
Split by silence detection:
|
|
|
|
|
|
|
|
|
|
```bash
|
2026-06-21 00:12:59 +08:00
|
|
|
curl -X POST http://localhost:1349/api/v1/tools/audio/split-audio \
|
2026-06-17 11:11:37 +08:00
|
|
|
-H "Authorization: Bearer si_your-api-key" \
|
|
|
|
|
-F "file=@audio.mp3" \
|
|
|
|
|
-F 'settings={"mode": "silence", "thresholdDb": -35, "minSilenceS": 0.5}'
|
|
|
|
|
```
|
|
|
|
|
|
2026-07-11 13:01:55 +08:00
|
|
|
## Example Response {#example-response}
|
2026-06-17 11:11:37 +08:00
|
|
|
|
|
|
|
|
```json
|
|
|
|
|
{
|
|
|
|
|
"jobId": "a1b2c3d4-e5f6-7890-abcd-ef1234567890",
|
2026-06-17 17:13:31 +08:00
|
|
|
"downloadUrl": "/api/v1/download/a1b2c3d4-e5f6-7890-abcd-ef1234567890/audio_parts.zip",
|
2026-06-17 11:11:37 +08:00
|
|
|
"originalSize": 4500000,
|
|
|
|
|
"processedSize": 4600000
|
|
|
|
|
}
|
|
|
|
|
```
|
|
|
|
|
|
2026-07-11 13:01:55 +08:00
|
|
|
## Notes {#notes}
|
2026-06-17 11:11:37 +08:00
|
|
|
|
|
|
|
|
- The `downloadUrl` points to a ZIP archive containing all segments.
|
|
|
|
|
- Only the parameters relevant to the chosen `mode` are used; others are ignored.
|
2026-06-17 17:13:31 +08:00
|
|
|
- Segment filenames are numbered sequentially (e.g. `part-000.mp3`, `part-001.mp3`).
|
2026-06-17 11:11:37 +08:00
|
|
|
- Output format matches the input format.
|