Synthesize a short WAV clip and save it to disk using one of the ready voices.
This example assumes using ResembleAI; is in scope and apiKey contains your ResembleAI API key.
1 2 3 4 5 6 7 8 910111213141516171819202122
usingvarclient=newResembleAIClient(apiKey);varselectedVoice=awaitGetReadyVoiceAsync(client);try{// Synthesize a short clip to WAV audio.varresponse=awaitclient.SubpackageTextToSpeech.SynthesizeAsync(voiceUuid:selectedVoice.Uuid,data:"Hello from the Resemble AI SDK integration tests.",title:"resembleai-sync-sample",outputFormat:SynthesizePostRequestBodyContentApplicationJsonSchemaOutputFormat.Wav,sampleRate:SynthesizePostRequestBodyContentApplicationJsonSchemaSampleRate.x22050);// Persist the decoded audio payload to disk.awaitFile.WriteAllBytesAsync("resembleai-sync.wav",response.AudioContent!);Console.WriteLine($"Saved {response.AudioContent?.Length ?? 0} bytes using {selectedVoice.Name}.");}catch(ApiExceptionex){AssertFeatureAvailable(ex,"text-to-speech");}