Overview
Convert text into high-quality speech using Murf’s real-time Streaming API or the Synthesize Speech API.
Convert text into high-quality speech using Murf’s real-time Streaming API or the Synthesize Speech API.
Murf provides a powerful Text to Speech API that allows you to generate high-quality, natural-sounding speech from text input. The API supports over 35 languages and 20 speaking styles across 150+ voices to suit your application’s needs.
Murf offers two ways to generate speech:
You can Generate your API key from the Murf API Dashboard and optionally set it as an environment variable.
If you’re using Python, you can install Murf’s Python SDK using the following command:
A link to the audio file will be returned in the response. You can use this link to download the audio file and use it wherever you need it. The audio file will be available for download for 72 hours after generation.
Explore Murf’s extensive library of voices and styles
Craft unique and expressive voiceovers for your application
The API supports multiple output formats for the generated audio - the default output format is wav. You can choose from the following formats:
You can specify the output format using the format parameter in the request payload.
Furthermore, you can use the channelType and sampleRate keys to specify the channel type and sample rate for the generated audio. The API supports stereo and mono channels, and sample rates of 8000, 24000, 44100, and 48000 Hz.
ULAW and ALAW formats only support mono channel type and a sample rate of 8000 Hz. If you specify a different channel type or sample rate, the API will default to the supported values.
Note: Not available for Streaming API.
You can choose to receive the audio file in Base64 encoded format by setting the encodeAsBase64 parameter to true in the request payload. This can be useful when you need to embed the audio file directly into your application or store it in a database. This will also enable zero retention of audio data on Murf’s servers.
The response will include the audio file encoded in Base64 format, which you can decode and use as needed.
Note: Not supported for Streaming API.
Responses from Murf API can be gzipped by including “gzip” in the accept-encoding header of your requests. This is especially beneficial if you choose to return the audio response as a Base64 encoded string.
Audio formats define how sound data is stored and compressed. Choose MP3 for web streaming due to its small size; OGG as an open, efficient option for streaming with better quality at similar bitrates; WAV for highest-quality, uncompressed recordings and editing; FLAC for lossless compression with reduced size; ALAW/ULAW for telephony systems; and PCM for raw, uncompressed audio when you need maximum compatibility or low-level processing (note: large files). Base64 encodes audio as text, making it useful for embedding in APIs or data transfers.
Audio channels define the number of sound signals in a recording.
The sample rate (measured in Hz) determines audio detail:
Base64 encodes audio as text, making it useful for embedding in APIs, JSON, XML, or data transfers where binary formats aren’t supported. Base64 is useful for transmitting audio files in web-based applications. Since Base64 increases file size compared to its original format, it’s best used for compatibility rather than storage efficiency.