audiopod 2.1.0

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.
package/LICENSE ADDED
@@ -0,0 +1,21 @@
1
+ MIT License
2
+
3
+ Copyright (c) 2024 AudioPod AI
4
+
5
+ Permission is hereby granted, free of charge, to any person obtaining a copy
6
+ of this software and associated documentation files (the "Software"), to deal
7
+ in the Software without restriction, including without limitation the rights
8
+ to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
9
+ copies of the Software, and to permit persons to whom the Software is
10
+ furnished to do so, subject to the following conditions:
11
+
12
+ The above copyright notice and this permission notice shall be included in all
13
+ copies or substantial portions of the Software.
14
+
15
+ THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
16
+ IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
17
+ FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
18
+ AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
19
+ LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
20
+ OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
21
+ SOFTWARE.
package/README.md ADDED
@@ -0,0 +1,189 @@
1
+ # AudioPod Node.js SDK
2
+
3
+ Official Node.js SDK for [AudioPod AI](https://audiopod.ai) - Professional Audio Processing powered by AI.
4
+
5
+ [![npm version](https://badge.fury.io/js/audiopod.svg)](https://www.npmjs.com/package/audiopod)
6
+ [![Node 16+](https://img.shields.io/badge/node-16+-green.svg)](https://nodejs.org/)
7
+ [![License: MIT](https://img.shields.io/badge/License-MIT-yellow.svg)](https://opensource.org/licenses/MIT)
8
+
9
+ ## Installation
10
+
11
+ ```bash
12
+ npm install audiopod
13
+ # or
14
+ yarn add audiopod
15
+ ```
16
+
17
+ ## Quick Start
18
+
19
+ ```typescript
20
+ import AudioPod from "audiopod";
21
+
22
+ // Initialize client
23
+ const client = new AudioPod({ apiKey: "ap_your_api_key" });
24
+
25
+ // Separate audio into 6 stems
26
+ const result = await client.stems.separate({
27
+ url: "https://youtube.com/watch?v=VIDEO_ID",
28
+ mode: "six",
29
+ });
30
+
31
+ // Download stems
32
+ for (const [stem, url] of Object.entries(result.download_urls)) {
33
+ console.log(`${stem}: ${url}`);
34
+ }
35
+ ```
36
+
37
+ ## Stem Separation
38
+
39
+ Extract individual audio components from mixed recordings.
40
+
41
+ ### Available Modes
42
+
43
+ | Mode | Stems | Output |
44
+ | ----------- | ----- | --------------------------------------------------------------- |
45
+ | `single` | 1 | Specified stem only (vocals, drums, bass, guitar, piano, other) |
46
+ | `two` | 2 | Vocals + Instrumental |
47
+ | `four` | 4 | Vocals, Drums, Bass, Other |
48
+ | `six` | 6 | Vocals, Drums, Bass, Guitar, Piano, Other |
49
+ | `producer` | 8 | + Kick, Snare, Hihat |
50
+ | `studio` | 12 | Full production toolkit |
51
+ | `mastering` | 16 | Maximum detail |
52
+
53
+ ### Examples
54
+
55
+ ```typescript
56
+ import AudioPod from "audiopod";
57
+
58
+ const client = new AudioPod({ apiKey: "ap_your_api_key" });
59
+
60
+ // Six-stem separation from YouTube
61
+ const job = await client.stems.extract({
62
+ url: "https://youtube.com/watch?v=VIDEO_ID",
63
+ mode: "six",
64
+ });
65
+ console.log(`Job ID: ${job.id}`);
66
+
67
+ // Wait for completion
68
+ const result = await client.stems.waitForCompletion(job.id);
69
+ console.log(result.download_urls);
70
+
71
+ // Or use the convenience method (extract + wait)
72
+ const result = await client.stems.separate({
73
+ url: "https://youtube.com/watch?v=VIDEO_ID",
74
+ mode: "six",
75
+ });
76
+
77
+ // From local file
78
+ const result = await client.stems.separate({
79
+ file: "./song.mp3",
80
+ mode: "four",
81
+ });
82
+
83
+ // Extract only vocals
84
+ const result = await client.stems.separate({
85
+ url: "https://youtube.com/watch?v=VIDEO_ID",
86
+ mode: "single",
87
+ stem: "vocals",
88
+ });
89
+
90
+ // Get available modes
91
+ const modes = await client.stems.modes();
92
+ modes.modes.forEach((m) => {
93
+ console.log(`${m.mode}: ${m.description}`);
94
+ });
95
+ ```
96
+
97
+ ## API Wallet
98
+
99
+ Check balance and manage your wallet.
100
+
101
+ ```typescript
102
+ // Check balance
103
+ const balance = await client.wallet.balance();
104
+ console.log(`Balance: ${balance.balance_usd}`);
105
+
106
+ // Estimate cost
107
+ const estimate = await client.wallet.estimate("stem_extraction", 180);
108
+ console.log(`Estimated cost: ${estimate.cost_usd}`);
109
+
110
+ // Get usage history
111
+ const usage = await client.wallet.usage();
112
+ usage.logs.forEach((log) => {
113
+ console.log(`${log.service_type}: ${log.amount_usd}`);
114
+ });
115
+ ```
116
+
117
+ ## Other Services
118
+
119
+ ```typescript
120
+ // Transcription
121
+ const job = await client.transcription.create({ url: "https://..." });
122
+ const result = await client.transcription.waitForCompletion(job.id);
123
+
124
+ // Voice cloning
125
+ const voice = await client.voice.clone({
126
+ file: "./sample.wav",
127
+ name: "My Voice",
128
+ });
129
+
130
+ // Music generation
131
+ const song = await client.music.generate({
132
+ prompt: "upbeat electronic dance music",
133
+ });
134
+
135
+ // Noise reduction
136
+ const clean = await client.denoiser.denoise({ file: "./noisy.wav" });
137
+
138
+ // Speaker diarization
139
+ const speakers = await client.speaker.diarize({ url: "https://..." });
140
+ ```
141
+
142
+ ## Error Handling
143
+
144
+ ```typescript
145
+ import AudioPod, {
146
+ InsufficientBalanceError,
147
+ AuthenticationError,
148
+ } from "audiopod";
149
+
150
+ try {
151
+ const client = new AudioPod({ apiKey: "ap_..." });
152
+ const result = await client.stems.separate({ url: "...", mode: "six" });
153
+ } catch (error) {
154
+ if (error instanceof AuthenticationError) {
155
+ console.log("Invalid API key");
156
+ } else if (error instanceof InsufficientBalanceError) {
157
+ console.log(`Need more credits. Required: ${error.requiredCents} cents`);
158
+ }
159
+ }
160
+ ```
161
+
162
+ ## Environment Variables
163
+
164
+ ```bash
165
+ export AUDIOPOD_API_KEY="ap_your_api_key"
166
+ ```
167
+
168
+ ```typescript
169
+ // Client reads from env automatically
170
+ const client = new AudioPod();
171
+ ```
172
+
173
+ ## TypeScript Support
174
+
175
+ Full TypeScript support with exported types:
176
+
177
+ ```typescript
178
+ import AudioPod, { StemExtractionJob, StemMode, WalletBalance } from "audiopod";
179
+ ```
180
+
181
+ ## Documentation
182
+
183
+ - [API Documentation](https://docs.audiopod.ai)
184
+ - [API Reference](https://docs.audiopod.ai/api-reference/stem-splitter)
185
+ - [Get API Key](https://www.audiopod.ai/dashboard/account/api-keys)
186
+
187
+ ## License
188
+
189
+ MIT License - see [LICENSE](LICENSE) for details.