Student: Ramon araujo

moancapableΤεχνίτη Νοημοσύνη και Ρομποτική

17 Νοε 2013 (πριν από 3 χρόνια και 6 μήνες)

61 εμφανίσεις

Android Speech
Recognition API

Outline


Introduction


Remarks


API overview


Demo 1: Voice
-
triggered intents


Demo 2: Voice
-
controlled animation

Introduction


Speech Input has been gaining
attention



Remarks


Only for Android 2.2 (
Froyo
) or later


Does not work without internet
connection


Must add RECORD_AUDIO
permission in Manifest File

Overview of Speech Recognition API


Package:
android.speech


Interface


RecognitionListener



Classes


RecognitionService


RecognitionService.callback


RecognizerIntent


SpeechRecognizer



Fundamental

classes

Most important methods

1.
onBeginningOfSpeech
()

2.
onEndOfSpeech
()

3.
onError
(error constant
defined
in
SpeechRecognizer
)

4.
onResults
()

RecognitionListener

Interface

RecognizerIntent

Class

Defines

important

constants

when

associating

the

recognized

output

with

intents

(launch

other

applications,

for

example)


Common Constants

-
ACTION_RECOGNIZE_SPEECH

-
EXTRA_CALLING_PACKAGE



voice.recognition.test


-
EXTRA_MAX_RESULTS

SpeechRecognizer

Class

A lot of
error constants


Important Methods

-
createSpeechRecognizer
()

-
setRecognitionListener
(
Recogniti
onListener
)

-
startListening
(Intent customized
with
RecognizerIntent

constants)

-
stopListening
()

Good practice:

-
isRecognitionAvailable
()

RecognitionService

Class

Highlighted methods

1.
onBind
()

2.
onStartListening
()

3.
onStopListening
()


RecognitionService.Callback

Class

Instantiated and passed in
RecognitionService.onStartListenin
g
()


Highlighted methods

1.
beginningOfSpeech
()

2.
endOfSpeech
()

3.
error()

4.
readyForSpeech
()

5.
results()


Demo 1

Voice
-
triggered intents

Demo 2

Voice
-
controlled animation

References


Speech Recognition
API:

http
://
developer.android.com/reference/an
droid/speech/package
-
summary.html

Questions?