audial-sdk 1.0.0__tar.gz
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.
- audial_sdk-1.0.0/API_DOCUMENTATION.md +731 -0
- audial_sdk-1.0.0/LICENSE +21 -0
- audial_sdk-1.0.0/MANIFEST.in +6 -0
- audial_sdk-1.0.0/PKG-INFO +430 -0
- audial_sdk-1.0.0/README.md +384 -0
- audial_sdk-1.0.0/audial/__init__.py +32 -0
- audial_sdk-1.0.0/audial/api/__init__.py +15 -0
- audial_sdk-1.0.0/audial/api/auth.py +117 -0
- audial_sdk-1.0.0/audial/api/constants.py +59 -0
- audial_sdk-1.0.0/audial/api/exceptions.py +18 -0
- audial_sdk-1.0.0/audial/api/proxy.py +872 -0
- audial_sdk-1.0.0/audial/cli/__init__.py +7 -0
- audial_sdk-1.0.0/audial/cli/commands.py +392 -0
- audial_sdk-1.0.0/audial/functions/__init__.py +19 -0
- audial_sdk-1.0.0/audial/functions/analyze.py +147 -0
- audial_sdk-1.0.0/audial/functions/master.py +276 -0
- audial_sdk-1.0.0/audial/functions/midi.py +285 -0
- audial_sdk-1.0.0/audial/functions/samples.py +498 -0
- audial_sdk-1.0.0/audial/functions/segment.py +409 -0
- audial_sdk-1.0.0/audial/functions/stem_split.py +329 -0
- audial_sdk-1.0.0/audial/utils/__init__.py +20 -0
- audial_sdk-1.0.0/audial/utils/config.py +156 -0
- audial_sdk-1.0.0/audial/utils/file_utils.py +88 -0
- audial_sdk-1.0.0/audial/utils/results_manager.py +116 -0
- audial_sdk-1.0.0/audial_sdk.egg-info/PKG-INFO +430 -0
- audial_sdk-1.0.0/audial_sdk.egg-info/SOURCES.txt +31 -0
- audial_sdk-1.0.0/audial_sdk.egg-info/dependency_links.txt +1 -0
- audial_sdk-1.0.0/audial_sdk.egg-info/entry_points.txt +2 -0
- audial_sdk-1.0.0/audial_sdk.egg-info/requires.txt +12 -0
- audial_sdk-1.0.0/audial_sdk.egg-info/top_level.txt +1 -0
- audial_sdk-1.0.0/requirements.txt +15 -0
- audial_sdk-1.0.0/setup.cfg +4 -0
- audial_sdk-1.0.0/setup.py +44 -0
|
@@ -0,0 +1,731 @@
|
|
|
1
|
+
# Audial SDK API Documentation
|
|
2
|
+
|
|
3
|
+
This document provides comprehensive documentation for the Audial SDK, including detailed information about all functions, parameters, return values, and examples for both the Python API and Command Line Interface (CLI).
|
|
4
|
+
|
|
5
|
+
## Table of Contents
|
|
6
|
+
|
|
7
|
+
- [Python API](#python-api)
|
|
8
|
+
- [Configuration](#configuration)
|
|
9
|
+
- [Stem Splitting](#stem-splitting)
|
|
10
|
+
- [Audio Analysis](#audio-analysis)
|
|
11
|
+
- [Audio Segmentation](#audio-segmentation)
|
|
12
|
+
- [Audio Mastering](#audio-mastering)
|
|
13
|
+
- [Sample Pack Generation](#sample-pack-generation)
|
|
14
|
+
- [MIDI Generation](#midi-generation)
|
|
15
|
+
- [Error Handling](#error-handling)
|
|
16
|
+
- [Command Line Interface](#command-line-interface)
|
|
17
|
+
- [Configuration Commands](#configuration-commands)
|
|
18
|
+
- [Stem Splitting Commands](#stem-splitting-commands)
|
|
19
|
+
- [Audio Analysis Commands](#audio-analysis-commands)
|
|
20
|
+
- [Audio Segmentation Commands](#audio-segmentation-commands)
|
|
21
|
+
- [Audio Mastering Commands](#audio-mastering-commands)
|
|
22
|
+
- [Sample Pack Generation Commands](#sample-pack-generation-commands)
|
|
23
|
+
- [MIDI Generation Commands](#midi-generation-commands)
|
|
24
|
+
- [Result Data Structure](#result-data-structure)
|
|
25
|
+
|
|
26
|
+
## Python API
|
|
27
|
+
|
|
28
|
+
### Configuration
|
|
29
|
+
|
|
30
|
+
#### Setting API Key and User ID
|
|
31
|
+
|
|
32
|
+
```python
|
|
33
|
+
import audial
|
|
34
|
+
|
|
35
|
+
# Set API key
|
|
36
|
+
audial.config.set_api_key("your_api_key_here")
|
|
37
|
+
|
|
38
|
+
# Set User ID
|
|
39
|
+
audial.config.set_user_id("your_user_id_here")
|
|
40
|
+
|
|
41
|
+
# Get current API key and User ID
|
|
42
|
+
api_key = audial.config.get_api_key()
|
|
43
|
+
user_id = audial.config.get_user_id()
|
|
44
|
+
```
|
|
45
|
+
|
|
46
|
+
#### Setting Results Folder
|
|
47
|
+
|
|
48
|
+
```python
|
|
49
|
+
# Set custom results folder
|
|
50
|
+
audial.config.set_results_folder("path/to/custom/folder")
|
|
51
|
+
|
|
52
|
+
# Get current results folder
|
|
53
|
+
results_folder = audial.config.get_results_folder()
|
|
54
|
+
```
|
|
55
|
+
|
|
56
|
+
### Stem Splitting
|
|
57
|
+
|
|
58
|
+
Split an audio track into its component parts.
|
|
59
|
+
|
|
60
|
+
#### Function Signature
|
|
61
|
+
|
|
62
|
+
```python
|
|
63
|
+
audial.stem_split(
|
|
64
|
+
file_path: str,
|
|
65
|
+
stems: Optional[List[str]] = None,
|
|
66
|
+
target_bpm: Optional[float] = None,
|
|
67
|
+
target_key: Optional[str] = None,
|
|
68
|
+
results_folder: Optional[str] = None,
|
|
69
|
+
api_key: Optional[str] = None,
|
|
70
|
+
algorithm: str = "primaudio"
|
|
71
|
+
) -> Dict[str, Any]
|
|
72
|
+
```
|
|
73
|
+
|
|
74
|
+
#### Parameters
|
|
75
|
+
|
|
76
|
+
| Parameter | Type | Required | Default | Description |
|
|
77
|
+
|-----------|------|----------|---------|-------------|
|
|
78
|
+
| `file_path` | str | Yes | - | Path to the audio file to process |
|
|
79
|
+
| `stems` | List[str] | No | `["vocals", "drums", "bass", "other"]` | List of stems to extract |
|
|
80
|
+
| `target_bpm` | float | No | `None` | Target BPM for tempo adjustment |
|
|
81
|
+
| `target_key` | str | No | `None` | Target key for pitch adjustment (e.g., "Cmaj", "Dmin") |
|
|
82
|
+
| `results_folder` | str | No | `None` | Folder to save results (uses default if `None`) |
|
|
83
|
+
| `api_key` | str | No | `None` | API key to use (uses default if `None`) |
|
|
84
|
+
| `algorithm` | str | No | `"primaudio"` | Algorithm to use (`"primaudio"` or `"quintessound"`) |
|
|
85
|
+
|
|
86
|
+
#### Available Stem Options
|
|
87
|
+
|
|
88
|
+
- `vocals` - Vocal track
|
|
89
|
+
- `drums` - Drum track
|
|
90
|
+
- `bass` - Bass track
|
|
91
|
+
- `other` - All other instruments
|
|
92
|
+
- `full_song_without_vocals` - Full mix minus vocals
|
|
93
|
+
- `full_song_without_drums` - Full mix minus drums
|
|
94
|
+
- `full_song_without_bass` - Full mix minus bass
|
|
95
|
+
- `full_song_without_other` - Full mix minus other instruments
|
|
96
|
+
|
|
97
|
+
#### Returns
|
|
98
|
+
|
|
99
|
+
A dictionary containing:
|
|
100
|
+
- `execution`: API response data
|
|
101
|
+
- `files`: Information about downloaded files
|
|
102
|
+
- `folder`: Path to the results folder
|
|
103
|
+
- `files`: Dictionary mapping filenames to local file paths
|
|
104
|
+
|
|
105
|
+
#### Example
|
|
106
|
+
|
|
107
|
+
```python
|
|
108
|
+
import audial
|
|
109
|
+
|
|
110
|
+
# Basic stem splitting
|
|
111
|
+
result = audial.stem_split("path/to/audio.mp3")
|
|
112
|
+
|
|
113
|
+
# Access the paths to the downloaded files
|
|
114
|
+
stems_folder = result["files"]["folder"]
|
|
115
|
+
vocals_path = result["files"]["files"]["vocals.mp3"]
|
|
116
|
+
drums_path = result["files"]["files"]["drums.mp3"]
|
|
117
|
+
bass_path = result["files"]["files"]["bass.mp3"]
|
|
118
|
+
other_path = result["files"]["files"]["other.mp3"]
|
|
119
|
+
|
|
120
|
+
# Advanced stem splitting with options
|
|
121
|
+
result = audial.stem_split(
|
|
122
|
+
"path/to/audio.mp3",
|
|
123
|
+
stems=["vocals", "drums", "full_song_without_vocals"],
|
|
124
|
+
target_bpm=120,
|
|
125
|
+
target_key="Cmaj",
|
|
126
|
+
algorithm="primaudio"
|
|
127
|
+
)
|
|
128
|
+
```
|
|
129
|
+
|
|
130
|
+
### Audio Analysis
|
|
131
|
+
|
|
132
|
+
Analyze an audio file to extract metadata like BPM, key, and other characteristics.
|
|
133
|
+
|
|
134
|
+
#### Function Signature
|
|
135
|
+
|
|
136
|
+
```python
|
|
137
|
+
audial.analyze(
|
|
138
|
+
file_path: str,
|
|
139
|
+
results_folder: Optional[str] = None,
|
|
140
|
+
api_key: Optional[str] = None
|
|
141
|
+
) -> Dict[str, Any]
|
|
142
|
+
```
|
|
143
|
+
|
|
144
|
+
#### Parameters
|
|
145
|
+
|
|
146
|
+
| Parameter | Type | Required | Default | Description |
|
|
147
|
+
|-----------|------|----------|---------|-------------|
|
|
148
|
+
| `file_path` | str | Yes | - | Path to the audio file to analyze |
|
|
149
|
+
| `results_folder` | str | No | `None` | Folder to save results (uses default if `None`) |
|
|
150
|
+
| `api_key` | str | No | `None` | API key to use (uses default if `None`) |
|
|
151
|
+
|
|
152
|
+
#### Returns
|
|
153
|
+
|
|
154
|
+
A dictionary containing:
|
|
155
|
+
- `execution`: API response data
|
|
156
|
+
- `analysis`: Analysis results including BPM, key, and other metadata
|
|
157
|
+
- `files`: Information about downloaded files
|
|
158
|
+
- `folder`: Path to the results folder
|
|
159
|
+
- `files`: Dictionary mapping filenames to local file paths
|
|
160
|
+
|
|
161
|
+
#### Example
|
|
162
|
+
|
|
163
|
+
```python
|
|
164
|
+
import audial
|
|
165
|
+
|
|
166
|
+
# Analyze an audio file
|
|
167
|
+
analysis = audial.analyze("path/to/audio.mp3")
|
|
168
|
+
|
|
169
|
+
# Access analysis results
|
|
170
|
+
bpm = analysis["analysis"]["bpm"]
|
|
171
|
+
key = analysis["analysis"]["key"]
|
|
172
|
+
|
|
173
|
+
print(f"BPM: {bpm}")
|
|
174
|
+
print(f"Key: {key}")
|
|
175
|
+
```
|
|
176
|
+
|
|
177
|
+
### Audio Segmentation
|
|
178
|
+
|
|
179
|
+
Segment an audio track into logical sections and analyze its components.
|
|
180
|
+
|
|
181
|
+
#### Function Signature
|
|
182
|
+
|
|
183
|
+
```python
|
|
184
|
+
audial.segment(
|
|
185
|
+
file_path: str,
|
|
186
|
+
components: Optional[List[str]] = None,
|
|
187
|
+
analysis_type: Optional[str] = None,
|
|
188
|
+
features: Optional[List[str]] = None,
|
|
189
|
+
genre: Optional[str] = None,
|
|
190
|
+
results_folder: Optional[str] = None,
|
|
191
|
+
api_key: Optional[str] = None
|
|
192
|
+
) -> Dict[str, Any]
|
|
193
|
+
```
|
|
194
|
+
|
|
195
|
+
#### Parameters
|
|
196
|
+
|
|
197
|
+
| Parameter | Type | Required | Default | Description |
|
|
198
|
+
|-----------|------|----------|---------|-------------|
|
|
199
|
+
| `file_path` | str | Yes | - | Path to the audio file to segment |
|
|
200
|
+
| `components` | List[str] | No | `["bass", "beat", "melody", "vocal"]` | Components to segment |
|
|
201
|
+
| `analysis_type` | str | No | `"select_features"` | Type of analysis to perform |
|
|
202
|
+
| `features` | List[str] | No | `["mode", "energy", "loudness", "danceability", "tatum", "lyrics", "tags"]` | Features to extract |
|
|
203
|
+
| `genre` | str | No | `"Default"` | Genre of the track |
|
|
204
|
+
| `results_folder` | str | No | `None` | Folder to save results (uses default if `None`) |
|
|
205
|
+
| `api_key` | str | No | `None` | API key to use (uses default if `None`) |
|
|
206
|
+
|
|
207
|
+
#### Available Features
|
|
208
|
+
|
|
209
|
+
- `mode` - Musical mode
|
|
210
|
+
- `energy` - Energy level
|
|
211
|
+
- `loudness` - Loudness level
|
|
212
|
+
- `danceability` - Danceability rating
|
|
213
|
+
- `tatum` - Tatum features
|
|
214
|
+
- `lyrics` - Lyrics detection
|
|
215
|
+
- `key` - Musical key
|
|
216
|
+
- `tags` - Audio tags
|
|
217
|
+
|
|
218
|
+
#### Available Genres
|
|
219
|
+
|
|
220
|
+
`"Default"`, `"Afro House"`, `"Tech House"`, `"Bass House"`, `"Blues"`, `"Breakbeat"`, `"Classic Rock"`, `"Country"`, `"Deep House"`, `"Drum N Bass"`, `"Dubstep"`, `"Gospel"`, `"Grime140"`, `"House"`, `"Indie"`, `"Jazz"`, `"Latin"`, `"Metal"`, `"Minimal House"`, `"Pop"`, `"R&B"`, `"Rock"`, `"Techno"`, `"Trance"`, `"Trap"`, `"UK Garage"`
|
|
221
|
+
|
|
222
|
+
#### Returns
|
|
223
|
+
|
|
224
|
+
A dictionary containing:
|
|
225
|
+
- `execution`: API response data
|
|
226
|
+
- `segmentation`: Segmentation data (if available)
|
|
227
|
+
- `files`: Information about downloaded files
|
|
228
|
+
- `folder`: Path to the results folder
|
|
229
|
+
- `files`: Dictionary mapping filenames to local file paths
|
|
230
|
+
|
|
231
|
+
#### Example
|
|
232
|
+
|
|
233
|
+
```python
|
|
234
|
+
import audial
|
|
235
|
+
|
|
236
|
+
# Basic segmentation
|
|
237
|
+
segments = audial.segment("path/to/audio.mp3")
|
|
238
|
+
|
|
239
|
+
# Advanced segmentation with options
|
|
240
|
+
segments = audial.segment(
|
|
241
|
+
"path/to/audio.mp3",
|
|
242
|
+
components=["bass", "beat", "melody", "vocal"],
|
|
243
|
+
analysis_type="select_features",
|
|
244
|
+
features=["energy", "loudness", "danceability", "tatum"],
|
|
245
|
+
genre="Tech House"
|
|
246
|
+
)
|
|
247
|
+
|
|
248
|
+
# Access segmentation files
|
|
249
|
+
json_file = segments["files"]["files"].get("audio_segmentation.json")
|
|
250
|
+
```
|
|
251
|
+
|
|
252
|
+
### Audio Mastering
|
|
253
|
+
|
|
254
|
+
Apply professional mastering to an audio file.
|
|
255
|
+
|
|
256
|
+
#### Function Signature
|
|
257
|
+
|
|
258
|
+
```python
|
|
259
|
+
audial.master(
|
|
260
|
+
file_path: str,
|
|
261
|
+
reference_file: Optional[str] = None,
|
|
262
|
+
results_folder: Optional[str] = None,
|
|
263
|
+
api_key: Optional[str] = None
|
|
264
|
+
) -> Dict[str, Any]
|
|
265
|
+
```
|
|
266
|
+
|
|
267
|
+
#### Parameters
|
|
268
|
+
|
|
269
|
+
| Parameter | Type | Required | Default | Description |
|
|
270
|
+
|-----------|------|----------|---------|-------------|
|
|
271
|
+
| `file_path` | str | Yes | - | Path to the audio file to master |
|
|
272
|
+
| `reference_file` | str | No | `None` | Path to a reference file to match sound characteristics |
|
|
273
|
+
| `results_folder` | str | No | `None` | Folder to save results (uses default if `None`) |
|
|
274
|
+
| `api_key` | str | No | `None` | API key to use (uses default if `None`) |
|
|
275
|
+
|
|
276
|
+
#### Returns
|
|
277
|
+
|
|
278
|
+
A dictionary containing:
|
|
279
|
+
- `execution`: API response data
|
|
280
|
+
- `files`: Information about downloaded files
|
|
281
|
+
- `folder`: Path to the results folder
|
|
282
|
+
- `files`: Dictionary mapping filenames to local file paths
|
|
283
|
+
|
|
284
|
+
#### Example
|
|
285
|
+
|
|
286
|
+
```python
|
|
287
|
+
import audial
|
|
288
|
+
|
|
289
|
+
# Basic mastering
|
|
290
|
+
mastered = audial.master("path/to/audio.mp3")
|
|
291
|
+
|
|
292
|
+
# Mastering with reference track
|
|
293
|
+
mastered = audial.master(
|
|
294
|
+
"path/to/audio.mp3",
|
|
295
|
+
reference_file="path/to/reference.mp3"
|
|
296
|
+
)
|
|
297
|
+
|
|
298
|
+
# Get the path to the mastered file
|
|
299
|
+
master_file = next(iter(mastered["files"]["files"].values()))
|
|
300
|
+
```
|
|
301
|
+
|
|
302
|
+
### Sample Pack Generation
|
|
303
|
+
|
|
304
|
+
Generate a sample pack from an audio file.
|
|
305
|
+
|
|
306
|
+
#### Function Signature
|
|
307
|
+
|
|
308
|
+
```python
|
|
309
|
+
audial.generate_samples(
|
|
310
|
+
file_path: str,
|
|
311
|
+
job_type: Optional[str] = None,
|
|
312
|
+
components: Optional[List[str]] = None,
|
|
313
|
+
genre: Optional[str] = None,
|
|
314
|
+
results_folder: Optional[str] = None,
|
|
315
|
+
api_key: Optional[str] = None
|
|
316
|
+
) -> Dict[str, Any]
|
|
317
|
+
```
|
|
318
|
+
|
|
319
|
+
#### Parameters
|
|
320
|
+
|
|
321
|
+
| Parameter | Type | Required | Default | Description |
|
|
322
|
+
|-----------|------|----------|---------|-------------|
|
|
323
|
+
| `file_path` | str | Yes | - | Path to the audio file |
|
|
324
|
+
| `job_type` | str | No | `"sample_pack"` | Type of sample pack job to run |
|
|
325
|
+
| `components` | List[str] | No | `["drums", "bass", "melody"]` | Components to include in the sample pack |
|
|
326
|
+
| `genre` | str | No | `"Default"` | Genre of the track |
|
|
327
|
+
| `results_folder` | str | No | `None` | Folder to save results (uses default if `None`) |
|
|
328
|
+
| `api_key` | str | No | `None` | API key to use (uses default if `None`) |
|
|
329
|
+
|
|
330
|
+
#### Available Components
|
|
331
|
+
|
|
332
|
+
- `drums` - Drum samples
|
|
333
|
+
- `bass` - Bass samples
|
|
334
|
+
- `melody` - Melodic samples
|
|
335
|
+
|
|
336
|
+
#### Available Genres
|
|
337
|
+
|
|
338
|
+
Same as [Audio Segmentation](#audio-segmentation).
|
|
339
|
+
|
|
340
|
+
#### Returns
|
|
341
|
+
|
|
342
|
+
A dictionary containing:
|
|
343
|
+
- `execution`: API response data
|
|
344
|
+
- `files`: Information about downloaded files
|
|
345
|
+
- `folder`: Path to the results folder
|
|
346
|
+
- `files`: Dictionary mapping filenames to local file paths
|
|
347
|
+
|
|
348
|
+
#### Example
|
|
349
|
+
|
|
350
|
+
```python
|
|
351
|
+
import audial
|
|
352
|
+
|
|
353
|
+
# Basic sample pack generation
|
|
354
|
+
samples = audial.generate_samples("path/to/audio.mp3")
|
|
355
|
+
|
|
356
|
+
# Advanced sample pack generation with options
|
|
357
|
+
samples = audial.generate_samples(
|
|
358
|
+
"path/to/audio.mp3",
|
|
359
|
+
job_type="sample_pack",
|
|
360
|
+
components=["drums", "bass", "melody"],
|
|
361
|
+
genre="Tech House"
|
|
362
|
+
)
|
|
363
|
+
|
|
364
|
+
# Access the sample pack folder
|
|
365
|
+
samples_folder = samples["files"]["folder"]
|
|
366
|
+
|
|
367
|
+
# List all downloaded samples
|
|
368
|
+
for sample_name, sample_path in samples["files"]["files"].items():
|
|
369
|
+
print(f"{sample_name}: {sample_path}")
|
|
370
|
+
```
|
|
371
|
+
|
|
372
|
+
### MIDI Generation
|
|
373
|
+
|
|
374
|
+
Convert audio to MIDI data.
|
|
375
|
+
|
|
376
|
+
#### Function Signature
|
|
377
|
+
|
|
378
|
+
```python
|
|
379
|
+
audial.generate_midi(
|
|
380
|
+
file_path: Union[str, List[str]],
|
|
381
|
+
bpm: Optional[float] = None,
|
|
382
|
+
results_folder: Optional[str] = None,
|
|
383
|
+
api_key: Optional[str] = None
|
|
384
|
+
) -> Dict[str, Any]
|
|
385
|
+
```
|
|
386
|
+
|
|
387
|
+
#### Parameters
|
|
388
|
+
|
|
389
|
+
| Parameter | Type | Required | Default | Description |
|
|
390
|
+
|-----------|------|----------|---------|-------------|
|
|
391
|
+
| `file_path` | str or List[str] | Yes | - | Path to one or more audio files |
|
|
392
|
+
| `bpm` | float | No | `None` | Override BPM for the MIDI generation |
|
|
393
|
+
| `results_folder` | str | No | `None` | Folder to save results (uses default if `None`) |
|
|
394
|
+
| `api_key` | str | No | `None` | API key to use (uses default if `None`) |
|
|
395
|
+
|
|
396
|
+
#### Returns
|
|
397
|
+
|
|
398
|
+
A dictionary containing:
|
|
399
|
+
- `execution`: API response data
|
|
400
|
+
- `files`: Information about downloaded files
|
|
401
|
+
- `folder`: Path to the results folder
|
|
402
|
+
- `files`: Dictionary mapping filenames to local file paths
|
|
403
|
+
|
|
404
|
+
#### Example
|
|
405
|
+
|
|
406
|
+
```python
|
|
407
|
+
import audial
|
|
408
|
+
|
|
409
|
+
# Generate MIDI from a single file
|
|
410
|
+
midi = audial.generate_midi("path/to/audio.mp3", bpm=120)
|
|
411
|
+
|
|
412
|
+
# Generate MIDI from multiple files
|
|
413
|
+
midi = audial.generate_midi(
|
|
414
|
+
["path/to/file1.mp3", "path/to/file2.mp3"],
|
|
415
|
+
bpm=140
|
|
416
|
+
)
|
|
417
|
+
|
|
418
|
+
# Access the MIDI files
|
|
419
|
+
for midi_file, file_path in midi["files"]["files"].items():
|
|
420
|
+
print(f"{midi_file}: {file_path}")
|
|
421
|
+
```
|
|
422
|
+
|
|
423
|
+
### Error Handling
|
|
424
|
+
|
|
425
|
+
The SDK provides custom exception classes for better error handling:
|
|
426
|
+
|
|
427
|
+
```python
|
|
428
|
+
from audial.api.exceptions import AudialError, AudialAuthError, AudialAPIError
|
|
429
|
+
|
|
430
|
+
try:
|
|
431
|
+
result = audial.stem_split("path/to/audio.mp3")
|
|
432
|
+
except AudialAuthError as e:
|
|
433
|
+
print(f"Authentication error: {e}")
|
|
434
|
+
# Handle authentication issues
|
|
435
|
+
except AudialAPIError as e:
|
|
436
|
+
print(f"API error: {e}")
|
|
437
|
+
# Handle API-specific issues
|
|
438
|
+
except AudialError as e:
|
|
439
|
+
print(f"General error: {e}")
|
|
440
|
+
# Handle other errors
|
|
441
|
+
```
|
|
442
|
+
|
|
443
|
+
## Command Line Interface
|
|
444
|
+
|
|
445
|
+
The Audial SDK provides a command-line interface for all its functions.
|
|
446
|
+
|
|
447
|
+
### Configuration Commands
|
|
448
|
+
|
|
449
|
+
#### Show Current Configuration
|
|
450
|
+
|
|
451
|
+
```bash
|
|
452
|
+
audial config show
|
|
453
|
+
```
|
|
454
|
+
|
|
455
|
+
#### Set API Key
|
|
456
|
+
|
|
457
|
+
```bash
|
|
458
|
+
audial config --api-key your_api_key_here
|
|
459
|
+
```
|
|
460
|
+
|
|
461
|
+
#### Set User ID
|
|
462
|
+
|
|
463
|
+
```bash
|
|
464
|
+
audial config --user-id your_user_id_here
|
|
465
|
+
```
|
|
466
|
+
|
|
467
|
+
#### Set Results Folder
|
|
468
|
+
|
|
469
|
+
```bash
|
|
470
|
+
audial config --results-folder path/to/results/folder
|
|
471
|
+
```
|
|
472
|
+
|
|
473
|
+
### Stem Splitting Commands
|
|
474
|
+
|
|
475
|
+
#### Basic Stem Splitting
|
|
476
|
+
|
|
477
|
+
```bash
|
|
478
|
+
audial stem-split path/to/audio.mp3
|
|
479
|
+
```
|
|
480
|
+
|
|
481
|
+
#### Custom Stems
|
|
482
|
+
|
|
483
|
+
```bash
|
|
484
|
+
audial stem-split path/to/audio.mp3 --stems vocals,drums,bass,other
|
|
485
|
+
```
|
|
486
|
+
|
|
487
|
+
#### Full Song Without Specific Stems
|
|
488
|
+
|
|
489
|
+
```bash
|
|
490
|
+
audial stem-split path/to/audio.mp3 --stems full_song_without_vocals,full_song_without_drums
|
|
491
|
+
```
|
|
492
|
+
|
|
493
|
+
#### Tempo Adjustment
|
|
494
|
+
|
|
495
|
+
```bash
|
|
496
|
+
audial stem-split path/to/audio.mp3 --target-bpm 120
|
|
497
|
+
```
|
|
498
|
+
|
|
499
|
+
#### Key Adjustment
|
|
500
|
+
|
|
501
|
+
```bash
|
|
502
|
+
audial stem-split path/to/audio.mp3 --target-key Cmaj
|
|
503
|
+
```
|
|
504
|
+
|
|
505
|
+
#### Algorithm Selection
|
|
506
|
+
|
|
507
|
+
```bash
|
|
508
|
+
audial stem-split path/to/audio.mp3 --algorithm primaudio
|
|
509
|
+
```
|
|
510
|
+
|
|
511
|
+
```bash
|
|
512
|
+
audial stem-split path/to/audio.mp3 --algorithm quintessound
|
|
513
|
+
```
|
|
514
|
+
|
|
515
|
+
#### Custom Results Folder
|
|
516
|
+
|
|
517
|
+
```bash
|
|
518
|
+
audial stem-split path/to/audio.mp3 --results-folder path/to/custom/folder
|
|
519
|
+
```
|
|
520
|
+
|
|
521
|
+
#### Custom API Key
|
|
522
|
+
|
|
523
|
+
```bash
|
|
524
|
+
audial stem-split path/to/audio.mp3 --api-key your_custom_api_key
|
|
525
|
+
```
|
|
526
|
+
|
|
527
|
+
### Audio Analysis Commands
|
|
528
|
+
|
|
529
|
+
#### Basic Analysis
|
|
530
|
+
|
|
531
|
+
```bash
|
|
532
|
+
audial analyze path/to/audio.mp3
|
|
533
|
+
```
|
|
534
|
+
|
|
535
|
+
#### Custom Results Folder
|
|
536
|
+
|
|
537
|
+
```bash
|
|
538
|
+
audial analyze path/to/audio.mp3 --results-folder path/to/custom/folder
|
|
539
|
+
```
|
|
540
|
+
|
|
541
|
+
#### Custom API Key
|
|
542
|
+
|
|
543
|
+
```bash
|
|
544
|
+
audial analyze path/to/audio.mp3 --api-key your_custom_api_key
|
|
545
|
+
```
|
|
546
|
+
|
|
547
|
+
### Audio Segmentation Commands
|
|
548
|
+
|
|
549
|
+
#### Basic Segmentation
|
|
550
|
+
|
|
551
|
+
```bash
|
|
552
|
+
audial segment path/to/audio.mp3
|
|
553
|
+
```
|
|
554
|
+
|
|
555
|
+
#### Custom Features
|
|
556
|
+
|
|
557
|
+
```bash
|
|
558
|
+
audial segment path/to/audio.mp3 --features energy,loudness,danceability,tatum
|
|
559
|
+
```
|
|
560
|
+
|
|
561
|
+
#### Specific Genre
|
|
562
|
+
|
|
563
|
+
```bash
|
|
564
|
+
audial segment path/to/audio.mp3 --genre "Tech House"
|
|
565
|
+
```
|
|
566
|
+
|
|
567
|
+
#### Analysis Type
|
|
568
|
+
|
|
569
|
+
```bash
|
|
570
|
+
audial segment path/to/audio.mp3 --analysis-type select_features
|
|
571
|
+
```
|
|
572
|
+
|
|
573
|
+
#### Custom Results Folder
|
|
574
|
+
|
|
575
|
+
```bash
|
|
576
|
+
audial segment path/to/audio.mp3 --results-folder path/to/custom/folder
|
|
577
|
+
```
|
|
578
|
+
|
|
579
|
+
#### Custom API Key
|
|
580
|
+
|
|
581
|
+
```bash
|
|
582
|
+
audial segment path/to/audio.mp3 --api-key your_custom_api_key
|
|
583
|
+
```
|
|
584
|
+
|
|
585
|
+
### Audio Mastering Commands
|
|
586
|
+
|
|
587
|
+
#### Basic Mastering
|
|
588
|
+
|
|
589
|
+
```bash
|
|
590
|
+
audial master path/to/audio.mp3 --reference path/to/reference.mp3
|
|
591
|
+
```
|
|
592
|
+
|
|
593
|
+
Note: The reference file is required for the CLI interface.
|
|
594
|
+
|
|
595
|
+
#### Custom Results Folder
|
|
596
|
+
|
|
597
|
+
```bash
|
|
598
|
+
audial master path/to/audio.mp3 --reference path/to/reference.mp3 --results-folder path/to/custom/folder
|
|
599
|
+
```
|
|
600
|
+
|
|
601
|
+
#### Custom API Key
|
|
602
|
+
|
|
603
|
+
```bash
|
|
604
|
+
audial master path/to/audio.mp3 --reference path/to/reference.mp3 --api-key your_custom_api_key
|
|
605
|
+
```
|
|
606
|
+
|
|
607
|
+
### Sample Pack Generation Commands
|
|
608
|
+
|
|
609
|
+
#### Basic Sample Pack Generation
|
|
610
|
+
|
|
611
|
+
```bash
|
|
612
|
+
audial generate-samples path/to/audio.mp3
|
|
613
|
+
```
|
|
614
|
+
|
|
615
|
+
#### Custom Components
|
|
616
|
+
|
|
617
|
+
```bash
|
|
618
|
+
audial generate-samples path/to/audio.mp3 --components drums,bass,melody
|
|
619
|
+
```
|
|
620
|
+
|
|
621
|
+
#### Specific Genre
|
|
622
|
+
|
|
623
|
+
```bash
|
|
624
|
+
audial generate-samples path/to/audio.mp3 --genre "Tech House"
|
|
625
|
+
```
|
|
626
|
+
|
|
627
|
+
#### Job Type
|
|
628
|
+
|
|
629
|
+
```bash
|
|
630
|
+
audial generate-samples path/to/audio.mp3 --job-type sample_pack
|
|
631
|
+
```
|
|
632
|
+
|
|
633
|
+
#### Custom Results Folder
|
|
634
|
+
|
|
635
|
+
```bash
|
|
636
|
+
audial generate-samples path/to/audio.mp3 --results-folder path/to/custom/folder
|
|
637
|
+
```
|
|
638
|
+
|
|
639
|
+
#### Custom API Key
|
|
640
|
+
|
|
641
|
+
```bash
|
|
642
|
+
audial generate-samples path/to/audio.mp3 --api-key your_custom_api_key
|
|
643
|
+
```
|
|
644
|
+
|
|
645
|
+
### MIDI Generation Commands
|
|
646
|
+
|
|
647
|
+
#### Basic MIDI Generation
|
|
648
|
+
|
|
649
|
+
```bash
|
|
650
|
+
audial generate-midi path/to/audio.mp3
|
|
651
|
+
```
|
|
652
|
+
|
|
653
|
+
#### Multiple Files
|
|
654
|
+
|
|
655
|
+
```bash
|
|
656
|
+
audial generate-midi path/to/file1.mp3 path/to/file2.mp3 path/to/file3.mp3
|
|
657
|
+
```
|
|
658
|
+
|
|
659
|
+
#### Specific BPM
|
|
660
|
+
|
|
661
|
+
```bash
|
|
662
|
+
audial generate-midi path/to/audio.mp3 --bpm 120
|
|
663
|
+
```
|
|
664
|
+
|
|
665
|
+
#### Custom Results Folder
|
|
666
|
+
|
|
667
|
+
```bash
|
|
668
|
+
audial generate-midi path/to/audio.mp3 --results-folder path/to/custom/folder
|
|
669
|
+
```
|
|
670
|
+
|
|
671
|
+
#### Custom API Key
|
|
672
|
+
|
|
673
|
+
```bash
|
|
674
|
+
audial generate-midi path/to/audio.mp3 --api-key your_custom_api_key
|
|
675
|
+
```
|
|
676
|
+
|
|
677
|
+
## Result Data Structure
|
|
678
|
+
|
|
679
|
+
All functions return a consistent result structure:
|
|
680
|
+
|
|
681
|
+
```python
|
|
682
|
+
{
|
|
683
|
+
"execution": {
|
|
684
|
+
# Raw API response data
|
|
685
|
+
"exeId": "execution-id",
|
|
686
|
+
"state": "completed",
|
|
687
|
+
"original": {
|
|
688
|
+
"bpm": 120,
|
|
689
|
+
"key": "Cmaj",
|
|
690
|
+
"filename": "original.mp3",
|
|
691
|
+
"url": "https://storage.url/path/to/file.mp3"
|
|
692
|
+
},
|
|
693
|
+
# Function-specific data (e.g., "stem", "midi", "master", etc.)
|
|
694
|
+
"stem": {
|
|
695
|
+
"vocalsmp3": {
|
|
696
|
+
"bpm": 120,
|
|
697
|
+
"key": "Cmaj",
|
|
698
|
+
"filename": "vocals.mp3",
|
|
699
|
+
"url": "https://storage.url/path/to/vocals.mp3"
|
|
700
|
+
},
|
|
701
|
+
# Other stems...
|
|
702
|
+
},
|
|
703
|
+
# Other execution data...
|
|
704
|
+
},
|
|
705
|
+
# For some functions, function-specific data may be included here
|
|
706
|
+
"analysis": {
|
|
707
|
+
"bpm": 120,
|
|
708
|
+
"key": "Cmaj",
|
|
709
|
+
"execution_id": "execution-id"
|
|
710
|
+
},
|
|
711
|
+
"segmentation": {
|
|
712
|
+
# Segmentation data
|
|
713
|
+
},
|
|
714
|
+
"files": {
|
|
715
|
+
"folder": "./audial_results/execution-id_function-type",
|
|
716
|
+
"files": {
|
|
717
|
+
"filename1.mp3": "./audial_results/execution-id_function-type/filename1.mp3",
|
|
718
|
+
"filename2.mp3": "./audial_results/execution-id_function-type/filename2.mp3",
|
|
719
|
+
# Other downloaded files...
|
|
720
|
+
}
|
|
721
|
+
}
|
|
722
|
+
}
|
|
723
|
+
```
|
|
724
|
+
|
|
725
|
+
The structure may vary slightly depending on the function, but will always include:
|
|
726
|
+
1. `execution`: The raw API response data
|
|
727
|
+
2. `files`: Information about the downloaded files
|
|
728
|
+
- `folder`: Path to the results folder
|
|
729
|
+
- `files`: Dictionary mapping filenames to local file paths
|
|
730
|
+
|
|
731
|
+
Some functions may include additional fields with function-specific data, such as `analysis` for the `analyze` function.
|