Skip to content

Latest Text to Speech

Select a voice model and synthesize audio with Fish Audio S2.1 Pro.

This example assumes using FishAudio; is in scope and apiKey contains your FishAudio API key.

 1
 2
 3
 4
 5
 6
 7
 8
 9
10
11
12
13
14
15
16
17
18
using var client = new FishAudioClient(apiKey);

var models = await client.Model.GetModelAsync(pageSize: 1);
var voice = models.Items.FirstOrDefault();
if (voice is null)
{
    throw new AssertInconclusiveException("No Fish Audio voice model is available to this account.");
}

ITextToSpeechClient speech = client;
var response = await speech.GetAudioAsync(
    "Hello from the latest Fish Audio speech model.",
    new TextToSpeechOptions
    {
        ModelId = FishAudioModels.S21ProFree,
        VoiceId = voice.Id,
        AudioFormat = "mp3",
    });