Inherits from NSObject
Declared in ISSpeechSynthesis.h

Overview

The interface for doing speech synthesis in the SDK.

Tasks

Getting and Setting the Delegate

  •   delegate

    The delegate of a speech synthesis object.

    property

Configuration Properties

  •   voice

    Sets the voice to use for this speech synthesis instance.

    property
  •   speed

    Sets the speed to use for speech synthesis.

    property
  •   bitrate

    The bitrate of the synthesised speech.

    property
  •   resumesAfterInterruption

    Sets whether playback will resume after an interruption.

    property
  •   text

    The text to speak.

    property

Creating an Instance

Speaking Text

  • – speak:

    Speak the text that was specified when creating this instance.

  • – speakWithHandler:

    Speak the text that was specified when creating this instance.

  • – cancel

    Cancels an in-progress speech synthesis action.

Properties

bitrate

The bitrate of the synthesised speech.

@property (nonatomic, assign) NSInteger bitrate

Discussion

The higher the bitrate, the better quality the audio, but the larger the file size of the data being sent, which results in more buffering needed to load all that data. Default value is 48, which is sutable for WiFi, 4G, and 3G.

Valid values include 8, 16, 24, 32, 48, 56, 64, 80, 96, 112, 128, 144, 160, 192, 224, 256, and 320, as well as any others listed under “Bit Rates” for an API key’s Text-to-Speech Settings.

Declared In

ISSpeechSynthesis.h

delegate

The delegate of a speech synthesis object.

@property (nonatomic, unsafe_unretained) id<ISSpeechSynthesisDelegate> delegate

Discussion

The delegate must adopt the ISSpeechSynthesisDelegate protocol.

Declared In

ISSpeechSynthesis.h

resumesAfterInterruption

Sets whether playback will resume after an interruption.

@property (nonatomic, assign) BOOL resumesAfterInterruption

Discussion

To keep behavior consistent with older versions of the SDK, by default, this is set to NO.

Declared In

ISSpeechSynthesis.h

speed

Sets the speed to use for speech synthesis.

@property (nonatomic, assign) NSInteger speed

Discussion

This should be a number anywhere between -10 and 10, with -10 being the slowest, and 10 being the fastest. If you provide a number larger than 10, the speed will be set to 10. Likewise, if you provide a number smaller than -10, the speed will be set to -10.

Declared In

ISSpeechSynthesis.h

text

The text to speak.

@property (nonatomic, copy) NSString *text

Declared In

ISSpeechSynthesis.h

voice

Sets the voice to use for this speech synthesis instance.

@property (nonatomic, copy) NSString *voice

Discussion

Voices are listed in the ISSpeechSynthesisVoices.h header file. You are not limited to that list; they are only standard voices. If you specify an invalid voice, the delegate will get an error.

Declared In

ISSpeechSynthesis.h

Instance Methods

cancel

Cancels an in-progress speech synthesis action.

- (void)cancel

Declared In

ISSpeechSynthesis.h

initWithText:

Create a new ISSpeechSynthesis object with the supplied text.

- (id)initWithText:(NSString *)text

Parameters

text

The initial text for the speech synthesis object.

Declared In

ISSpeechSynthesis.h

speak:

Speak the text that was specified when creating this instance.

- (BOOL)speak:(NSError **)err

Parameters

err

An NSError pointer to get an error object out of the method if something goes wrong.

Return Value

Whether synthesis successfully started. If this returns NO, check the error for details on what went wrong.

Declared In

ISSpeechSynthesis.h

speakWithHandler:

Speak the text that was specified when creating this instance.

- (void)speakWithHandler:(ISSpeechSynthesisHandler)handler

Parameters

handler

A ISSpeechSynthesisHandler block to be executed when speaking finishes, or when an error occurs. This handler will be called on the main thread.

Declared In

ISSpeechSynthesis.h