Text to Speech

Convert text into realistic speech with many voices and languages; powered by leading AI providers.

Orate provides a simple and unified API for converting text into speech using various AI providers. The text-to-speech functionality is accessible through the speak function.

Usage

The basic usage involves importing the speak function from Orate and your chosen provider. For example, to use OpenAI's text-to-speech model, you can import the OpenAI provider and use its tts function:

import { speak } from 'orate';
import { openai } from 'orate/openai';
 
const transcription = await speak({
  model: openai.tts(),
  prompt: 'Hello, world!',
});

model

The model parameter is a function that returns a model instance. The model instance is a function that takes a prompt and returns a promise that resolves to the speech of the prompt.

const model = openai.tts();

prompt

The prompt parameter is a string that contains the text to be converted into speech.

const prompt = 'Hello, world!';

On this page