Create an instant voice clone from an audio sample, print the new voice ID, and delete the test voice afterwards.
This example assumes using ElevenLabs; is in scope and apiKey contains your ElevenLabs API key.
1 2 3 4 5 6 7 8 91011121314151617
usingvarclient=newElevenLabsClient(apiKey);// Load a voice sample from disk.byte[]voiceSample=awaitFile.ReadAllBytesAsync(Path.Combine(AppContext.BaseDirectory,"Resources","hello-in-russian-24k-pcm16.wav"));// Create the cloned voice.AddVoiceIVCResponseModelresponse=awaitclient.Voices.CreateAsync(name:$"Test Cloned Voice {Guid.NewGuid():N}",files:[voiceSample],description:"A cloned voice from my audio sample",removeBackgroundNoise:false);Console.WriteLine($"Cloned voice ID: {response.VoiceId}");// Clean up the test voice once the example has succeeded.awaitclient.Voices.DeleteAsync(response.VoiceId);