<!--
{
  "availability" : [
    "macOS: 10.3.0 - 14.0.0"
  ],
  "documentType" : "symbol",
  "framework" : "AppKit",
  "identifier" : "/documentation/AppKit/NSSpeechSynthesizer",
  "metadataVersion" : "0.1.0",
  "role" : "Class",
  "symbol" : {
    "kind" : "Class",
    "modules" : [
      "AppKit"
    ],
    "preciseIdentifier" : "c:objc(cs)NSSpeechSynthesizer"
  },
  "title" : "NSSpeechSynthesizer"
}
-->

# NSSpeechSynthesizer

The Cocoa interface to speech synthesis in macOS.

```
class NSSpeechSynthesizer
```

## Overview

Speech synthesis, also called text-to-speech (TTS), parses text and converts it into audible speech. It offers a concurrent feedback mode that can be used in concert with or in place of traditional visual and aural notifications. For example, your application can use a speech synthesizer object to “pronounce” the text of important alert dialogs. Synthesized speech has several advantages. It can provide urgent information to users without forcing them to shift attention from their current task. And because speech doesn’t rely on visual elements for meaning, it is a crucial technology for users with vision or attention disabilities.

In addition, synthesized speech can help save system resources. Because sound samples can take up large amounts of room on disk, using text in place of sampled sound is extremely efficient, and so a multimedia application might use an [`NSSpeechSynthesizer`](/documentation/AppKit/NSSpeechSynthesizer) object to provide a narration of a QuickTime movie instead of including sampled-sound data on a movie track.

When you create an [`NSSpeechSynthesizer`](/documentation/AppKit/NSSpeechSynthesizer) instance using the default initializer (`init`), the class uses the **default voice** selected in System Preferences > Speech. Alternatively, you can select a specific voice for an [`NSSpeechSynthesizer`](/documentation/AppKit/NSSpeechSynthesizer) instance by initializing it with [`init(voice:)`](/documentation/AppKit/NSSpeechSynthesizer/init(voice:)). To begin synthesis, send either [`startSpeaking(_:)`](/documentation/AppKit/NSSpeechSynthesizer/startSpeaking(_:)) or [`startSpeaking(_:to:)`](/documentation/AppKit/NSSpeechSynthesizer/startSpeaking(_:to:)) to the instance. The former generates speech through the system’s default sound output device; the latter saves the generated speech to a file. If you wish to be notified when the current speech concludes, set the [`delegate`](/documentation/AppKit/NSSpeechSynthesizer/delegate) property and implement the delegate method [`speechSynthesizer(_:didFinishSpeaking:)`](/documentation/AppKit/NSSpeechSynthesizerDelegate/speechSynthesizer(_:didFinishSpeaking:)).

Speech synthesis is just one of the macOS speech technologies. The speech recognizer technology allows applications to “listen to” text spoken in U.S. English; the [`NSSpeechRecognizer`](/documentation/AppKit/NSSpeechRecognizer) class is the Cocoa interface to this technology. Both technologies provide benefits for all users, and are particularly useful to those users who have difficulties seeing the screen or using the mouse and keyboard.

### Speech Feedback Window

The speech feedback window ([Figure 1](/documentation/appkit/nsspeechsynthesizer#1965715)) displays the text recognized from the user’s speech and the text from which an `NSSpeechSynthesizer` object synthesizes speech. Using the feedback window makes spoken exchange more natural and helps the user understand the synthesized speech.

![](images/com.apple.appkit/media-1965715.jpg)

For example, your application may use an [`NSSpeechRecognizer`](/documentation/AppKit/NSSpeechRecognizer) object to listen for the command “Play some music.” When it recognizes this command, your application might then respond by speaking “Which artist?” using a speech synthesizer.

When `UsesFeedbackWindow` is <doc://com.apple.documentation/documentation/Swift/true>, the speech synthesizer uses the feedback window if its visible, which the user specifies in System Preferences > Speech.

## Topics

### Creating a Speech Synthesizer

[`-  initWithVoice:`](/documentation/AppKit/NSSpeechSynthesizer/init(voice:))

Initializes the receiver with a voice.

### Customizing the Speech Synthesizer Behavior

[`delegate`](/documentation/AppKit/NSSpeechSynthesizer/delegate)

The synthesizer’s delegate.

[`NSSpeechSynthesizerDelegate`](/documentation/AppKit/NSSpeechSynthesizerDelegate)

A set of optional methods implemented by delegates of [`NSSpeechSynthesizer`](/documentation/AppKit/NSSpeechSynthesizer) objects.

### Configuring Speech Synthesizers

[`usesFeedbackWindow`](/documentation/AppKit/NSSpeechSynthesizer/usesFeedbackWindow)

Indicates whether the receiver uses the speech feedback window.

[`-  voice`](/documentation/AppKit/NSSpeechSynthesizer/voice())

Returns the identifier of the receiver’s current voice.

[`-  setVoice:`](/documentation/AppKit/NSSpeechSynthesizer/setVoice(_:))

Sets the receiver’s current voice.

[`rate`](/documentation/AppKit/NSSpeechSynthesizer/rate)

The synthesizer’s speaking rate (words per minute).

[`volume`](/documentation/AppKit/NSSpeechSynthesizer/volume)

The synthesizer’s speaking volume.

### Configuring Speech Attributes

[`-  addSpeechDictionary:`](/documentation/AppKit/NSSpeechSynthesizer/addSpeechDictionary(_:))

Registers the given speech dictionary with the receiver.

[`DictionaryKey`](/documentation/AppKit/NSSpeechSynthesizer/DictionaryKey)

These constants identify key-value pairs used to add vocabulary to the dictionary using [`addSpeechDictionary(_:)`](/documentation/AppKit/NSSpeechSynthesizer/addSpeechDictionary(_:)).

[`-  objectForProperty:error:`](/documentation/AppKit/NSSpeechSynthesizer/object(forProperty:))

Provides the value of a receiver’s property.

[`-  setObject:forProperty:error:`](/documentation/AppKit/NSSpeechSynthesizer/setObject(_:forProperty:))

Specifies the value of a receiver’s property.

[`SpeechPropertyKey`](/documentation/AppKit/NSSpeechSynthesizer/SpeechPropertyKey)

These constants are used with [`setObject(_:forProperty:)`](/documentation/AppKit/NSSpeechSynthesizer/setObject(_:forProperty:)) and [`object(forProperty:)`](/documentation/AppKit/NSSpeechSynthesizer/object(forProperty:)) to get or set the characteristics of a synthesizer.

[`CommandDelimiterKey`](/documentation/AppKit/NSSpeechSynthesizer/SpeechPropertyKey/CommandDelimiterKey)

Keys for the command delimiters.

[`ErrorKey`](/documentation/AppKit/NSSpeechSynthesizer/SpeechPropertyKey/ErrorKey)

Keys that identify errors that may occur during speech synthesis.

[`Mode`](/documentation/AppKit/NSSpeechSynthesizer/SpeechPropertyKey/Mode)

Keys for the speaking mode.

[`PhonemeInfoKey`](/documentation/AppKit/NSSpeechSynthesizer/SpeechPropertyKey/PhonemeInfoKey)

Keys for the speech phoneme information.

[`StatusKey`](/documentation/AppKit/NSSpeechSynthesizer/SpeechPropertyKey/StatusKey)

Keys for the speech synthesizier status.

[`SynthesizerInfoKey`](/documentation/AppKit/NSSpeechSynthesizer/SpeechPropertyKey/SynthesizerInfoKey)

Keys for the speech synthesizier information.

[`VoiceGender`](/documentation/AppKit/NSSpeechSynthesizer/VoiceGender)

The following constants define voice gender attributes, which are the allowable values of the [`gender`](/documentation/AppKit/NSSpeechSynthesizer/VoiceAttributeKey/gender) key returned by [`attributes(forVoice:)`](/documentation/AppKit/NSSpeechSynthesizer/attributes(forVoice:)).

### Getting Speech Synthesizer Information

[`availableVoices`](/documentation/AppKit/NSSpeechSynthesizer/availableVoices)

Provides the identifiers of the voices available on the system.

[`+  attributesForVoice:`](/documentation/AppKit/NSSpeechSynthesizer/attributes(forVoice:))

Provides the attribute dictionary of a voice.

[`defaultVoice`](/documentation/AppKit/NSSpeechSynthesizer/defaultVoice)

Provides the identifier of the default voice.

[`VoiceName`](/documentation/AppKit/NSSpeechSynthesizer/VoiceName)

[`VoiceAttributeKey`](/documentation/AppKit/NSSpeechSynthesizer/VoiceAttributeKey)

The following constants are keys for the dictionary returned by [`attributes(forVoice:)`](/documentation/AppKit/NSSpeechSynthesizer/attributes(forVoice:)).

### Getting Speech State

[`anyApplicationSpeaking`](/documentation/AppKit/NSSpeechSynthesizer/isAnyApplicationSpeaking)

A Boolean value indicating whether any application is currently speaking through the sound output device.

### Synthesizing Speech

[`speaking`](/documentation/AppKit/NSSpeechSynthesizer/isSpeaking)

Indicates whether the receiver is currently generating synthesized speech.

[`-  startSpeakingString:`](/documentation/AppKit/NSSpeechSynthesizer/startSpeaking(_:))

Begins speaking synthesized text through the system’s default sound output device.

[`-  startSpeakingString:toURL:`](/documentation/AppKit/NSSpeechSynthesizer/startSpeaking(_:to:))

Begins synthesizing text into a sound (AIFF) file.

[`-  pauseSpeakingAtBoundary:`](/documentation/AppKit/NSSpeechSynthesizer/pauseSpeaking(at:))

Pauses synthesis in progress at a given boundary.

[`-  continueSpeaking`](/documentation/AppKit/NSSpeechSynthesizer/continueSpeaking())

Resumes synthesis.

[`-  stopSpeaking`](/documentation/AppKit/NSSpeechSynthesizer/stopSpeaking())

Stops synthesis in progress.

[`-  stopSpeakingAtBoundary:`](/documentation/AppKit/NSSpeechSynthesizer/stopSpeaking(at:))

Stops synthesis in progress at a given boundary.

[`Boundary`](/documentation/AppKit/NSSpeechSynthesizer/Boundary)

These constants are used to indicate where speech should be stopped and paused. See [`pauseSpeaking(at:)`](/documentation/AppKit/NSSpeechSynthesizer/pauseSpeaking(at:)) and [`stopSpeaking(at:)`](/documentation/AppKit/NSSpeechSynthesizer/stopSpeaking(at:)).

### Getting Phonemes

[`-  phonemesFromText:`](/documentation/AppKit/NSSpeechSynthesizer/phonemes(from:))

Provides the phoneme symbols generated by the given text.

## Relationships

### Conforms To

[`NSObjectProtocol`](/documentation/ObjectiveC/NSObjectProtocol)

[`CustomDebugStringConvertible`](/documentation/Swift/CustomDebugStringConvertible)

[`CVarArg`](/documentation/Swift/CVarArg)

[`CustomStringConvertible`](/documentation/Swift/CustomStringConvertible)

[`Equatable`](/documentation/Swift/Equatable)

[`Hashable`](/documentation/Swift/Hashable)

### Inherits From

[`NSObject-swift.class`](/documentation/ObjectiveC/NSObject-swift.class)

---

Copyright &copy; 2026 Apple Inc. All rights reserved. | [Terms of Use](https://www.apple.com/legal/internet-services/terms/site.html) | [Privacy Policy](https://www.apple.com/privacy/privacy-policy)