次の方法で共有


TextToSpeech Class

Definition

Synthesizes speech from text for immediate playback or to create a sound file.

[Android.Runtime.Register("android/speech/tts/TextToSpeech", DoNotGenerateAcw=true)]
public class TextToSpeech : Java.Lang.Object
[<Android.Runtime.Register("android/speech/tts/TextToSpeech", DoNotGenerateAcw=true)>]
type TextToSpeech = class
    inherit Object
Inheritance
TextToSpeech
Attributes

Remarks

Synthesizes speech from text for immediate playback or to create a sound file.

A TextToSpeech instance can only be used to synthesize text once it has completed its initialization. Implement the TextToSpeech.OnInitListener to be notified of the completion of the initialization.<br> When you are done using the TextToSpeech instance, call the #shutdown() method to release the native resources used by the TextToSpeech engine.

Apps targeting Android 11 that use text-to-speech should declare TextToSpeech.Engine#INTENT_ACTION_TTS_SERVICE in the queries elements of their manifest:

&lt;queries&gt;
              ...
             &lt;intent&gt;
                 &lt;action android:name="android.intent.action.TTS_SERVICE" /&gt;
             &lt;/intent&gt;
            &lt;/queries&gt;

Java documentation for android.speech.tts.TextToSpeech.

Portions of this page are modifications based on work created and shared by the Android Open Source Project and used according to terms described in the Creative Commons 2.5 Attribution License.

Constructors

TextToSpeech(Context, TextToSpeech+IOnInitListener, String)

The constructor for the TextToSpeech class, using the default TTS engine.

TextToSpeech(Context, TextToSpeech+IOnInitListener)

The constructor for the TextToSpeech class, using the default TTS engine.

TextToSpeech(IntPtr, JniHandleOwnership)

A constructor used when creating managed representations of JNI objects; called by the runtime.

Fields

ActionTtsQueueProcessingCompleted

Broadcast Action: The TextToSpeech synthesizer has completed processing of all the text in the speech queue.

Properties

AvailableLanguages

Query the engine about the set of available languages.

Class

Returns the runtime class of this Object.

(Inherited from Object)
DefaultEngine

Gets the package name of the default speech synthesis engine.

DefaultLanguage
Obsolete.

Returns a Locale instance describing the language currently being used as the default Text-to-speech language.

DefaultVoice

Returns a Voice instance that's the default voice for the default Text-to-speech language.

Engines

Gets a list of all installed TTS engines.

Handle

The handle to the underlying Android instance.

(Inherited from Object)
IsSpeaking

Checks whether the TTS engine is busy speaking.

JniIdentityHashCode (Inherited from Object)
JniPeerMembers
Language
Obsolete.

Returns a Locale instance describing the language currently being used for synthesis requests sent to the TextToSpeech engine.

MaxSpeechInputLength

Limit of length of input string passed to speak and synthesizeToFile.

PeerReference (Inherited from Object)
ThresholdClass

This API supports the Mono for Android infrastructure and is not intended to be used directly from your code.

ThresholdType

This API supports the Mono for Android infrastructure and is not intended to be used directly from your code.

Voice

Returns a Voice instance describing the voice currently being used for synthesis requests sent to the TextToSpeech engine.

Voices

Query the engine about the set of available voices.

Methods

AddEarcon(String, File)

Adds a mapping between a string of text and a sound file.

AddEarcon(String, String, Int32)

Adds a mapping between a string of text and a sound resource in a package.

AddEarcon(String, String)
Obsolete.

Adds a mapping between a string of text and a sound file.

AddEarcon(String, Uri)

Adds a mapping between a string of text and a sound file.

AddSpeech(ICharSequence, File)

Adds a mapping between a CharSequence (may be spanned with TtsSpans) and a sound file.

AddSpeech(ICharSequence, String, Int32)

Adds a mapping between a CharSequence (may be spanned with TtsSpans) of text and a sound resource in a package.

AddSpeech(ICharSequence, Uri)

Adds a mapping between a CharSequence (may be spanned with TtsSpans) and a sound file.

AddSpeech(String, File)

Adds a mapping between a CharSequence (may be spanned with TtsSpans) and a sound file.

AddSpeech(String, String, Int32)

Adds a mapping between a string of text and a sound resource in a package.

AddSpeech(String, String)

Adds a mapping between a string of text and a sound file.

AddSpeech(String, Uri)

Adds a mapping between a CharSequence (may be spanned with TtsSpans) and a sound file.

AreDefaultsEnforced()
Obsolete.

Checks whether the user's settings should override settings requested by the calling application.

Clone()

Creates and returns a copy of this object.

(Inherited from Object)
Dispose() (Inherited from Object)
Dispose(Boolean) (Inherited from Object)
Equals(Object)

Indicates whether some other object is "equal to" this one.

(Inherited from Object)
GetFeatures(Locale)
Obsolete.

Queries the engine for the set of features it supports for a given locale.

GetHashCode()

Returns a hash code value for the object.

(Inherited from Object)
IsLanguageAvailable(Locale)

Checks if the specified language as represented by the Locale is available and supported.

JavaFinalize()

Called by the garbage collector on an object when garbage collection determines that there are no more references to the object.

(Inherited from Object)
Notify()

Wakes up a single thread that is waiting on this object's monitor.

(Inherited from Object)
NotifyAll()

Wakes up all threads that are waiting on this object's monitor.

(Inherited from Object)
PlayEarcon(String, QueueMode, Bundle, String)

Plays the earcon using the specified queueing mode and parameters.

PlayEarcon(String, QueueMode, IDictionary<String,String>)
Obsolete.

Plays the earcon using the specified queueing mode and parameters.

PlaySilence(Int64, QueueMode, IDictionary<String,String>)
Obsolete.

Plays silence for the specified amount of time using the specified queue mode.

PlaySilentUtterance(Int64, QueueMode, String)

Plays silence for the specified amount of time using the specified queue mode.

SetAudioAttributes(AudioAttributes)

Sets the audio attributes to be used when speaking text or playing back a file.

SetEngineByPackageName(String)
Obsolete.

Sets the TTS engine to use.

SetHandle(IntPtr, JniHandleOwnership)

Sets the Handle property.

(Inherited from Object)
SetLanguage(Locale)

Sets the text-to-speech language.

SetOnUtteranceCompletedListener(TextToSpeech+IOnUtteranceCompletedListener)
Obsolete.

Sets the listener that will be notified when synthesis of an utterance completes.

SetOnUtteranceProgressListener(UtteranceProgressListener)

Sets the listener that will be notified of various events related to the synthesis of a given utterance.

SetPitch(Single)

Sets the speech pitch for the TextToSpeech engine.

SetSpeechRate(Single)

Sets the speech rate.

SetVoice(Voice)

Sets the text-to-speech voice.

Shutdown()

Releases the resources used by the TextToSpeech engine.

Speak(ICharSequence, QueueMode, Bundle, String)

Speaks the text using the specified queuing strategy and speech parameters, the text may be spanned with TtsSpans.

Speak(String, QueueMode, Bundle, String)

Speaks the text using the specified queuing strategy and speech parameters, the text may be spanned with TtsSpans.

Speak(String, QueueMode, IDictionary<String,String>)
Obsolete.

Speaks the string using the specified queuing strategy and speech parameters.

Stop()

Interrupts the current utterance (whether played or rendered to file) and discards other utterances in the queue.

SynthesizeToFile(ICharSequence, Bundle, File, String)

Synthesizes the given text to a file using the specified parameters.

SynthesizeToFile(ICharSequence, Bundle, ParcelFileDescriptor, String)

Synthesizes the given text to a ParcelFileDescriptor using the specified parameters.

SynthesizeToFile(String, Bundle, File, String)

Synthesizes the given text to a file using the specified parameters.

SynthesizeToFile(String, Bundle, ParcelFileDescriptor, String)

Synthesizes the given text to a ParcelFileDescriptor using the specified parameters.

SynthesizeToFile(String, IDictionary<String,String>, String)
Obsolete.

Synthesizes the given text to a file using the specified parameters.

ToArray<T>() (Inherited from Object)
ToString()

Returns a string representation of the object.

(Inherited from Object)
UnregisterFromRuntime() (Inherited from Object)
Wait()

Causes the current thread to wait until it is awakened, typically by being <em>notified</em> or <em>interrupted</em>.

(Inherited from Object)
Wait(Int64, Int32)

Causes the current thread to wait until it is awakened, typically by being <em>notified</em> or <em>interrupted</em>, or until a certain amount of real time has elapsed.

(Inherited from Object)
Wait(Int64)

Causes the current thread to wait until it is awakened, typically by being <em>notified</em> or <em>interrupted</em>, or until a certain amount of real time has elapsed.

(Inherited from Object)

Explicit Interface Implementations

IJavaPeerable.Disposed() (Inherited from Object)
IJavaPeerable.DisposeUnlessReferenced() (Inherited from Object)
IJavaPeerable.Finalized() (Inherited from Object)
IJavaPeerable.JniManagedPeerState (Inherited from Object)
IJavaPeerable.SetJniIdentityHashCode(Int32) (Inherited from Object)
IJavaPeerable.SetJniManagedPeerState(JniManagedPeerStates) (Inherited from Object)
IJavaPeerable.SetPeerReference(JniObjectReference) (Inherited from Object)

Extension Methods

JavaCast<TResult>(IJavaObject)

Performs an Android runtime-checked type conversion.

JavaCast<TResult>(IJavaObject)
GetJniTypeName(IJavaPeerable)

Applies to