Logo

Play.ai

Orate supports Play.ai's speech services.

Play.ai generates AI voices indistinguishable from humans with ultra realistic text to speech from the leading multi voice AI voice generator. Orate offers a single interface for all of Play.ai's speech services.

Setup

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

import { Play } from 'orate/play';

Configuration

You can use Play.ai by creating a new instance of the Play class:

const play = new Play();

This will use the PLAY_API_KEY and PLAY_USER_ID environment variables. If you don't have these variables set, you can pass your API key and user ID as arguments to the constructor.

const play = new Play({
  apiKey: 'your_api_key',
  userId: 'your_user_id',
});

Usage

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

Text to Speech

The Play.ai provider provides a tts function that allows you to create a text-to-speech synthesis function using Play.ai TTS. By default, the tts function uses the Play3.0-mini model and the Angelo voice.

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

The voice can be the name of a default voice e.g. Angelo or the ID of a custom voice e.g. s3://voice-cloning-zero-shot/.../original/manifest.json.

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

const speech = await speak({
  model: new Play().tts('PlayDialog', 'Abigail'),
  prompt: 'Hello, world!',
});

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

const speech = await speak({
  model: new Play().tts('PlayDialog', 'Abigail', {
    speed: 1.25,
  }),
  prompt: 'Hello, world!',
});

On this page