---
title: "init(voice:)"
framework: appkit
role: symbol
role_heading: Initializer
path: "appkit/nsspeechsynthesizer/init(voice:)"
---

# init(voice:)

Initializes the receiver with a voice.

## Declaration

```swift
init?(voice: NSSpeechSynthesizer.VoiceName?)
```

## Parameters

- `voice`: Identifier of the voice to set as the current voice. When nil, the default voice is used. Passing in a specific voice means the initial speaking rate is determined by the synthesizer’s default speaking rate; passing nil means the speaking rate is automatically set to the rate the user specifies in Speech preferences.

## Return Value

Return Value Initialized speech synthesizer or nil when the voice identified by voiceIdentifier is not available or when there’s an allocation error.

## See Also

### Related Documentation

- [Speech Programming Topics](apple-archive/documentation/Cocoa/Conceptual/Speech.md)
- [availableVoices](appkit/nsspeechsynthesizer/availablevoices.md)
