Skip to main content

Speechify

The Speechify voice implementation in Mastra provides text-to-speech capabilities using Speechify's API.

Usage example
Direct link to Usage example

import { SpeechifyVoice } from '@mastra/voice-speechify'

// Initialize with default configuration (uses SPEECHIFY_API_KEY environment variable)
const voice = new SpeechifyVoice()

// Initialize with custom configuration
const voice = new SpeechifyVoice({
speechModel: {
name: 'simba-3.2',
apiKey: 'your-api-key',
},
speaker: 'harper_32', // Default voice (simba-3.2 serves the curated Simba 3 voices only)
})

// Convert text to speech
const audioStream = await voice.speak('Hello, world!', {
speaker: 'imogen_32', // Override default voice
})

Constructor parameters
Direct link to Constructor parameters

speechModel?:

SpeechifyConfig
= { name: 'simba-english' }
Configuration for text-to-speech functionality
SpeechifyConfig

name?:

SpeechifyModel
The Speechify model to use ('simba-3.2', 'simba-3.0', 'simba-english', or 'simba-multilingual')

apiKey?:

string
Speechify API key. Falls back to SPEECHIFY_API_KEY environment variable

speaker?:

SpeechifyVoiceId
= 'harper_32' for Simba 3 models, otherwise 'george'
Default voice ID to use for speech synthesis. The Simba 3 models serve a curated voice set only (harper_32, imogen_32, ...); the classic catalog voices (george, henry, ...) work with simba-english and simba-multilingual

Methods
Direct link to Methods

speak()
Direct link to speak

Converts text to speech using the configured speech model and voice.

input:

string | NodeJS.ReadableStream
Text to convert to speech. If a stream is provided, it will be converted to text first.

options?:

Options
Configuration options.
Options

speaker?:

string
Override the default speaker for this request

model?:

SpeechifyModel
Override the default model for this request

Returns: Promise<NodeJS.ReadableStream>

getSpeakers()
Direct link to getspeakers

Returns an array of available voice options, where each node contains:

voiceId:

string
Unique identifier for the voice

name:

string
Display name of the voice

language:

string
Language code for the voice

gender:

string
Gender of the voice

listen()
Direct link to listen

This method isn't supported by Speechify and will throw an error. Speechify doesn't provide speech-to-text functionality.

Notes
Direct link to Notes

  • Speechify requires an API key for authentication
  • The default model is 'simba-english'
  • 'simba-3.2' is Speechify's latest streaming model with the lowest latency and richest expressivity, and the recommended model for English
  • 'simba-3.2' and 'simba-3.0' are currently English only; use 'simba-multilingual' for non-English or mixed-language input
  • 'simba-3.2' and 'simba-3.0' serve a curated voice set only: 'beatrice_32', 'dominic_32', 'edmund_32', 'geffen_32', 'harper_32', 'hugh_32', 'imogen_32', 'wyatt_32'. Classic catalog voices such as 'george' return an error on these models
  • The default speaker follows the configured model: 'harper_32' for the Simba 3 models, otherwise 'george'
  • Speech-to-text functionality isn't supported
  • Additional audio stream options can be passed through the speak() method's options parameter
On this page