24
CS378 - Mobile Computing Speech to Text, Text to Speech, Telephony

CS378 - Mobile Computing Speech to Text, Text to Speech, Telephony

Embed Size (px)

Citation preview

Page 1: CS378 - Mobile Computing Speech to Text, Text to Speech, Telephony

CS378 - Mobile Computing

Speech to Text,Text to Speech,

Telephony

Page 2: CS378 - Mobile Computing Speech to Text, Text to Speech, Telephony

2

SPEECH RECOGNITION - SPEECH TO TEXT

Page 3: CS378 - Mobile Computing Speech to Text, Text to Speech, Telephony

3

Speech Recognition• android.speech package• Simplest example - start an Intent for a

resultRecognizerIntent.ACTION_RECOGNIZE_SPEECH

• uses network– true on the dev phones– doesn't work on emulator

Page 4: CS378 - Mobile Computing Speech to Text, Text to Speech, Telephony

4

Speech Recognition

Page 5: CS378 - Mobile Computing Speech to Text, Text to Speech, Telephony

5

Starting Intent

Page 6: CS378 - Mobile Computing Speech to Text, Text to Speech, Telephony

6

Responding to Result• Note: list of results, ordered by confidence

Page 7: CS378 - Mobile Computing Speech to Text, Text to Speech, Telephony

7

Results

Page 8: CS378 - Mobile Computing Speech to Text, Text to Speech, Telephony

8

Modified Version• Show confidence scores

Page 9: CS378 - Mobile Computing Speech to Text, Text to Speech, Telephony

9

Sample Results

Page 10: CS378 - Mobile Computing Speech to Text, Text to Speech, Telephony

10

Sample Results

Page 11: CS378 - Mobile Computing Speech to Text, Text to Speech, Telephony

11

Android SpeechRecognizer• Allows lower level control of SpeechRecognizer• If you don't want to use the intent and built in

activity• must call methods on the main activity thread• must have RECORD_AUDIO permission• likely uses a service– don't use for continuous recognition

• Requires RecognitionListener for call backs

Page 12: CS378 - Mobile Computing Speech to Text, Text to Speech, Telephony

12

TEXT TO SPEECH

Page 13: CS378 - Mobile Computing Speech to Text, Text to Speech, Telephony

13

Android TextToSpeech Class• Not as easy to use as SpeechToText• … but not too bad• In example, edit text to enter text and

button to launch speech to text object

Page 14: CS378 - Mobile Computing Speech to Text, Text to Speech, Telephony

14

Text to Speech UI Example

Page 15: CS378 - Mobile Computing Speech to Text, Text to Speech, Telephony

15

Text To Speech• Create Text To Speech Object• constructor requires a Context and a

TextToSpeech.OnInitListener

Page 16: CS378 - Mobile Computing Speech to Text, Text to Speech, Telephony

16

TextToSpeech.OnInitListener• one method, onInit• passed an int for status

Page 17: CS378 - Mobile Computing Speech to Text, Text to Speech, Telephony

17

onClick Method for Text to Speech• get text from EditText• pass to TextToSpeech object

• Demo• Other locales available–does not translate text

Page 18: CS378 - Mobile Computing Speech to Text, Text to Speech, Telephony

18

Text To Speech• methods to:• save to a sound file• map text to sound files other than

default• check if languages available• set rate and pitch of speech engine

Page 19: CS378 - Mobile Computing Speech to Text, Text to Speech, Telephony

19

TELEPHONY

Page 20: CS378 - Mobile Computing Speech to Text, Text to Speech, Telephony

20

Telephony• "The working or use of telephones"• Remember, a lot of Android devices are

smartphones• android.telephony package in the API

Page 21: CS378 - Mobile Computing Speech to Text, Text to Speech, Telephony

21

Page 22: CS378 - Mobile Computing Speech to Text, Text to Speech, Telephony

22

android.telephony package• classes to work with• cellular network• the phone itself• SMS, short messaging service, text

messages• TelephonyManager

Page 23: CS378 - Mobile Computing Speech to Text, Text to Speech, Telephony

23

Making Calls• From you app, easiest way is via Intents

• required permission is CALL_PHONE• Intent.ACTION_DIAL, brings up phone

app with numbered entered

Page 24: CS378 - Mobile Computing Speech to Text, Text to Speech, Telephony

24

Telephony Provider• Content Provider for data related to

phone operation• tables for– carriers, MMS, SMS