@mastra/voice-aws-nova-sonic 0.0.0-studio-cli-20260504022012
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 +51 -0
- package/LICENSE.md +30 -0
- package/README.md +384 -0
- package/dist/docs/SKILL.md +27 -0
- package/dist/docs/assets/SOURCE_MAP.json +6 -0
- package/dist/docs/references/docs-voice-overview.md +1028 -0
- package/dist/docs/references/docs-voice-speech-to-speech.md +146 -0
- package/dist/docs/references/reference-voice-aws-nova-sonic.md +247 -0
- package/dist/index.cjs +1619 -0
- package/dist/index.cjs.map +1 -0
- package/dist/index.d.ts +269 -0
- package/dist/index.d.ts.map +1 -0
- package/dist/index.js +1615 -0
- package/dist/index.js.map +1 -0
- package/dist/types.d.ts +354 -0
- package/dist/types.d.ts.map +1 -0
- package/dist/utils/auth.d.ts +6 -0
- package/dist/utils/auth.d.ts.map +1 -0
- package/dist/utils/errors.d.ts +17 -0
- package/dist/utils/errors.d.ts.map +1 -0
- package/package.json +68 -0
|
@@ -0,0 +1,146 @@
|
|
|
1
|
+
# Speech-to-Speech capabilities in Mastra
|
|
2
|
+
|
|
3
|
+
## Introduction
|
|
4
|
+
|
|
5
|
+
Speech-to-Speech (STS) in Mastra provides a standardized interface for real-time interactions across multiple providers. STS enables continuous bidirectional audio communication through listening to events from Realtime models. Unlike separate TTS and STT operations, STS maintains an open connection that processes speech continuously in both directions.
|
|
6
|
+
|
|
7
|
+
## Configuration
|
|
8
|
+
|
|
9
|
+
- **`apiKey`**: Your OpenAI API key. Falls back to the `OPENAI_API_KEY` environment variable.
|
|
10
|
+
- **`model`**: The model ID to use for real-time voice interactions (e.g., `gpt-5.1-realtime`).
|
|
11
|
+
- **`speaker`**: The default voice ID for speech synthesis. This allows you to specify which voice to use for the speech output.
|
|
12
|
+
|
|
13
|
+
```typescript
|
|
14
|
+
const voice = new OpenAIRealtimeVoice({
|
|
15
|
+
apiKey: 'your-openai-api-key',
|
|
16
|
+
model: 'gpt-5.1-realtime',
|
|
17
|
+
speaker: 'alloy', // Default voice
|
|
18
|
+
})
|
|
19
|
+
|
|
20
|
+
// If using default settings the configuration can be simplified to:
|
|
21
|
+
const voice = new OpenAIRealtimeVoice()
|
|
22
|
+
```
|
|
23
|
+
|
|
24
|
+
## Using STS
|
|
25
|
+
|
|
26
|
+
```typescript
|
|
27
|
+
import { Agent } from '@mastra/core/agent'
|
|
28
|
+
import { OpenAIRealtimeVoice } from '@mastra/voice-openai-realtime'
|
|
29
|
+
import { playAudio, getMicrophoneStream } from '@mastra/node-audio'
|
|
30
|
+
|
|
31
|
+
const agent = new Agent({
|
|
32
|
+
id: 'agent',
|
|
33
|
+
name: 'OpenAI Realtime Agent',
|
|
34
|
+
instructions: `You are a helpful assistant with real-time voice capabilities.`,
|
|
35
|
+
model: 'openai/gpt-5.4',
|
|
36
|
+
voice: new OpenAIRealtimeVoice(),
|
|
37
|
+
})
|
|
38
|
+
|
|
39
|
+
// Connect to the voice service
|
|
40
|
+
await agent.voice.connect()
|
|
41
|
+
|
|
42
|
+
// Listen for agent audio responses
|
|
43
|
+
agent.voice.on('speaker', ({ audio }) => {
|
|
44
|
+
playAudio(audio)
|
|
45
|
+
})
|
|
46
|
+
|
|
47
|
+
// Initiate the conversation
|
|
48
|
+
await agent.voice.speak('How can I help you today?')
|
|
49
|
+
|
|
50
|
+
// Send continuous audio from the microphone
|
|
51
|
+
const micStream = getMicrophoneStream()
|
|
52
|
+
await agent.voice.send(micStream)
|
|
53
|
+
```
|
|
54
|
+
|
|
55
|
+
For integrating Speech-to-Speech capabilities with agents, refer to the [Adding Voice to Agents](https://mastra.ai/docs/agents/adding-voice) documentation.
|
|
56
|
+
|
|
57
|
+
## Google Gemini Live (Realtime)
|
|
58
|
+
|
|
59
|
+
```typescript
|
|
60
|
+
import { Agent } from '@mastra/core/agent'
|
|
61
|
+
import { GeminiLiveVoice } from '@mastra/voice-google-gemini-live'
|
|
62
|
+
import { playAudio, getMicrophoneStream } from '@mastra/node-audio'
|
|
63
|
+
|
|
64
|
+
const agent = new Agent({
|
|
65
|
+
id: 'agent',
|
|
66
|
+
name: 'Gemini Live Agent',
|
|
67
|
+
instructions: 'You are a helpful assistant with real-time voice capabilities.',
|
|
68
|
+
// Model used for text generation; voice provider handles realtime audio
|
|
69
|
+
model: 'openai/gpt-5.4',
|
|
70
|
+
voice: new GeminiLiveVoice({
|
|
71
|
+
apiKey: process.env.GOOGLE_API_KEY,
|
|
72
|
+
model: 'gemini-2.0-flash-exp',
|
|
73
|
+
speaker: 'Puck',
|
|
74
|
+
debug: true,
|
|
75
|
+
// Vertex AI option:
|
|
76
|
+
// vertexAI: true,
|
|
77
|
+
// project: 'your-gcp-project',
|
|
78
|
+
// location: 'us-central1',
|
|
79
|
+
// serviceAccountKeyFile: '/path/to/service-account.json',
|
|
80
|
+
}),
|
|
81
|
+
})
|
|
82
|
+
|
|
83
|
+
await agent.voice.connect()
|
|
84
|
+
|
|
85
|
+
agent.voice.on('speaker', ({ audio }) => {
|
|
86
|
+
playAudio(audio)
|
|
87
|
+
})
|
|
88
|
+
|
|
89
|
+
agent.voice.on('writing', ({ role, text }) => {
|
|
90
|
+
console.log(`${role}: ${text}`)
|
|
91
|
+
})
|
|
92
|
+
|
|
93
|
+
await agent.voice.speak('How can I help you today?')
|
|
94
|
+
|
|
95
|
+
const micStream = getMicrophoneStream()
|
|
96
|
+
await agent.voice.send(micStream)
|
|
97
|
+
```
|
|
98
|
+
|
|
99
|
+
Note:
|
|
100
|
+
|
|
101
|
+
- Live API requires `GOOGLE_API_KEY`. Vertex AI requires project/location and service account credentials.
|
|
102
|
+
- Events: `speaker` (audio stream), `writing` (text), `turnComplete`, `usage`, and `error`.
|
|
103
|
+
|
|
104
|
+
## AWS Nova Sonic (Realtime)
|
|
105
|
+
|
|
106
|
+
```typescript
|
|
107
|
+
import { Agent } from '@mastra/core/agent'
|
|
108
|
+
import { NovaSonicVoice } from '@mastra/voice-aws-nova-sonic'
|
|
109
|
+
import { playAudio, getMicrophoneStream } from '@mastra/node-audio'
|
|
110
|
+
|
|
111
|
+
const agent = new Agent({
|
|
112
|
+
id: 'agent',
|
|
113
|
+
name: 'Nova Sonic Agent',
|
|
114
|
+
instructions: 'You are a helpful assistant with real-time voice capabilities.',
|
|
115
|
+
// Model used for text generation; voice provider handles realtime audio
|
|
116
|
+
model: 'openai/gpt-5.4',
|
|
117
|
+
voice: new NovaSonicVoice({
|
|
118
|
+
region: 'us-east-1',
|
|
119
|
+
speaker: 'matthew',
|
|
120
|
+
// Static credentials are optional. The default AWS credential provider
|
|
121
|
+
// chain is used when none are passed.
|
|
122
|
+
}),
|
|
123
|
+
})
|
|
124
|
+
|
|
125
|
+
await agent.voice.connect()
|
|
126
|
+
|
|
127
|
+
// Assistant audio is emitted as 16-bit PCM on the `speaking` event
|
|
128
|
+
agent.voice.on('speaking', ({ audioData }) => {
|
|
129
|
+
if (audioData) playAudio(audioData)
|
|
130
|
+
})
|
|
131
|
+
|
|
132
|
+
agent.voice.on('writing', ({ role, text }) => {
|
|
133
|
+
console.log(`${role}: ${text}`)
|
|
134
|
+
})
|
|
135
|
+
|
|
136
|
+
await agent.voice.speak('How can I help you today?')
|
|
137
|
+
|
|
138
|
+
const micStream = getMicrophoneStream()
|
|
139
|
+
await agent.voice.send(micStream)
|
|
140
|
+
```
|
|
141
|
+
|
|
142
|
+
Note:
|
|
143
|
+
|
|
144
|
+
- Available regions: `us-east-1`, `us-west-2`, and `ap-northeast-1`.
|
|
145
|
+
- Authenticates through the standard AWS credential provider chain. Pass `credentials` to override.
|
|
146
|
+
- Events: `speaking` (Int16Array audio), `writing` (text with `generationStage`), `toolCall`, `interrupt`, `turnComplete`, `usage`, `session`, and `error`.
|
|
@@ -0,0 +1,247 @@
|
|
|
1
|
+
# AWS Nova Sonic voice
|
|
2
|
+
|
|
3
|
+
The `NovaSonicVoice` class provides real-time speech-to-speech capabilities backed by [AWS Bedrock Nova 2 Sonic](https://docs.aws.amazon.com/nova/latest/userguide/speech.html). It opens a bidirectional stream to the model and emits events for assistant audio, transcribed text, tool calls, turn boundaries, and interruptions.
|
|
4
|
+
|
|
5
|
+
## Usage example
|
|
6
|
+
|
|
7
|
+
```typescript
|
|
8
|
+
import { NovaSonicVoice } from '@mastra/voice-aws-nova-sonic'
|
|
9
|
+
import { playAudio, getMicrophoneStream } from '@mastra/node-audio'
|
|
10
|
+
|
|
11
|
+
// Initialize using the default AWS credential provider chain
|
|
12
|
+
const voice = new NovaSonicVoice({
|
|
13
|
+
region: 'us-east-1',
|
|
14
|
+
speaker: 'matthew',
|
|
15
|
+
})
|
|
16
|
+
|
|
17
|
+
// Or pass explicit credentials
|
|
18
|
+
const voiceWithCredentials = new NovaSonicVoice({
|
|
19
|
+
region: 'us-east-1',
|
|
20
|
+
speaker: 'tiffany',
|
|
21
|
+
credentials: {
|
|
22
|
+
accessKeyId: process.env.AWS_ACCESS_KEY_ID!,
|
|
23
|
+
secretAccessKey: process.env.AWS_SECRET_ACCESS_KEY!,
|
|
24
|
+
},
|
|
25
|
+
})
|
|
26
|
+
|
|
27
|
+
// Establish the bidirectional stream
|
|
28
|
+
await voice.connect()
|
|
29
|
+
|
|
30
|
+
// Listen for assistant audio (Int16Array PCM)
|
|
31
|
+
voice.on('speaking', ({ audioData }) => {
|
|
32
|
+
if (audioData) playAudio(audioData)
|
|
33
|
+
})
|
|
34
|
+
|
|
35
|
+
// Listen for transcribed text from the user and assistant
|
|
36
|
+
voice.on('writing', ({ text, role, generationStage }) => {
|
|
37
|
+
console.log(`${role} (${generationStage ?? 'FINAL'}): ${text}`)
|
|
38
|
+
})
|
|
39
|
+
|
|
40
|
+
// Stream microphone audio in real time
|
|
41
|
+
const microphoneStream = getMicrophoneStream()
|
|
42
|
+
await voice.send(microphoneStream)
|
|
43
|
+
|
|
44
|
+
// Disconnect when done
|
|
45
|
+
voice.close()
|
|
46
|
+
```
|
|
47
|
+
|
|
48
|
+
## Authentication
|
|
49
|
+
|
|
50
|
+
`NovaSonicVoice` uses the AWS SDK credential resolution chain when no `credentials` option is passed. Mastra calls `defaultProvider()` from `@aws-sdk/credential-provider-node`, which checks (in order) environment variables, shared credentials files, IAM role for EC2, ECS, EKS, and other standard sources.
|
|
51
|
+
|
|
52
|
+
To use static credentials, pass them on the constructor:
|
|
53
|
+
|
|
54
|
+
```typescript
|
|
55
|
+
new NovaSonicVoice({
|
|
56
|
+
region: 'us-east-1',
|
|
57
|
+
credentials: {
|
|
58
|
+
accessKeyId: process.env.AWS_ACCESS_KEY_ID!,
|
|
59
|
+
secretAccessKey: process.env.AWS_SECRET_ACCESS_KEY!,
|
|
60
|
+
sessionToken: process.env.AWS_SESSION_TOKEN,
|
|
61
|
+
},
|
|
62
|
+
})
|
|
63
|
+
```
|
|
64
|
+
|
|
65
|
+
The voice provider never logs credential values.
|
|
66
|
+
|
|
67
|
+
## Configuration
|
|
68
|
+
|
|
69
|
+
### Constructor options
|
|
70
|
+
|
|
71
|
+
**region** (`'us-east-1' | 'us-west-2' | 'ap-northeast-1'`): AWS region that hosts the Nova Sonic model. (Default: `'us-east-1'`)
|
|
72
|
+
|
|
73
|
+
**model** (`string`): Bedrock model ID for the bidirectional stream. (Default: `'amazon.nova-2-sonic-v1:0'`)
|
|
74
|
+
|
|
75
|
+
**credentials** (`AwsCredentialIdentity`): Static AWS credentials. When omitted the default AWS credential provider chain is used.
|
|
76
|
+
|
|
77
|
+
**speaker** (`string | NovaSonicVoiceConfigDetails`): Default voice for the assistant. Pass a voice ID string such as 'matthew' or an object that includes a language code and gender. (Default: `'matthew'`)
|
|
78
|
+
|
|
79
|
+
**languageCode** (`NovaSonicLanguageCode`): Language code used for the session. Polyglot voices support all listed languages.
|
|
80
|
+
|
|
81
|
+
**instructions** (`string`): System prompt sent at session start. Equivalent to calling addInstructions() before connect().
|
|
82
|
+
|
|
83
|
+
**tools** (`NovaSonicToolConfig[]`): Tools exposed to the model. When the voice instance is attached to an Agent, the Agent's tools are added automatically.
|
|
84
|
+
|
|
85
|
+
**sessionConfig** (`NovaSonicSessionConfig`): Inference, turn-detection, and tool-choice configuration. See Session configuration below.
|
|
86
|
+
|
|
87
|
+
**debug** (`boolean`): Enable verbose logging for stream events. Sensitive fields are masked. (Default: `false`)
|
|
88
|
+
|
|
89
|
+
### Session configuration
|
|
90
|
+
|
|
91
|
+
`sessionConfig` controls inference parameters and turn-taking behavior. All fields are optional.
|
|
92
|
+
|
|
93
|
+
**inferenceConfiguration** (`object`): Sampling and decoding parameters.
|
|
94
|
+
|
|
95
|
+
**inferenceConfiguration.maxTokens** (`number`): Maximum tokens generated per turn.
|
|
96
|
+
|
|
97
|
+
**inferenceConfiguration.temperature** (`number`): Sampling temperature.
|
|
98
|
+
|
|
99
|
+
**inferenceConfiguration.topP** (`number`): Nucleus sampling probability.
|
|
100
|
+
|
|
101
|
+
**inferenceConfiguration.topK** (`number`): Top-k sampling.
|
|
102
|
+
|
|
103
|
+
**inferenceConfiguration.stopSequences** (`string[]`): Sequences that end generation.
|
|
104
|
+
|
|
105
|
+
**turnDetectionConfiguration** (`object`): Endpointing sensitivity for turn detection.
|
|
106
|
+
|
|
107
|
+
**turnDetectionConfiguration.endpointingSensitivity** (`'HIGH' | 'MEDIUM' | 'LOW'`): Pause duration before the model considers a turn complete. HIGH ends turns fastest (about 1.5s pause), MEDIUM is balanced (about 1.75s), LOW waits longest (about 2s).
|
|
108
|
+
|
|
109
|
+
**toolChoice** (`'auto' | 'any' | { tool: { name: string } }`): How the model decides whether to call a tool.
|
|
110
|
+
|
|
111
|
+
**enableKnowledgeGrounding** (`boolean`): Enable retrieval-augmented grounding against a Bedrock knowledge base.
|
|
112
|
+
|
|
113
|
+
**knowledgeBaseConfig** (`{ knowledgeBaseId?: string; dataSourceId?: string }`): Knowledge base used when knowledge grounding is enabled.
|
|
114
|
+
|
|
115
|
+
## Methods
|
|
116
|
+
|
|
117
|
+
### `connect()`
|
|
118
|
+
|
|
119
|
+
Opens the bidirectional stream to AWS Bedrock and sends the initial session, prompt, and system events. Call this before `speak`, `listen`, or `send`.
|
|
120
|
+
|
|
121
|
+
**options** (`{ requestContext?: RequestContext }`): Optional request context propagated to tool calls made during the session.
|
|
122
|
+
|
|
123
|
+
Returns: `Promise<void>`
|
|
124
|
+
|
|
125
|
+
### `speak()`
|
|
126
|
+
|
|
127
|
+
Synthesizes speech for a text prompt and emits `speaking` events as audio is produced.
|
|
128
|
+
|
|
129
|
+
**input** (`string | NodeJS.ReadableStream`): Text or text stream to synthesize.
|
|
130
|
+
|
|
131
|
+
**options** (`NovaSonicVoiceOptions`): Per-call overrides such as the speaker or language code.
|
|
132
|
+
|
|
133
|
+
Returns: `Promise<void>`
|
|
134
|
+
|
|
135
|
+
### `send()`
|
|
136
|
+
|
|
137
|
+
Streams microphone audio (or any PCM source) to the model. Use this for live, continuous conversation.
|
|
138
|
+
|
|
139
|
+
**audioData** (`NodeJS.ReadableStream | Int16Array`): 16-bit PCM audio to forward to the model.
|
|
140
|
+
|
|
141
|
+
Returns: `Promise<void>`
|
|
142
|
+
|
|
143
|
+
### `listen()`
|
|
144
|
+
|
|
145
|
+
Convenience wrapper that delegates to `send()`. Use it when you want a single transcription pass over a finite audio stream.
|
|
146
|
+
|
|
147
|
+
**audioData** (`NodeJS.ReadableStream`): Audio stream to transcribe.
|
|
148
|
+
|
|
149
|
+
Returns: `Promise<void>`
|
|
150
|
+
|
|
151
|
+
### `endAudioInput()`
|
|
152
|
+
|
|
153
|
+
Signals the end of the current audio turn so the model can finalize its response. Call this when the user stops speaking and the provider is not configured for server-side turn detection.
|
|
154
|
+
|
|
155
|
+
Returns: `Promise<void>`
|
|
156
|
+
|
|
157
|
+
### `addInstructions()`
|
|
158
|
+
|
|
159
|
+
Updates the system prompt for the active session.
|
|
160
|
+
|
|
161
|
+
**instructions** (`string`): System prompt to apply to the session.
|
|
162
|
+
|
|
163
|
+
Returns: `void`
|
|
164
|
+
|
|
165
|
+
### `addTools()`
|
|
166
|
+
|
|
167
|
+
Registers tools with the voice instance. When `NovaSonicVoice` is attached to an Agent, the Agent's tools are added automatically.
|
|
168
|
+
|
|
169
|
+
**tools** (`ToolsInput`): Tools exposed to the model.
|
|
170
|
+
|
|
171
|
+
Returns: `void`
|
|
172
|
+
|
|
173
|
+
### `getSpeakers()`
|
|
174
|
+
|
|
175
|
+
Returns the list of voices supported by Nova 2 Sonic.
|
|
176
|
+
|
|
177
|
+
Returns: `Promise<Array<{ voiceId: string; name: string; language: string; locale: string; gender: 'masculine' | 'feminine'; polyglot: boolean }>>`
|
|
178
|
+
|
|
179
|
+
### `getListener()`
|
|
180
|
+
|
|
181
|
+
Returns whether the voice instance currently holds an open stream.
|
|
182
|
+
|
|
183
|
+
Returns: `Promise<{ enabled: boolean }>`
|
|
184
|
+
|
|
185
|
+
### `close()`
|
|
186
|
+
|
|
187
|
+
Closes the bidirectional stream and destroys the underlying Bedrock client. Call this when the conversation ends.
|
|
188
|
+
|
|
189
|
+
Returns: `void`
|
|
190
|
+
|
|
191
|
+
### `on()` / `off()`
|
|
192
|
+
|
|
193
|
+
Registers and removes event listeners. See [Voice events](https://mastra.ai/reference/voice/voice.events) for the shared event API.
|
|
194
|
+
|
|
195
|
+
## Events
|
|
196
|
+
|
|
197
|
+
`NovaSonicVoice` emits the following events:
|
|
198
|
+
|
|
199
|
+
**speaking** (`event`): Assistant audio chunk. Callback receives { audioData: Int16Array, sampleRate?: number }.
|
|
200
|
+
|
|
201
|
+
**writing** (`event`): Transcribed text from the user or assistant. Callback receives { text: string, role: 'assistant' | 'user', generationStage?: 'SPECULATIVE' | 'FINAL' }.
|
|
202
|
+
|
|
203
|
+
**toolCall** (`event`): Model requested a tool call. Callback receives { name: string, args: Record\<string, any>, id: string }.
|
|
204
|
+
|
|
205
|
+
**interrupt** (`event`): User or model interrupted the current turn. Callback receives { type: 'user' | 'model', timestamp: number }.
|
|
206
|
+
|
|
207
|
+
**turnComplete** (`event`): Model finished its turn. Callback receives { timestamp: number }.
|
|
208
|
+
|
|
209
|
+
**session** (`event`): Session state transition. Callback receives { state: 'connecting' | 'connected' | 'disconnected' | 'disconnecting' | 'error' }.
|
|
210
|
+
|
|
211
|
+
**usage** (`event`): Token usage for the turn. Callback receives { inputTokens: number, outputTokens: number, totalTokens: number }.
|
|
212
|
+
|
|
213
|
+
**error** (`event`): Stream or provider error. Callback receives { message: string, code?: string, details?: unknown }.
|
|
214
|
+
|
|
215
|
+
`generationStage` distinguishes provisional transcripts (`'SPECULATIVE'`) from finalized ones (`'FINAL'`). Use `'FINAL'` text for persistent storage and `'SPECULATIVE'` text for live captions.
|
|
216
|
+
|
|
217
|
+
## Available voices
|
|
218
|
+
|
|
219
|
+
Nova 2 Sonic ships voices in ten locales. Tiffany and Matthew are polyglot and can speak any supported language.
|
|
220
|
+
|
|
221
|
+
| Voice ID | Name | Language | Locale | Gender | Polyglot |
|
|
222
|
+
| ---------- | -------- | ---------- | ------ | --------- | -------- |
|
|
223
|
+
| `tiffany` | Tiffany | English | en-US | feminine | yes |
|
|
224
|
+
| `matthew` | Matthew | English | en-US | masculine | yes |
|
|
225
|
+
| `amy` | Amy | English | en-GB | feminine | no |
|
|
226
|
+
| `olivia` | Olivia | English | en-AU | feminine | no |
|
|
227
|
+
| `kiara` | Kiara | English | en-IN | feminine | no |
|
|
228
|
+
| `arjun` | Arjun | English | en-IN | masculine | no |
|
|
229
|
+
| `ambre` | Ambre | French | fr-FR | feminine | no |
|
|
230
|
+
| `florian` | Florian | French | fr-FR | masculine | no |
|
|
231
|
+
| `beatrice` | Beatrice | Italian | it-IT | feminine | no |
|
|
232
|
+
| `lorenzo` | Lorenzo | Italian | it-IT | masculine | no |
|
|
233
|
+
| `tina` | Tina | German | de-DE | feminine | no |
|
|
234
|
+
| `lennart` | Lennart | German | de-DE | masculine | no |
|
|
235
|
+
| `lupe` | Lupe | Spanish | es-US | feminine | no |
|
|
236
|
+
| `carlos` | Carlos | Spanish | es-US | masculine | no |
|
|
237
|
+
| `carolina` | Carolina | Portuguese | pt-BR | feminine | no |
|
|
238
|
+
| `leo` | Leo | Portuguese | pt-BR | masculine | no |
|
|
239
|
+
| `kiara` | Kiara | Hindi | hi-IN | feminine | no |
|
|
240
|
+
| `arjun` | Arjun | Hindi | hi-IN | masculine | no |
|
|
241
|
+
|
|
242
|
+
## Notes
|
|
243
|
+
|
|
244
|
+
- Audio is streamed as 16-bit PCM. Assistant audio is emitted as `Int16Array` on the `speaking` event.
|
|
245
|
+
- The voice instance must call `connect()` before any other streaming method.
|
|
246
|
+
- `close()` destroys the underlying `BedrockRuntimeClient` to release the HTTP/2 session.
|
|
247
|
+
- Nova 2 Sonic is available in `us-east-1`, `us-west-2`, and `ap-northeast-1`. Other regions throw a configuration error during construction.
|