@mastra/voice-deepgram
v0.13.2
Published
Mastra Deepgram voice integration
Keywords
Readme
@mastra/voice-deepgram
Add Deepgram text-to-speech and speech-to-text to Mastra with configurable models, voices, languages, synthesis, and streaming transcription.
Installation
npm install @mastra/voice-deepgramUsage
import { DeepgramVoice } from '@mastra/voice-deepgram';
// Create voice with both speech and listening capabilities
const voice = new DeepgramVoice({
speechModel: {
name: 'aura', // TTS family
apiKey: 'your-api-key', // Optional, can use DEEPGRAM_API_KEY env var
},
listeningModel: {
name: 'nova', // STT family
apiKey: 'your-api-key', // Optional, can use DEEPGRAM_API_KEY env var
},
speaker: 'asteria-en', // default voiceId (see voice.ts)
});
// List available voices
const voices = await voice.getSpeakers();
// Generate speech
const audioStream = await voice.speak('Hello from Mastra!', {
speaker: 'hera-en', // override speaker voice
});
// Convert speech to text
const result = await voice.listen(audioStream, {
diarize: true,
diarize_speaker_count: 2,
});
console.log(result.transcript);Documentation
Changelog
See the package changelog for version history and release notes.
Support
We have an open community Discord. Come and say hello and let us know if you have any questions or need any help getting things running.
