speech

package
v0.0.5 Latest Latest
Warning

This package is not in the latest version of its module.

Go to latest
Published: Mar 21, 2026 License: CC0-1.0 Imports: 6 Imported by: 0

Documentation

Overview

Package speech provides Go bindings for android.speech.tts.

Index

Constants

View Source
const (
	ActionTtsQueueProcessingCompleted = consts.ActionTtsQueueProcessingCompleted
	ConfidenceScores                  = consts.ConfidenceScores
	DetectedLanguage                  = consts.DetectedLanguage
	LanguageDetectionConfidenceLevel  = consts.LanguageDetectionConfidenceLevel
	LanguageSwitchResult              = consts.LanguageSwitchResult
	RecognitionParts                  = consts.RecognitionParts
	ResultsAlternatives               = consts.ResultsAlternatives
	ResultsRecognition                = consts.ResultsRecognition
	TopLocaleAlternatives             = consts.TopLocaleAlternatives
)
View Source
const (
	Error                                           = consts.Error
	ErrorInvalidRequest                             = consts.ErrorInvalidRequest
	ErrorNetwork                                    = consts.ErrorNetwork
	ErrorNetworkTimeout                             = consts.ErrorNetworkTimeout
	ErrorNotInstalledYet                            = consts.ErrorNotInstalledYet
	ErrorOutput                                     = consts.ErrorOutput
	ErrorService                                    = consts.ErrorService
	ErrorSynthesis                                  = consts.ErrorSynthesis
	LangAvailable                                   = consts.LangAvailable
	LangCountryAvailable                            = consts.LangCountryAvailable
	LangCountryVarAvailable                         = consts.LangCountryVarAvailable
	LangMissingData                                 = consts.LangMissingData
	LangNotSupported                                = consts.LangNotSupported
	QueueAdd                                        = consts.QueueAdd
	QueueFlush                                      = consts.QueueFlush
	Stopped                                         = consts.Stopped
	Success                                         = consts.Success
	ErrorAudio                                      = consts.ErrorAudio
	ErrorCannotCheckSupport                         = consts.ErrorCannotCheckSupport
	ErrorCannotListenToDownloadEvents               = consts.ErrorCannotListenToDownloadEvents
	ErrorClient                                     = consts.ErrorClient
	ErrorInsufficientPermissions                    = consts.ErrorInsufficientPermissions
	ErrorLanguageNotSupported                       = consts.ErrorLanguageNotSupported
	ErrorLanguageUnavailable                        = consts.ErrorLanguageUnavailable
	ErrorNoMatch                                    = consts.ErrorNoMatch
	ErrorRecognizerBusy                             = consts.ErrorRecognizerBusy
	ErrorServer                                     = consts.ErrorServer
	ErrorServerDisconnected                         = consts.ErrorServerDisconnected
	ErrorSpeechTimeout                              = consts.ErrorSpeechTimeout
	ErrorTooManyRequests                            = consts.ErrorTooManyRequests
	LanguageDetectionConfidenceLevelConfident       = consts.LanguageDetectionConfidenceLevelConfident
	LanguageDetectionConfidenceLevelHighlyConfident = consts.LanguageDetectionConfidenceLevelHighlyConfident
	LanguageDetectionConfidenceLevelNotConfident    = consts.LanguageDetectionConfidenceLevelNotConfident
	LanguageDetectionConfidenceLevelUnknown         = consts.LanguageDetectionConfidenceLevelUnknown
	LanguageSwitchResultFailed                      = consts.LanguageSwitchResultFailed
	LanguageSwitchResultNotAttempted                = consts.LanguageSwitchResultNotAttempted
	LanguageSwitchResultSkippedNoModel              = consts.LanguageSwitchResultSkippedNoModel
	LanguageSwitchResultSucceeded                   = consts.LanguageSwitchResultSucceeded
	RecognizerErrorNetwork                          = consts.RecognizerErrorNetwork
	RecognizerErrorNetworkTimeout                   = consts.RecognizerErrorNetworkTimeout
)

Variables

This section is empty.

Functions

func Init

func Init(env *jni.Env) error

Init resolves all JNI class and method references for this package. It is safe to call multiple times (uses sync.Once internally). Exported for E2E testing on Android.

Types

type Recognizer added in v0.0.4

type Recognizer struct {
	VM  *jni.VM
	Obj *jni.GlobalRef
}

Recognizer wraps android.speech.SpeechRecognizer.

func (*Recognizer) Cancel added in v0.0.4

func (m *Recognizer) Cancel() error

Cancel calls android.speech.SpeechRecognizer.cancel.

func (*Recognizer) CheckRecognitionSupport added in v0.0.4

func (m *Recognizer) CheckRecognitionSupport(
	arg0 *jni.Object,
	arg1 *jni.Object,
	arg2 *jni.Object,
) error

CheckRecognitionSupport calls android.speech.SpeechRecognizer.checkRecognitionSupport.

func (*Recognizer) CreateOnDeviceSpeechRecognizer added in v0.0.4

func (m *Recognizer) CreateOnDeviceSpeechRecognizer(arg0 *jni.Object) (*jni.Object, error)

CreateOnDeviceSpeechRecognizer calls android.speech.SpeechRecognizer.createOnDeviceSpeechRecognizer.

func (*Recognizer) CreateSpeechRecognizer1 added in v0.0.4

func (m *Recognizer) CreateSpeechRecognizer1(arg0 *jni.Object) (*jni.Object, error)

CreateSpeechRecognizer1 calls android.speech.SpeechRecognizer.createSpeechRecognizer.

func (*Recognizer) CreateSpeechRecognizer2_1 added in v0.0.4

func (m *Recognizer) CreateSpeechRecognizer2_1(arg0 *jni.Object, arg1 *jni.Object) (*jni.Object, error)

CreateSpeechRecognizer2_1 calls android.speech.SpeechRecognizer.createSpeechRecognizer.

func (*Recognizer) Destroy added in v0.0.4

func (m *Recognizer) Destroy() error

Destroy calls android.speech.SpeechRecognizer.destroy.

func (*Recognizer) IsOnDeviceRecognitionAvailable added in v0.0.4

func (m *Recognizer) IsOnDeviceRecognitionAvailable(arg0 *jni.Object) (bool, error)

IsOnDeviceRecognitionAvailable calls android.speech.SpeechRecognizer.isOnDeviceRecognitionAvailable.

func (*Recognizer) IsRecognitionAvailable added in v0.0.4

func (m *Recognizer) IsRecognitionAvailable(arg0 *jni.Object) (bool, error)

IsRecognitionAvailable calls android.speech.SpeechRecognizer.isRecognitionAvailable.

func (*Recognizer) SetRecognitionListener added in v0.0.4

func (m *Recognizer) SetRecognitionListener(arg0 *jni.Object) error

SetRecognitionListener calls android.speech.SpeechRecognizer.setRecognitionListener.

func (*Recognizer) StartListening added in v0.0.4

func (m *Recognizer) StartListening(arg0 *jni.Object) error

StartListening calls android.speech.SpeechRecognizer.startListening.

func (*Recognizer) StopListening added in v0.0.4

func (m *Recognizer) StopListening() error

StopListening calls android.speech.SpeechRecognizer.stopListening.

func (*Recognizer) TriggerModelDownload1 added in v0.0.4

func (m *Recognizer) TriggerModelDownload1(arg0 *jni.Object) error

TriggerModelDownload1 calls android.speech.SpeechRecognizer.triggerModelDownload.

func (*Recognizer) TriggerModelDownload3_1 added in v0.0.4

func (m *Recognizer) TriggerModelDownload3_1(
	arg0 *jni.Object,
	arg1 *jni.Object,
	arg2 *jni.Object,
) error

TriggerModelDownload3_1 calls android.speech.SpeechRecognizer.triggerModelDownload.

type TextToSpeech added in v0.0.4

type TextToSpeech struct {
	VM  *jni.VM
	Obj *jni.GlobalRef
}

TextToSpeech wraps android.speech.tts.TextToSpeech.

func NewTTS added in v0.0.4

func NewTTS(vm *jni.VM) (*TextToSpeech, error)

NewTTS creates a new TextToSpeech instance via the no-arg constructor available in app_process context.

func (*TextToSpeech) AddEarcon2 added in v0.0.4

func (m *TextToSpeech) AddEarcon2(arg0 string, arg1 *jni.Object) (int32, error)

AddEarcon2 calls android.speech.tts.TextToSpeech.addEarcon.

func (*TextToSpeech) AddEarcon2_1 added in v0.0.4

func (m *TextToSpeech) AddEarcon2_1(arg0 string, arg1 *jni.Object) (int32, error)

AddEarcon2_1 calls android.speech.tts.TextToSpeech.addEarcon.

func (*TextToSpeech) AddEarcon2_2 added in v0.0.4

func (m *TextToSpeech) AddEarcon2_2(arg0 string, arg1 string) (int32, error)

AddEarcon2_2 calls android.speech.tts.TextToSpeech.addEarcon.

func (*TextToSpeech) AddEarcon3_3 added in v0.0.4

func (m *TextToSpeech) AddEarcon3_3(
	arg0 string,
	arg1 string,
	arg2 int32,
) (int32, error)

AddEarcon3_3 calls android.speech.tts.TextToSpeech.addEarcon.

func (*TextToSpeech) AddSpeech2 added in v0.0.4

func (m *TextToSpeech) AddSpeech2(arg0 string, arg1 *jni.Object) (int32, error)

AddSpeech2 calls android.speech.tts.TextToSpeech.addSpeech.

func (*TextToSpeech) AddSpeech2_1 added in v0.0.4

func (m *TextToSpeech) AddSpeech2_1(arg0 string, arg1 *jni.Object) (int32, error)

AddSpeech2_1 calls android.speech.tts.TextToSpeech.addSpeech.

func (*TextToSpeech) AddSpeech2_3 added in v0.0.4

func (m *TextToSpeech) AddSpeech2_3(arg0 string, arg1 string) (int32, error)

AddSpeech2_3 calls android.speech.tts.TextToSpeech.addSpeech.

func (*TextToSpeech) AddSpeech3_2 added in v0.0.4

func (m *TextToSpeech) AddSpeech3_2(
	arg0 string,
	arg1 string,
	arg2 int32,
) (int32, error)

AddSpeech3_2 calls android.speech.tts.TextToSpeech.addSpeech.

func (*TextToSpeech) AddSpeech3_4 added in v0.0.4

func (m *TextToSpeech) AddSpeech3_4(
	arg0 string,
	arg1 string,
	arg2 int32,
) (int32, error)

AddSpeech3_4 calls android.speech.tts.TextToSpeech.addSpeech.

func (*TextToSpeech) AreDefaultsEnforced added in v0.0.4

func (m *TextToSpeech) AreDefaultsEnforced() (bool, error)

AreDefaultsEnforced calls android.speech.tts.TextToSpeech.areDefaultsEnforced.

func (*TextToSpeech) Close added in v0.0.4

func (m *TextToSpeech) Close()

Close releases the global reference to the underlying Java object.

func (*TextToSpeech) GetAvailableLanguages added in v0.0.4

func (m *TextToSpeech) GetAvailableLanguages() (*jni.Object, error)

GetAvailableLanguages calls android.speech.tts.TextToSpeech.getAvailableLanguages.

func (*TextToSpeech) GetDefaultEngine added in v0.0.4

func (m *TextToSpeech) GetDefaultEngine() (string, error)

GetDefaultEngine calls android.speech.tts.TextToSpeech.getDefaultEngine.

func (*TextToSpeech) GetDefaultLanguage added in v0.0.4

func (m *TextToSpeech) GetDefaultLanguage() (*jni.Object, error)

GetDefaultLanguage calls android.speech.tts.TextToSpeech.getDefaultLanguage.

func (*TextToSpeech) GetDefaultVoice added in v0.0.4

func (m *TextToSpeech) GetDefaultVoice() (*jni.Object, error)

GetDefaultVoice calls android.speech.tts.TextToSpeech.getDefaultVoice.

func (*TextToSpeech) GetEngines added in v0.0.4

func (m *TextToSpeech) GetEngines() (*jni.Object, error)

GetEngines calls android.speech.tts.TextToSpeech.getEngines.

func (*TextToSpeech) GetFeatures added in v0.0.4

func (m *TextToSpeech) GetFeatures(arg0 *jni.Object) (*jni.Object, error)

GetFeatures calls android.speech.tts.TextToSpeech.getFeatures.

func (*TextToSpeech) GetLanguage added in v0.0.4

func (m *TextToSpeech) GetLanguage() (*jni.Object, error)

GetLanguage calls android.speech.tts.TextToSpeech.getLanguage.

func (*TextToSpeech) GetMaxSpeechInputLength added in v0.0.4

func (m *TextToSpeech) GetMaxSpeechInputLength() (int32, error)

GetMaxSpeechInputLength calls android.speech.tts.TextToSpeech.getMaxSpeechInputLength.

func (*TextToSpeech) GetVoice added in v0.0.4

func (m *TextToSpeech) GetVoice() (*jni.Object, error)

GetVoice calls android.speech.tts.TextToSpeech.getVoice.

func (*TextToSpeech) GetVoices added in v0.0.4

func (m *TextToSpeech) GetVoices() (*jni.Object, error)

GetVoices calls android.speech.tts.TextToSpeech.getVoices.

func (*TextToSpeech) IsLanguageAvailable added in v0.0.4

func (m *TextToSpeech) IsLanguageAvailable(arg0 *jni.Object) (int32, error)

IsLanguageAvailable calls android.speech.tts.TextToSpeech.isLanguageAvailable.

func (*TextToSpeech) IsSpeaking added in v0.0.4

func (m *TextToSpeech) IsSpeaking() (bool, error)

IsSpeaking calls android.speech.tts.TextToSpeech.isSpeaking.

func (*TextToSpeech) PlayEarcon3_1 added in v0.0.4

func (m *TextToSpeech) PlayEarcon3_1(
	arg0 string,
	arg1 int32,
	arg2 *jni.Object,
) (int32, error)

PlayEarcon3_1 calls android.speech.tts.TextToSpeech.playEarcon.

func (*TextToSpeech) PlayEarcon4 added in v0.0.4

func (m *TextToSpeech) PlayEarcon4(
	arg0 string,
	arg1 int32,
	arg2 *jni.Object,
	arg3 string,
) (int32, error)

PlayEarcon4 calls android.speech.tts.TextToSpeech.playEarcon.

func (*TextToSpeech) PlaySilence added in v0.0.4

func (m *TextToSpeech) PlaySilence(
	arg0 int64,
	arg1 int32,
	arg2 *jni.Object,
) (int32, error)

PlaySilence calls android.speech.tts.TextToSpeech.playSilence.

func (*TextToSpeech) PlaySilentUtterance added in v0.0.4

func (m *TextToSpeech) PlaySilentUtterance(
	arg0 int64,
	arg1 int32,
	arg2 string,
) (int32, error)

PlaySilentUtterance calls android.speech.tts.TextToSpeech.playSilentUtterance.

func (*TextToSpeech) SetAudioAttributes added in v0.0.4

func (m *TextToSpeech) SetAudioAttributes(arg0 *jni.Object) (int32, error)

SetAudioAttributes calls android.speech.tts.TextToSpeech.setAudioAttributes.

func (*TextToSpeech) SetEngineByPackageName added in v0.0.4

func (m *TextToSpeech) SetEngineByPackageName(arg0 string) (int32, error)

SetEngineByPackageName calls android.speech.tts.TextToSpeech.setEngineByPackageName.

func (*TextToSpeech) SetLanguage added in v0.0.4

func (m *TextToSpeech) SetLanguage(arg0 *jni.Object) (int32, error)

SetLanguage calls android.speech.tts.TextToSpeech.setLanguage.

func (*TextToSpeech) SetOnUtteranceCompletedListener added in v0.0.4

func (m *TextToSpeech) SetOnUtteranceCompletedListener(arg0 *jni.Object) (int32, error)

SetOnUtteranceCompletedListener calls android.speech.tts.TextToSpeech.setOnUtteranceCompletedListener.

func (*TextToSpeech) SetOnUtteranceProgressListener added in v0.0.4

func (m *TextToSpeech) SetOnUtteranceProgressListener(arg0 *jni.Object) (int32, error)

SetOnUtteranceProgressListener calls android.speech.tts.TextToSpeech.setOnUtteranceProgressListener.

func (*TextToSpeech) SetPitch added in v0.0.4

func (m *TextToSpeech) SetPitch(arg0 float32) (int32, error)

SetPitch calls android.speech.tts.TextToSpeech.setPitch.

func (*TextToSpeech) SetSpeechRate added in v0.0.4

func (m *TextToSpeech) SetSpeechRate(arg0 float32) (int32, error)

SetSpeechRate calls android.speech.tts.TextToSpeech.setSpeechRate.

func (*TextToSpeech) SetVoice added in v0.0.4

func (m *TextToSpeech) SetVoice(arg0 *jni.Object) (int32, error)

SetVoice calls android.speech.tts.TextToSpeech.setVoice.

func (*TextToSpeech) Shutdown added in v0.0.4

func (m *TextToSpeech) Shutdown() error

Shutdown calls android.speech.tts.TextToSpeech.shutdown.

func (*TextToSpeech) Speak3_1 added in v0.0.4

func (m *TextToSpeech) Speak3_1(
	arg0 string,
	arg1 int32,
	arg2 *jni.Object,
) (int32, error)

Speak3_1 calls android.speech.tts.TextToSpeech.speak.

func (*TextToSpeech) Speak4 added in v0.0.4

func (m *TextToSpeech) Speak4(
	arg0 string,
	arg1 int32,
	arg2 *jni.Object,
	arg3 string,
) (int32, error)

Speak4 calls android.speech.tts.TextToSpeech.speak.

func (*TextToSpeech) Stop added in v0.0.4

func (m *TextToSpeech) Stop() (int32, error)

Stop calls android.speech.tts.TextToSpeech.stop.

func (*TextToSpeech) SynthesizeToFile3_2 added in v0.0.4

func (m *TextToSpeech) SynthesizeToFile3_2(
	arg0 string,
	arg1 *jni.Object,
	arg2 string,
) (int32, error)

SynthesizeToFile3_2 calls android.speech.tts.TextToSpeech.synthesizeToFile.

func (*TextToSpeech) SynthesizeToFile4 added in v0.0.4

func (m *TextToSpeech) SynthesizeToFile4(
	arg0 string,
	arg1 *jni.Object,
	arg2 *jni.Object,
	arg3 string,
) (int32, error)

SynthesizeToFile4 calls android.speech.tts.TextToSpeech.synthesizeToFile.

func (*TextToSpeech) SynthesizeToFile4_1 added in v0.0.4

func (m *TextToSpeech) SynthesizeToFile4_1(
	arg0 string,
	arg1 *jni.Object,
	arg2 *jni.Object,
	arg3 string,
) (int32, error)

SynthesizeToFile4_1 calls android.speech.tts.TextToSpeech.synthesizeToFile.

Directories

Path Synopsis

Jump to

Keyboard shortcuts

? : This menu
/ : Search site
f or F : Jump to
y or Y : Canonical URL