> ## Documentation Index
> Fetch the complete documentation index at: https://docs.zeroruntime.ai/llms.txt
> Use this file to discover all available pages before exploring further.

# Google

> JavaScript API reference for the google text-to-speech plugin.

## GoogleTTS

Google Cloud text-to-speech (TTS) provider.

The `model` family must be consistent with `voice`; mismatches throw, and
an unknown family is passed through (routing falls back to the voice name).

### Constructor

```typescript theme={null}
new GoogleTTS(opts: GoogleTTSOptions)
```

<ParamField path="apiKey" type="string | null">
  Google API key. Falls back to the `GOOGLE_API_KEY` environment variable, then `null`.
</ParamField>

<ParamField path="credentialsJson" type="string | null">
  Service-account credentials as a JSON string. Default `null`.
</ParamField>

<ParamField path="serviceAccountPath" type="string | null">
  Path to a service-account JSON key file. Default `null`.
</ParamField>

<ParamField path="stream" type="boolean">
  Stream audio from the model. Default `true`.
</ParamField>

<ParamField path="voice" type="string">
  Voice name to synthesize with (e.g. `'en-US-Neural2-F'`). Default `'en-US-Neural2-F'`.
</ParamField>

<ParamField path="languageCode" type="string">
  BCP-47 language code. Default `'en-US'`.
</ParamField>

<ParamField path="model" type="GoogleTTSModel | string">
  Voice model family (e.g. `'neural2'`, `'wavenet'`, `'chirp3-hd'`). Must match the voice's family; omit (default `''`) to let the voice decide. Known families: standard, wavenet, neural2, news, polyglot, studio, chirp, chirp-hd, chirp3-hd.
</ParamField>

<ParamField path="sampleRate" type="number">
  Output audio sample rate in Hz. Default `24000`.
</ParamField>

<ParamField path="speakingRate" type="number | null">
  Speaking rate (1.0 = normal). Must be in `[0.25, 4.0]`. Default `null` (provider default).
</ParamField>

<ParamField path="pitch" type="number | null">
  Voice pitch in semitones (0 = normal). Must be in `[-20.0, 20.0]`. Default `null` (provider default).
</ParamField>

<ParamField path="voiceConfig" type="GoogleVoiceConfig | null">
  Voice selection used as a fallback for `voice` and `languageCode` when those are left at their defaults. Default `null`.
</ParamField>

### close

```typescript theme={null}
close(): Promise<void>
```

Release any resources held by the provider.

### closeEmitter

```typescript theme={null}
closeEmitter(): Promise<void>
```

Close the emitter: drop all handlers and stop emitting. Waits up to 2 seconds
for in-flight async handlers to settle before returning.

### emit

```typescript theme={null}
emit(event: string, ...args: any[]): void
```

<ParamField path="event" type="string" required />

### getRuntimeConfig

```typescript theme={null}
getRuntimeConfig(): Record<string, any>
```

<ResponseField name="returns" type="Record<string, any>" />

### interrupt

```typescript theme={null}
interrupt(): Promise<void>
```

Stop the current synthesis.

### listenerCount

```typescript theme={null}
listenerCount(event: string): number
```

<ParamField path="event" type="string" required />

<ResponseField name="returns" type="number" />

### off

```typescript theme={null}
off(event: string, handler: EventHandler): void
```

<ParamField path="event" type="string" required />

<ParamField path="handler" type="EventHandler" required />

### on

```typescript theme={null}
on(event: string, handler: EventHandler): EventHandler
```

<ParamField path="event" type="string" required />

<ParamField path="handler" type="EventHandler" required />

<ResponseField name="returns" type="EventHandler" />

### once

```typescript theme={null}
once(event: string, handler: EventHandler): EventHandler
```

<ParamField path="event" type="string" required />

<ParamField path="handler" type="EventHandler" required />

<ResponseField name="returns" type="EventHandler" />

### onFirstAudioByte

```typescript theme={null}
onFirstAudioByte(callback: FirstAudioByteCallback): void
```

Register a callback fired when the first synthesized audio byte is emitted.

<ParamField path="callback" type="FirstAudioByteCallback" required />

### removeAllListeners

```typescript theme={null}
removeAllListeners(event?: string): void
```

<ParamField path="event" type="string" />

### synthesize

```typescript theme={null}
synthesize(text: any, ..._extra: any[]): Promise<void>
```

Synthesize and speak `text` on the active session.

<ParamField path="text" type="any" required />

***

## GoogleTTSModel

Supported Google Cloud TTS voice model families.

```typescript theme={null}
type GoogleTTSModel = | 'chirp3-hd' | 'chirp-hd' | 'studio' | 'neural2' | 'wavenet' | 'standard' | 'news' | 'polyglot' | 'chirp'
```
