@@ -48,7 +48,7 @@ The recommended installation method is though the unity package manager and [Ope
48
48
49
49
### Table of Contents
50
50
51
- - [ Authentication] ( #authentication ) : construction :
51
+ - [ Authentication] ( #authentication )
52
52
- [ API Proxy] ( #api-proxy )
53
53
- [ Editor Dashboard] ( #editor-dashboard )
54
54
- [ Speech Synthesis Dashboard] ( #speech-synthesis-dashboard )
@@ -59,6 +59,7 @@ The recommended installation method is though the unity package manager and [Ope
59
59
- [ Text to Speech] ( #text-to-speech )
60
60
- [ Stream Text To Speech] ( #stream-text-to-speech )
61
61
- [ Voices] ( #voices )
62
+ - [ Get Shared Voices] ( #get-shared-voices ) :new :
62
63
- [ Get All Voices] ( #get-all-voices )
63
64
- [ Get Default Voice Settings] ( #get-default-voice-settings )
64
65
- [ Get Voice] ( #get-voice )
@@ -69,6 +70,13 @@ The recommended installation method is though the unity package manager and [Ope
69
70
- [ Samples] ( #samples )
70
71
- [ Download Voice Sample] ( #download-voice-sample )
71
72
- [ Delete Voice Sample] ( #delete-voice-sample )
73
+ - [ Dubbing] ( #dubbing ) :new :
74
+ - [ Dub] ( #dub ) :new :
75
+ - [ Get Dubbing Metadata] ( #get-dubbing-metadata ) :new :
76
+ - [ Get Transcript for Dub] ( #get-transcript-for-dub ) :new :
77
+ - [ Get dubbed file] ( #get-dubbed-file ) :new :
78
+ - [ Delete Dubbing Project] ( #delete-dubbing-project ) :new :
79
+ - [ SFX Generation] ( #sfx-generation ) :new :
72
80
- [ History] ( #history )
73
81
- [ Get History] ( #get-history )
74
82
- [ Get History Item] ( #get-history-item )
@@ -176,8 +184,9 @@ In this example, we demonstrate how to set up and use `ElevenLabsProxyStartup` i
176
184
1 . Create a new [ ASP.NET Core minimal web API] ( https://learn.microsoft.com/en-us/aspnet/core/tutorials/min-web-api?view=aspnetcore-6.0 ) project.
177
185
2 . Add the ElevenLabs-DotNet nuget package to your project.
178
186
- Powershell install: ` Install-Package ElevenLabs-DotNet-Proxy `
187
+ - Dotnet install: ` dotnet add package ElevenLabs-DotNet-Proxy `
179
188
- Manually editing .csproj: ` <PackageReference Include="ElevenLabs-DotNet-Proxy" /> `
180
- 3 . Create a new class that inherits from ` AbstractAuthenticationFilter ` and override the ` ValidateAuthentication ` method. This will implement the ` IAuthenticationFilter ` that you will use to check user session token against your internal server.
189
+ 3 . Create a new class that inherits from ` AbstractAuthenticationFilter ` and override the ` ValidateAuthenticationAsync ` method. This will implement the ` IAuthenticationFilter ` that you will use to check user session token against your internal server.
181
190
4 . In ` Program.cs ` , create a new proxy web application by calling ` ElevenLabsProxyStartup.CreateDefaultHost ` method, passing your custom ` AuthenticationFilter ` as a type argument.
182
191
5 . Create ` ElevenLabsAuthentication ` and ` ElevenLabsClientSettings ` as you would normally with your API keys, org id, or Azure settings.
183
192
@@ -186,11 +195,13 @@ public partial class Program
186
195
{
187
196
private class AuthenticationFilter : AbstractAuthenticationFilter
188
197
{
189
- public override void ValidateAuthentication (IHeaderDictionary request )
198
+ public override async Task ValidateAuthenticationAsync (IHeaderDictionary request )
190
199
{
200
+ await Task .CompletedTask ; // remote resource call
201
+
191
202
// You will need to implement your own class to properly test
192
203
// custom issued tokens you've setup for your end users.
193
- if (! request [" xi-api-key" ].ToString ().Contains (userToken ))
204
+ if (! request [" xi-api-key" ].ToString ().Contains (TestUserToken ))
194
205
{
195
206
throw new AuthenticationException (" User is not authorized" );
196
207
}
@@ -265,7 +276,9 @@ audioSource.PlayOneShot(voiceClip.AudioClip);
265
276
voiceClip .CopyIntoProject (editorDownloadDirectory );
266
277
```
267
278
268
- ### Stream Text to Speech
279
+ #### [ Stream Text To Speech] ( https://docs.elevenlabs.io/api-reference/text-to-speech-stream )
280
+
281
+ Stream text to speech.
269
282
270
283
``` csharp
271
284
var api = new ElevenLabsClient ();
@@ -289,6 +302,19 @@ audioSource.clip = voiceClip.AudioClip;
289
302
290
303
Access to voices created either by the user or ElevenLabs.
291
304
305
+ #### Get Shared Voices
306
+
307
+ Gets a list of shared voices in the public voice library.
308
+
309
+ ``` csharp
310
+ var api = new ElevenLabsClient ();
311
+ var results = await ElevenLabsClient .SharedVoicesEndpoint .GetSharedVoicesAsync ();
312
+ foreach (var voice in results .Voices )
313
+ {
314
+ Debug .Log ($" {voice .OwnerId } | {voice .VoiceId } | {voice .Date } | {voice .Name }" );
315
+ }
316
+ ```
317
+
292
318
#### Get All Voices
293
319
294
320
Gets a list of all available voices.
@@ -383,6 +409,87 @@ var success = await api.VoicesEndpoint.DeleteVoiceSampleAsync(voiceId, sampleId)
383
409
Debug .Log ($" Was successful? {success }" );
384
410
```
385
411
412
+ ### [ Dubbing] ( https://elevenlabs.io/docs/api-reference/create-dub )
413
+
414
+ #### Dub
415
+
416
+ Dubs provided audio or video file into given language.
417
+
418
+ ``` csharp
419
+ var api = new ElevenLabsClient ();
420
+ // from URI
421
+ var request = new DubbingRequest (new Uri (" https://youtu.be/Zo5-rhYOlNk" ), " ja" , " en" , 1 , true );
422
+ // from file
423
+ var request = new DubbingRequest (filePath , " es" , " en" , 1 );
424
+ var metadata = await api .DubbingEndpoint .DubAsync (request , progress : new Progress <DubbingProjectMetadata >(metadata =>
425
+ {
426
+ switch (metadata .Status )
427
+ {
428
+ case " dubbing" :
429
+ Debug .Log ($" Dubbing for {metadata .DubbingId } in progress... Expected Duration: {metadata .ExpectedDurationSeconds : 0 . 00 } seconds" );
430
+ break ;
431
+ case " dubbed" :
432
+ Debug .Log ($" Dubbing for {metadata .DubbingId } complete in {metadata .TimeCompleted .TotalSeconds : 0 . 00 } seconds!" );
433
+ break ;
434
+ default :
435
+ Debug .Log ($" Status: {metadata .Status }" );
436
+ break ;
437
+ }
438
+ }));
439
+ ```
440
+
441
+ #### Get Dubbing Metadata
442
+
443
+ Returns metadata about a dubbing project, including whether it’s still in progress or not.
444
+
445
+ ``` csharp
446
+ var api = new ElevenLabsClient ();
447
+ var metadata = api .await GetDubbingProjectMetadataAsync (" dubbing-id" );
448
+ ```
449
+
450
+ #### Get Dubbed File
451
+
452
+ Returns downloaded dubbed file path.
453
+
454
+ > [ !IMPORTANT]
455
+ > Videos will be returned in MP4 format and audio only dubs will be returned in MP3.
456
+
457
+ ``` csharp
458
+ var dubbedClipPath = await ElevenLabsClient .DubbingEndpoint .GetDubbedFileAsync (metadata .DubbingId , request .TargetLanguage );
459
+ var dubbedClip = await Rest .DownloadAudioClipAsync ($" file://{dubbedClipPath }" , AudioType .MPEG );
460
+ audioSource .PlayOneShot (dubbedClip );
461
+ ```
462
+
463
+ #### Get Transcript for Dub
464
+
465
+ Returns transcript for the dub in the desired format.
466
+
467
+ ``` csharp
468
+ var srcFile = new FileInfo (audioPath );
469
+ var transcriptPath = new FileInfo ($" {srcFile .FullName }.dubbed.{request .TargetLanguage }.srt" );
470
+ var transcriptFile = await ElevenLabsClient .DubbingEndpoint .GetTranscriptForDubAsync (metadata .DubbingId , request .TargetLanguage );
471
+ await File .WriteAllTextAsync (transcriptPath .FullName , transcriptFile );
472
+ ```
473
+
474
+ #### Delete Dubbing Project
475
+
476
+ Deletes a dubbing project.
477
+
478
+ ``` csharp
479
+ var api = new ElevenLabsClient ();
480
+ await api .DubbingEndpoint .DeleteDubbingProjectAsync (" dubbing-id" );
481
+ ```
482
+
483
+ ### SFX Generation
484
+
485
+ API that converts text into sounds & uses the most advanced AI audio model ever.
486
+
487
+ ``` csharp
488
+ var api = new ElevenLabsClient ();
489
+ var request = new SoundGenerationRequest (" Star Wars Light Saber parry" );
490
+ var clip = await api .SoundGenerationEndpoint .GenerateSoundAsync (request );
491
+ ```
492
+
386
493
### [ History] ( https://docs.elevenlabs.io/api-reference/history )
387
494
388
495
Access to your previously synthesized audio clips including its metadata.
@@ -393,9 +500,9 @@ Get metadata about all your generated audio.
393
500
394
501
``` csharp
395
502
var api = new ElevenLabsClient ();
396
- var historyInfo = await api .HistoryEndpoint .GetHistoryAsync ();
503
+ var historyItems = await api .HistoryEndpoint .GetHistoryAsync ();
397
504
398
- foreach (var item in historyInfo . HistoryItems . OrderBy (item => item .Date ))
505
+ foreach (var item in historyItems . OrderBy (historyItem => historyItem .Date ))
399
506
{
400
507
Debug .Log ($" {item .State } {item .Date } | {item .Id } | {item .Text .Length } | {item .Text }" );
401
508
}
@@ -407,7 +514,7 @@ Get information about a specific item.
407
514
408
515
``` csharp
409
516
var api = new ElevenLabsClient ();
410
- var historyItem = api .HistoryEndpoint .GetHistoryItemAsync (voiceClip .Id );
517
+ var historyItem = await api .HistoryEndpoint .GetHistoryItemAsync (voiceClip .Id );
411
518
```
412
519
413
520
#### Download History Audio
0 commit comments