Skip to content

Text to Speech

Generate natural-sounding speech audio from text using Murf AI.

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

1
2
3
4
5
6
7
8
9
using var client = new MurfClient(apiKey);

// Generate speech from text using the Murf TTS API.
var response = await client.SubpackageTextToSpeech.GenerateAsync(
    text: "Hello, welcome to Murf AI text to speech.",
    voiceId: "en-US-natalie",
    format: "MP3");

// The response contains a URL to the generated audio file and metadata.