Logo

Speechify

Orate supports Speechify's speech services.

Speechify offer a text-to-speech API that delivers their most natural and beloved AI voices directly to developers worldwide.

Setup

The Speechify provider is available by default in Orate. To import it, you can use the following code:

import { Speechify } from 'orate/speechify';

Configuration

You can use Speechify by creating a new instance of the Speechify class:

const speechify = new Speechify();

This will use the SPEECHIFY_API_KEY environment variable. If you don't have this variable set, you can pass your API key as an argument to the constructor.

const speechify = new Speechify('your_api_key');

Usage

The Speechify provider provides a single interface for all of Speechify's speech services.

Text to Speech

The Speechify provider provides a tts function that allows you to create a text-to-speech synthesis function using Speechify's TTS. By default, the tts function uses the simba-multilingual model and the george voice.

import { speak } from 'orate';
import { Speechify } from 'orate/speechify';
 
const speech = await speak({
  model: new Speechify().tts(),
  prompt: 'Hello, world!',
});

You can specify the model and voice to use by passing them as arguments to the tts function.

const speech = await speak({
  model: new Speechify().tts('simba-turbo', 'kristy'),
  prompt: 'Hello, world!',
});

You can also specify specific Speechify properties by passing them as an argument to the tts function.

const speech = await speak({
  model: new Speechify().tts('simba-turbo', 'kristy', {
    options: {
      enableLoudnessNormalization: true,
    }
  }),
  prompt: 'Hello, world!',
});

You can also stream the speech.

const speech = await speak({
  model: new Speechify().tts(),
  prompt: 'Hello, world!',
  stream: true,
});

On this page