@mastra/voice-google 0.14.1-alpha.0 → 0.14.1
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/CHANGELOG.md +6 -0
- package/dist/docs/SKILL.md +3 -3
- package/dist/docs/assets/SOURCE_MAP.json +1 -1
- package/dist/docs/references/guides-voice-overview.md +55 -106
- package/dist/docs/references/integrations-voice-google.md +688 -0
- package/package.json +4 -4
- package/dist/docs/references/reference-voice-google.md +0 -290
package/CHANGELOG.md
CHANGED
|
@@ -1,5 +1,11 @@
|
|
|
1
1
|
# @mastra/voice-google
|
|
2
2
|
|
|
3
|
+
## 0.14.1
|
|
4
|
+
|
|
5
|
+
### Patch Changes
|
|
6
|
+
|
|
7
|
+
- Fixed `GoogleVoice.listen()` failing with `ERR_STREAM_PREMATURE_CLOSE` on Node 22 and newer. Speech-to-text with Application Default Credentials now transcribes again. Fixes [#19206](https://github.com/mastra-ai/mastra/issues/19206). ([#20976](https://github.com/mastra-ai/mastra/pull/20976))
|
|
8
|
+
|
|
3
9
|
## 0.14.1-alpha.0
|
|
4
10
|
|
|
5
11
|
### Patch Changes
|
package/dist/docs/SKILL.md
CHANGED
|
@@ -3,7 +3,7 @@ name: mastra-voice-google
|
|
|
3
3
|
description: Documentation for @mastra/voice-google. Use when working with @mastra/voice-google APIs, configuration, or implementation.
|
|
4
4
|
metadata:
|
|
5
5
|
package: "@mastra/voice-google"
|
|
6
|
-
version: "0.14.1
|
|
6
|
+
version: "0.14.1"
|
|
7
7
|
---
|
|
8
8
|
|
|
9
9
|
## When to use
|
|
@@ -18,9 +18,9 @@ Read the individual reference documents for detailed explanations and code examp
|
|
|
18
18
|
|
|
19
19
|
- [Voice in Mastra](references/guides-voice-overview.md) - Overview of voice capabilities in Mastra, including text-to-speech, speech-to-text, and real-time speech-to-speech interactions.
|
|
20
20
|
|
|
21
|
-
###
|
|
21
|
+
### Integrations
|
|
22
22
|
|
|
23
|
-
- [
|
|
23
|
+
- [Google](references/integrations-voice-google.md) - Documentation for the Google Voice implementation, providing text-to-speech and speech-to-text capabilities with support for both API key and Vertex AI authentication.
|
|
24
24
|
|
|
25
25
|
|
|
26
26
|
Read [assets/SOURCE_MAP.json](assets/SOURCE_MAP.json) for source code references.
|
|
@@ -57,7 +57,7 @@ const audioStream = await voiceAgent.voice.speak(text, {
|
|
|
57
57
|
playAudio(audioStream)
|
|
58
58
|
```
|
|
59
59
|
|
|
60
|
-
Visit the [OpenAI Voice Reference](https://mastra.ai/
|
|
60
|
+
Visit the [OpenAI Voice Reference](https://mastra.ai/integrations/voice/openai) for more information on the OpenAI voice provider.
|
|
61
61
|
|
|
62
62
|
**Azure**:
|
|
63
63
|
|
|
@@ -84,7 +84,7 @@ const audioStream = await voiceAgent.voice.speak(text, {
|
|
|
84
84
|
playAudio(audioStream)
|
|
85
85
|
```
|
|
86
86
|
|
|
87
|
-
Visit the [Azure Voice Reference](https://mastra.ai/
|
|
87
|
+
Visit the [Azure Voice Reference](https://mastra.ai/integrations/voice/azure) for more information on the Azure voice provider.
|
|
88
88
|
|
|
89
89
|
**ElevenLabs**:
|
|
90
90
|
|
|
@@ -111,34 +111,7 @@ const audioStream = await voiceAgent.voice.speak(text, {
|
|
|
111
111
|
playAudio(audioStream)
|
|
112
112
|
```
|
|
113
113
|
|
|
114
|
-
Visit the [ElevenLabs Voice Reference](https://mastra.ai/
|
|
115
|
-
|
|
116
|
-
**PlayAI**:
|
|
117
|
-
|
|
118
|
-
```typescript
|
|
119
|
-
import { Agent } from '@mastra/core/agent'
|
|
120
|
-
import { PlayAIVoice } from '@mastra/voice-playai'
|
|
121
|
-
import { playAudio } from '@mastra/node-audio'
|
|
122
|
-
|
|
123
|
-
const voiceAgent = new Agent({
|
|
124
|
-
id: 'voice-agent',
|
|
125
|
-
name: 'Voice Agent',
|
|
126
|
-
instructions: 'You are a voice assistant that can help users with their tasks.',
|
|
127
|
-
model: 'openai/gpt-5.6-sol',
|
|
128
|
-
voice: new PlayAIVoice(),
|
|
129
|
-
})
|
|
130
|
-
|
|
131
|
-
const { text } = await voiceAgent.generate('What color is the sky?')
|
|
132
|
-
|
|
133
|
-
// Convert text to speech to an Audio Stream
|
|
134
|
-
const audioStream = await voiceAgent.voice.speak(text, {
|
|
135
|
-
speaker: 'default', // Optional: specify a speaker
|
|
136
|
-
})
|
|
137
|
-
|
|
138
|
-
playAudio(audioStream)
|
|
139
|
-
```
|
|
140
|
-
|
|
141
|
-
Visit the [PlayAI Voice Reference](https://mastra.ai/reference/voice/playai) for more information on the PlayAI voice provider.
|
|
114
|
+
Visit the [ElevenLabs Voice Reference](https://mastra.ai/integrations/voice/elevenlabs) for more information on the ElevenLabs voice provider.
|
|
142
115
|
|
|
143
116
|
**Google**:
|
|
144
117
|
|
|
@@ -165,7 +138,7 @@ const audioStream = await voiceAgent.voice.speak(text, {
|
|
|
165
138
|
playAudio(audioStream)
|
|
166
139
|
```
|
|
167
140
|
|
|
168
|
-
Visit the [Google Voice Reference](https://mastra.ai/
|
|
141
|
+
Visit the [Google Voice Reference](https://mastra.ai/integrations/voice/google) for more information on the Google voice provider.
|
|
169
142
|
|
|
170
143
|
**Cloudflare**:
|
|
171
144
|
|
|
@@ -192,7 +165,7 @@ const audioStream = await voiceAgent.voice.speak(text, {
|
|
|
192
165
|
playAudio(audioStream)
|
|
193
166
|
```
|
|
194
167
|
|
|
195
|
-
Visit the [Cloudflare Voice Reference](https://mastra.ai/
|
|
168
|
+
Visit the [Cloudflare Voice Reference](https://mastra.ai/integrations/voice/cloudflare) for more information on the Cloudflare voice provider.
|
|
196
169
|
|
|
197
170
|
**Deepgram**:
|
|
198
171
|
|
|
@@ -219,7 +192,7 @@ const audioStream = await voiceAgent.voice.speak(text, {
|
|
|
219
192
|
playAudio(audioStream)
|
|
220
193
|
```
|
|
221
194
|
|
|
222
|
-
Visit the [Deepgram Voice Reference](https://mastra.ai/
|
|
195
|
+
Visit the [Deepgram Voice Reference](https://mastra.ai/integrations/voice/deepgram) for more information on the Deepgram voice provider.
|
|
223
196
|
|
|
224
197
|
**Inworld**:
|
|
225
198
|
|
|
@@ -246,7 +219,7 @@ const audioStream = await voiceAgent.voice.speak(text, {
|
|
|
246
219
|
playAudio(audioStream)
|
|
247
220
|
```
|
|
248
221
|
|
|
249
|
-
Visit the [Inworld Voice Reference](https://mastra.ai/
|
|
222
|
+
Visit the [Inworld Voice Reference](https://mastra.ai/integrations/voice/inworld) for more information on the Inworld voice provider.
|
|
250
223
|
|
|
251
224
|
**Speechify**:
|
|
252
225
|
|
|
@@ -273,7 +246,7 @@ const audioStream = await voiceAgent.voice.speak(text, {
|
|
|
273
246
|
playAudio(audioStream)
|
|
274
247
|
```
|
|
275
248
|
|
|
276
|
-
Visit the [Speechify Voice Reference](https://mastra.ai/
|
|
249
|
+
Visit the [Speechify Voice Reference](https://mastra.ai/integrations/voice/speechify) for more information on the Speechify voice provider.
|
|
277
250
|
|
|
278
251
|
**Sarvam**:
|
|
279
252
|
|
|
@@ -300,7 +273,7 @@ const audioStream = await voiceAgent.voice.speak(text, {
|
|
|
300
273
|
playAudio(audioStream)
|
|
301
274
|
```
|
|
302
275
|
|
|
303
|
-
Visit the [Sarvam Voice Reference](https://mastra.ai/
|
|
276
|
+
Visit the [Sarvam Voice Reference](https://mastra.ai/integrations/voice/sarvam) for more information on the Sarvam voice provider.
|
|
304
277
|
|
|
305
278
|
**Murf**:
|
|
306
279
|
|
|
@@ -327,7 +300,7 @@ const audioStream = await voiceAgent.voice.speak(text, {
|
|
|
327
300
|
playAudio(audioStream)
|
|
328
301
|
```
|
|
329
302
|
|
|
330
|
-
Visit the [Murf Voice Reference](https://mastra.ai/
|
|
303
|
+
Visit the [Murf Voice Reference](https://mastra.ai/integrations/voice/murf) for more information on the Murf voice provider.
|
|
331
304
|
|
|
332
305
|
### Speech to Text (STT)
|
|
333
306
|
|
|
@@ -363,7 +336,7 @@ console.log(`User said: ${transcript}`)
|
|
|
363
336
|
const { text } = await voiceAgent.generate(transcript)
|
|
364
337
|
```
|
|
365
338
|
|
|
366
|
-
Visit the [OpenAI Voice Reference](https://mastra.ai/
|
|
339
|
+
Visit the [OpenAI Voice Reference](https://mastra.ai/integrations/voice/openai) for more information on the OpenAI voice provider.
|
|
367
340
|
|
|
368
341
|
**Azure**:
|
|
369
342
|
|
|
@@ -392,7 +365,7 @@ console.log(`User said: ${transcript}`)
|
|
|
392
365
|
const { text } = await voiceAgent.generate(transcript)
|
|
393
366
|
```
|
|
394
367
|
|
|
395
|
-
Visit the [Azure Voice Reference](https://mastra.ai/
|
|
368
|
+
Visit the [Azure Voice Reference](https://mastra.ai/integrations/voice/azure) for more information on the Azure voice provider.
|
|
396
369
|
|
|
397
370
|
**ElevenLabs**:
|
|
398
371
|
|
|
@@ -420,7 +393,7 @@ console.log(`User said: ${transcript}`)
|
|
|
420
393
|
const { text } = await voiceAgent.generate(transcript)
|
|
421
394
|
```
|
|
422
395
|
|
|
423
|
-
Visit the [ElevenLabs Voice Reference](https://mastra.ai/
|
|
396
|
+
Visit the [ElevenLabs Voice Reference](https://mastra.ai/integrations/voice/elevenlabs) for more information on the ElevenLabs voice provider.
|
|
424
397
|
|
|
425
398
|
**Google**:
|
|
426
399
|
|
|
@@ -448,7 +421,7 @@ console.log(`User said: ${transcript}`)
|
|
|
448
421
|
const { text } = await voiceAgent.generate(transcript)
|
|
449
422
|
```
|
|
450
423
|
|
|
451
|
-
Visit the [Google Voice Reference](https://mastra.ai/
|
|
424
|
+
Visit the [Google Voice Reference](https://mastra.ai/integrations/voice/google) for more information on the Google voice provider.
|
|
452
425
|
|
|
453
426
|
**Cloudflare**:
|
|
454
427
|
|
|
@@ -476,7 +449,7 @@ console.log(`User said: ${transcript}`)
|
|
|
476
449
|
const { text } = await voiceAgent.generate(transcript)
|
|
477
450
|
```
|
|
478
451
|
|
|
479
|
-
Visit the [Cloudflare Voice Reference](https://mastra.ai/
|
|
452
|
+
Visit the [Cloudflare Voice Reference](https://mastra.ai/integrations/voice/cloudflare) for more information on the Cloudflare voice provider.
|
|
480
453
|
|
|
481
454
|
**Deepgram**:
|
|
482
455
|
|
|
@@ -504,7 +477,7 @@ console.log(`User said: ${transcript}`)
|
|
|
504
477
|
const { text } = await voiceAgent.generate(transcript)
|
|
505
478
|
```
|
|
506
479
|
|
|
507
|
-
Visit the [Deepgram Voice Reference](https://mastra.ai/
|
|
480
|
+
Visit the [Deepgram Voice Reference](https://mastra.ai/integrations/voice/deepgram) for more information on the Deepgram voice provider.
|
|
508
481
|
|
|
509
482
|
**Inworld**:
|
|
510
483
|
|
|
@@ -532,7 +505,7 @@ console.log(`User said: ${transcript}`)
|
|
|
532
505
|
const { text } = await voiceAgent.generate(transcript)
|
|
533
506
|
```
|
|
534
507
|
|
|
535
|
-
Visit the [Inworld Voice Reference](https://mastra.ai/
|
|
508
|
+
Visit the [Inworld Voice Reference](https://mastra.ai/integrations/voice/inworld) for more information on the Inworld voice provider.
|
|
536
509
|
|
|
537
510
|
**Sarvam**:
|
|
538
511
|
|
|
@@ -560,7 +533,7 @@ console.log(`User said: ${transcript}`)
|
|
|
560
533
|
const { text } = await voiceAgent.generate(transcript)
|
|
561
534
|
```
|
|
562
535
|
|
|
563
|
-
Visit the [Sarvam Voice Reference](https://mastra.ai/
|
|
536
|
+
Visit the [Sarvam Voice Reference](https://mastra.ai/integrations/voice/sarvam) for more information on the Sarvam voice provider.
|
|
564
537
|
|
|
565
538
|
### Speech to Speech (STS)
|
|
566
539
|
|
|
@@ -594,7 +567,7 @@ const micStream = getMicrophoneStream()
|
|
|
594
567
|
await voiceAgent.voice.send(micStream)
|
|
595
568
|
```
|
|
596
569
|
|
|
597
|
-
Visit the [OpenAI Voice Reference](https://mastra.ai/
|
|
570
|
+
Visit the [OpenAI Voice Reference](https://mastra.ai/integrations/voice/openai) for more information on the OpenAI voice provider.
|
|
598
571
|
|
|
599
572
|
**Google**:
|
|
600
573
|
|
|
@@ -643,7 +616,7 @@ const micStream = getMicrophoneStream()
|
|
|
643
616
|
await voiceAgent.voice.send(micStream)
|
|
644
617
|
```
|
|
645
618
|
|
|
646
|
-
Visit the [Google Gemini Live Reference](https://mastra.ai/
|
|
619
|
+
Visit the [Google Gemini Live Reference](https://mastra.ai/integrations/voice/google) for more information on the Google Gemini Live voice provider.
|
|
647
620
|
|
|
648
621
|
**AWS Nova Sonic**:
|
|
649
622
|
|
|
@@ -686,7 +659,7 @@ const micStream = getMicrophoneStream()
|
|
|
686
659
|
await voiceAgent.voice.send(micStream)
|
|
687
660
|
```
|
|
688
661
|
|
|
689
|
-
Visit the [AWS Nova Sonic Reference](https://mastra.ai/
|
|
662
|
+
Visit the [AWS Nova Sonic Reference](https://mastra.ai/integrations/voice/aws-nova-sonic) for more information on the AWS Nova Sonic voice provider.
|
|
690
663
|
|
|
691
664
|
**Inworld Realtime**:
|
|
692
665
|
|
|
@@ -728,7 +701,7 @@ const micStream = getMicrophoneStream()
|
|
|
728
701
|
await voiceAgent.voice.send(micStream)
|
|
729
702
|
```
|
|
730
703
|
|
|
731
|
-
Visit the [Inworld Realtime Reference](https://mastra.ai/
|
|
704
|
+
Visit the [Inworld Realtime Reference](https://mastra.ai/integrations/voice/inworld) for more information on the Inworld Realtime voice provider.
|
|
732
705
|
|
|
733
706
|
**xAI**:
|
|
734
707
|
|
|
@@ -771,11 +744,11 @@ const micStream = getMicrophoneStream()
|
|
|
771
744
|
await voiceAgent.voice.send(micStream)
|
|
772
745
|
```
|
|
773
746
|
|
|
774
|
-
Visit the [xAI Realtime Voice Reference](https://mastra.ai/
|
|
747
|
+
Visit the [xAI Realtime Voice Reference](https://mastra.ai/integrations/voice/xai) for more information on the xAI voice provider.
|
|
775
748
|
|
|
776
749
|
### Realtime voice
|
|
777
750
|
|
|
778
|
-
Run live calls a user can talk over, in the browser or over the phone. Mastra hands the audio loop to LiveKit, which covers voice activity detection, semantic turn detection, and barge-in, while your agent generates each reply with its own model, tools, and memory. For setup and configuration options, check out [Realtime voice](https://mastra.ai/
|
|
751
|
+
Run live calls a user can talk over, in the browser or over the phone. Mastra hands the audio loop to LiveKit, which covers voice activity detection, semantic turn detection, and barge-in, while your agent generates each reply with its own model, tools, and memory. For setup and configuration options, check out [Realtime voice](https://mastra.ai/integrations/voice/livekit).
|
|
779
752
|
|
|
780
753
|
## Voice configuration
|
|
781
754
|
|
|
@@ -802,7 +775,7 @@ const voice = new OpenAIVoice({
|
|
|
802
775
|
})
|
|
803
776
|
```
|
|
804
777
|
|
|
805
|
-
Visit the [OpenAI Voice Reference](https://mastra.ai/
|
|
778
|
+
Visit the [OpenAI Voice Reference](https://mastra.ai/integrations/voice/openai) for more information on the OpenAI voice provider.
|
|
806
779
|
|
|
807
780
|
**Azure**:
|
|
808
781
|
|
|
@@ -827,7 +800,7 @@ const voice = new AzureVoice({
|
|
|
827
800
|
})
|
|
828
801
|
```
|
|
829
802
|
|
|
830
|
-
Visit the [Azure Voice Reference](https://mastra.ai/
|
|
803
|
+
Visit the [Azure Voice Reference](https://mastra.ai/integrations/voice/azure) for more information on the Azure voice provider.
|
|
831
804
|
|
|
832
805
|
**ElevenLabs**:
|
|
833
806
|
|
|
@@ -845,25 +818,7 @@ const voice = new ElevenLabsVoice({
|
|
|
845
818
|
})
|
|
846
819
|
```
|
|
847
820
|
|
|
848
|
-
Visit the [ElevenLabs Voice Reference](https://mastra.ai/
|
|
849
|
-
|
|
850
|
-
**PlayAI**:
|
|
851
|
-
|
|
852
|
-
```typescript
|
|
853
|
-
// PlayAI Voice Configuration
|
|
854
|
-
const voice = new PlayAIVoice({
|
|
855
|
-
speechModel: {
|
|
856
|
-
name: 'playai-voice', // Example model name
|
|
857
|
-
speaker: 'emma', // Example speaker name
|
|
858
|
-
apiKey: process.env.PLAYAI_API_KEY,
|
|
859
|
-
language: 'en-US', // Language code
|
|
860
|
-
speed: 1.0, // Speech speed
|
|
861
|
-
},
|
|
862
|
-
// PlayAI may not have a separate listening model
|
|
863
|
-
})
|
|
864
|
-
```
|
|
865
|
-
|
|
866
|
-
Visit the [PlayAI Voice Reference](https://mastra.ai/reference/voice/playai) for more information on the PlayAI voice provider.
|
|
821
|
+
Visit the [ElevenLabs Voice Reference](https://mastra.ai/integrations/voice/elevenlabs) for more information on the ElevenLabs voice provider.
|
|
867
822
|
|
|
868
823
|
**Google**:
|
|
869
824
|
|
|
@@ -884,7 +839,7 @@ const voice = new GoogleVoice({
|
|
|
884
839
|
})
|
|
885
840
|
```
|
|
886
841
|
|
|
887
|
-
Visit the [Google Voice Reference](https://mastra.ai/
|
|
842
|
+
Visit the [Google Voice Reference](https://mastra.ai/integrations/voice/google) for more information on the Google voice provider.
|
|
888
843
|
|
|
889
844
|
**Cloudflare**:
|
|
890
845
|
|
|
@@ -902,7 +857,7 @@ const voice = new CloudflareVoice({
|
|
|
902
857
|
})
|
|
903
858
|
```
|
|
904
859
|
|
|
905
|
-
Visit the [Cloudflare Voice Reference](https://mastra.ai/
|
|
860
|
+
Visit the [Cloudflare Voice Reference](https://mastra.ai/integrations/voice/cloudflare) for more information on the Cloudflare voice provider.
|
|
906
861
|
|
|
907
862
|
**Deepgram**:
|
|
908
863
|
|
|
@@ -923,7 +878,7 @@ const voice = new DeepgramVoice({
|
|
|
923
878
|
})
|
|
924
879
|
```
|
|
925
880
|
|
|
926
|
-
Visit the [Deepgram Voice Reference](https://mastra.ai/
|
|
881
|
+
Visit the [Deepgram Voice Reference](https://mastra.ai/integrations/voice/deepgram) for more information on the Deepgram voice provider.
|
|
927
882
|
|
|
928
883
|
**Inworld**:
|
|
929
884
|
|
|
@@ -951,7 +906,7 @@ const audioStream = await voice.speak('Hello!', {
|
|
|
951
906
|
})
|
|
952
907
|
```
|
|
953
908
|
|
|
954
|
-
Visit the [Inworld Voice Reference](https://mastra.ai/
|
|
909
|
+
Visit the [Inworld Voice Reference](https://mastra.ai/integrations/voice/inworld) for more information on the Inworld voice provider.
|
|
955
910
|
|
|
956
911
|
**Speechify**:
|
|
957
912
|
|
|
@@ -969,7 +924,7 @@ const voice = new SpeechifyVoice({
|
|
|
969
924
|
})
|
|
970
925
|
```
|
|
971
926
|
|
|
972
|
-
Visit the [Speechify Voice Reference](https://mastra.ai/
|
|
927
|
+
Visit the [Speechify Voice Reference](https://mastra.ai/integrations/voice/speechify) for more information on the Speechify voice provider.
|
|
973
928
|
|
|
974
929
|
**Sarvam**:
|
|
975
930
|
|
|
@@ -989,7 +944,7 @@ const voice = new SarvamVoice({
|
|
|
989
944
|
})
|
|
990
945
|
```
|
|
991
946
|
|
|
992
|
-
Visit the [Sarvam Voice Reference](https://mastra.ai/
|
|
947
|
+
Visit the [Sarvam Voice Reference](https://mastra.ai/integrations/voice/sarvam) for more information on the Sarvam voice provider.
|
|
993
948
|
|
|
994
949
|
**Murf**:
|
|
995
950
|
|
|
@@ -1006,7 +961,7 @@ const voice = new MurfVoice({
|
|
|
1006
961
|
})
|
|
1007
962
|
```
|
|
1008
963
|
|
|
1009
|
-
Visit the [Murf Voice Reference](https://mastra.ai/
|
|
964
|
+
Visit the [Murf Voice Reference](https://mastra.ai/integrations/voice/murf) for more information on the Murf voice provider.
|
|
1010
965
|
|
|
1011
966
|
**OpenAI Realtime**:
|
|
1012
967
|
|
|
@@ -1027,7 +982,7 @@ const voice = new OpenAIRealtimeVoice({
|
|
|
1027
982
|
})
|
|
1028
983
|
```
|
|
1029
984
|
|
|
1030
|
-
For more information on the OpenAI Realtime voice provider, refer to the [OpenAI Realtime Voice Reference](https://mastra.ai/
|
|
985
|
+
For more information on the OpenAI Realtime voice provider, refer to the [OpenAI Realtime Voice Reference](https://mastra.ai/integrations/voice/openai).
|
|
1031
986
|
|
|
1032
987
|
**xAI Realtime**:
|
|
1033
988
|
|
|
@@ -1059,7 +1014,7 @@ const voice = new XAIRealtimeVoice({
|
|
|
1059
1014
|
})
|
|
1060
1015
|
```
|
|
1061
1016
|
|
|
1062
|
-
Visit the [xAI Realtime Voice Reference](https://mastra.ai/
|
|
1017
|
+
Visit the [xAI Realtime Voice Reference](https://mastra.ai/integrations/voice/xai) for more information on the xAI realtime voice provider.
|
|
1063
1018
|
|
|
1064
1019
|
**Google Gemini Live**:
|
|
1065
1020
|
|
|
@@ -1075,7 +1030,7 @@ const voice = new GeminiLiveVoice({
|
|
|
1075
1030
|
})
|
|
1076
1031
|
```
|
|
1077
1032
|
|
|
1078
|
-
Visit the [Google Gemini Live Reference](https://mastra.ai/
|
|
1033
|
+
Visit the [Google Gemini Live Reference](https://mastra.ai/integrations/voice/google) for more information on the Google Gemini Live voice provider.
|
|
1079
1034
|
|
|
1080
1035
|
**AWS Nova Sonic**:
|
|
1081
1036
|
|
|
@@ -1097,7 +1052,7 @@ const voice = new NovaSonicVoice({
|
|
|
1097
1052
|
})
|
|
1098
1053
|
```
|
|
1099
1054
|
|
|
1100
|
-
Visit the [AWS Nova Sonic Reference](https://mastra.ai/
|
|
1055
|
+
Visit the [AWS Nova Sonic Reference](https://mastra.ai/integrations/voice/aws-nova-sonic) for more information on the AWS Nova Sonic voice provider.
|
|
1101
1056
|
|
|
1102
1057
|
**Inworld Realtime**:
|
|
1103
1058
|
|
|
@@ -1117,7 +1072,7 @@ const voice = new InworldRealtimeVoice({
|
|
|
1117
1072
|
})
|
|
1118
1073
|
```
|
|
1119
1074
|
|
|
1120
|
-
Visit the [Inworld Realtime Reference](https://mastra.ai/
|
|
1075
|
+
Visit the [Inworld Realtime Reference](https://mastra.ai/integrations/voice/inworld) for more information on the Inworld Realtime voice provider.
|
|
1121
1076
|
|
|
1122
1077
|
**AI SDK**:
|
|
1123
1078
|
|
|
@@ -1145,13 +1100,13 @@ const voiceAgent = new Agent({
|
|
|
1145
1100
|
|
|
1146
1101
|
### Using multiple voice providers
|
|
1147
1102
|
|
|
1148
|
-
This example demonstrates how to create and use two different voice providers in Mastra: OpenAI for speech-to-text (STT) and
|
|
1103
|
+
This example demonstrates how to create and use two different voice providers in Mastra: OpenAI for speech-to-text (STT) and ElevenLabs for text-to-speech (TTS).
|
|
1149
1104
|
|
|
1150
1105
|
Start by creating instances of the voice providers with any necessary configuration.
|
|
1151
1106
|
|
|
1152
1107
|
```typescript
|
|
1153
1108
|
import { OpenAIVoice } from '@mastra/voice-openai'
|
|
1154
|
-
import {
|
|
1109
|
+
import { ElevenLabsVoice } from '@mastra/voice-elevenlabs'
|
|
1155
1110
|
import { CompositeVoice } from '@mastra/core/voice'
|
|
1156
1111
|
import { playAudio, getMicrophoneStream } from '@mastra/node-audio'
|
|
1157
1112
|
|
|
@@ -1163,13 +1118,8 @@ const input = new OpenAIVoice({
|
|
|
1163
1118
|
},
|
|
1164
1119
|
})
|
|
1165
1120
|
|
|
1166
|
-
// Initialize
|
|
1167
|
-
const output = new
|
|
1168
|
-
speechModel: {
|
|
1169
|
-
name: 'playai-voice',
|
|
1170
|
-
apiKey: process.env.PLAYAI_API_KEY,
|
|
1171
|
-
},
|
|
1172
|
-
})
|
|
1121
|
+
// Initialize ElevenLabs voice for TTS
|
|
1122
|
+
const output = new ElevenLabsVoice()
|
|
1173
1123
|
|
|
1174
1124
|
// Combine the providers using CompositeVoice
|
|
1175
1125
|
const voice = new CompositeVoice({
|
|
@@ -1228,12 +1178,12 @@ You can also mix AI SDK models with Mastra providers:
|
|
|
1228
1178
|
|
|
1229
1179
|
```typescript
|
|
1230
1180
|
import { CompositeVoice } from '@mastra/core/voice'
|
|
1231
|
-
import {
|
|
1181
|
+
import { ElevenLabsVoice } from '@mastra/voice-elevenlabs'
|
|
1232
1182
|
import { groq } from '@ai-sdk/groq'
|
|
1233
1183
|
|
|
1234
1184
|
const voice = new CompositeVoice({
|
|
1235
1185
|
input: groq.transcription('whisper-large-v3'), // AI SDK for STT
|
|
1236
|
-
output: new
|
|
1186
|
+
output: new ElevenLabsVoice(), // Mastra provider for TTS
|
|
1237
1187
|
})
|
|
1238
1188
|
```
|
|
1239
1189
|
|
|
@@ -1243,15 +1193,14 @@ For more information on the CompositeVoice, refer to the [CompositeVoice Referen
|
|
|
1243
1193
|
|
|
1244
1194
|
- [CompositeVoice](https://mastra.ai/reference/voice/composite-voice)
|
|
1245
1195
|
- [MastraVoice](https://mastra.ai/reference/voice/mastra-voice)
|
|
1246
|
-
- [OpenAI Voice](https://mastra.ai/
|
|
1247
|
-
- [OpenAI Realtime Voice](https://mastra.ai/
|
|
1248
|
-
- [xAI Realtime Voice](https://mastra.ai/
|
|
1249
|
-
- [Azure Voice](https://mastra.ai/
|
|
1250
|
-
- [Google Voice](https://mastra.ai/
|
|
1251
|
-
- [Google Gemini Live Voice](https://mastra.ai/
|
|
1252
|
-
- [AWS Nova Sonic Voice](https://mastra.ai/
|
|
1253
|
-
- [Deepgram Voice](https://mastra.ai/
|
|
1254
|
-
- [Inworld Voice](https://mastra.ai/
|
|
1255
|
-
- [LiveKit](https://mastra.ai/
|
|
1256
|
-
- [PlayAI Voice](https://mastra.ai/reference/voice/playai)
|
|
1196
|
+
- [OpenAI Voice](https://mastra.ai/integrations/voice/openai)
|
|
1197
|
+
- [OpenAI Realtime Voice](https://mastra.ai/integrations/voice/openai)
|
|
1198
|
+
- [xAI Realtime Voice](https://mastra.ai/integrations/voice/xai)
|
|
1199
|
+
- [Azure Voice](https://mastra.ai/integrations/voice/azure)
|
|
1200
|
+
- [Google Voice](https://mastra.ai/integrations/voice/google)
|
|
1201
|
+
- [Google Gemini Live Voice](https://mastra.ai/integrations/voice/google)
|
|
1202
|
+
- [AWS Nova Sonic Voice](https://mastra.ai/integrations/voice/aws-nova-sonic)
|
|
1203
|
+
- [Deepgram Voice](https://mastra.ai/integrations/voice/deepgram)
|
|
1204
|
+
- [Inworld Voice](https://mastra.ai/integrations/voice/inworld)
|
|
1205
|
+
- [LiveKit](https://mastra.ai/integrations/voice/livekit)
|
|
1257
1206
|
- [Voice Examples](https://github.com/mastra-ai/voice-examples)
|