Platforms to show: All Mac Windows Linux Cross-Platform

NSSpeechSynthesizerMBS class

Type Topic Plugin Version macOS Windows Linux iOS Targets
class Speech MBS MacCocoa Plugin 6.4 ✅ Yes ❌ No ❌ No ❌ No Desktop, Console & Web
The class to handle the cocoa speech synthesizing.
Example
// speak a text and also save it as audio file
// Speech is a property of the window, so it stays alive while speaking:
// Speech As NSSpeechSynthesizerMBS

Speech = New NSSpeechSynthesizerMBS
Speech.rate = 180 // words per minute

If Not Speech.StartSpeakingString("Hello from Xojo!") Then
MessageBox "Failed to speak."
End If

// render to a sound file with a second synthesizer
Var file As FolderItem = SpecialFolder.Desktop.Child("hello.aiff")
Var s As New NSSpeechSynthesizerMBS
Call s.StartSpeakingString("Hello from Xojo!", file)

Available in Mac OS X v10.3 and later.

More details on Apple's website:
https://developer.apple.com/library/mac/documentation/Cocoa/Reference/ApplicationKit/Classes/NSSpeechSynthesizer_Class/

Constants

Constant Value Description
NSSpeechImmediateBoundary 0 One of the constants for the pauseSpeakingAtBoundary method. Mac OS X 10.5 only.
NSSpeechSentenceBoundary 2 One of the constants for the pauseSpeakingAtBoundary method. Mac OS X 10.5 only.
NSSpeechWordBoundary 1 One of the constants for the pauseSpeakingAtBoundary method. Mac OS X 10.5 only.

This class has no subclasses.

Blog Entries

Some examples using this class:

Some related classes:


The items on this page are in the following plugins: MBS MacCocoa Plugin.


NSSpeechRecognizerMBS   -   NSSpellCheckerMBS


The biggest plugin in space...