SlideShare a Scribd company logo
1 of 39
Download to read offline
Android
Android       iPhone
  Android              iPhone



            API
  Android
Google              API


          (   )


Android           API
Google      API   (TTS:Text-To-Speech




Android   API
Android



              →
    →     →
http://nd-ilab.jp/android/android_pinyin_translate.apk
twitter
Activity
           Activity
→
→Droid Jammer         droid
→
→Twitroid   Twitter


→
Intent
 RecognizerIntent.ACTION_RECOGNIZE_SPEECH
 android.speech.action.RECOGNIZE_SPEECH

           Intent
Intent
//
          recognitionButton.setOnClickListener(new OnClickListener(){
	    	   	    @Override
	    	   	    public void onClick(View v) {
	    	   	    	   try {
                        Intent intent = new Intent(
                                RecognizerIntent.ACTION_RECOGNIZE_SPEECH);
                        intent.putExtra(
                                RecognizerIntent.EXTRA_LANGUAGE_MODEL,
                                RecognizerIntent.LANGUAGE_MODEL_FREE_FORM);
                        intent.putExtra(
                                RecognizerIntent.EXTRA_PROMPT,
                                getText(R.string.dialog_recognition));
                        startActivityForResult(intent, REQUEST_CODE);
                   } catch (ActivityNotFoundException e) {
                   }
	    	   	    }
          });
Intent
//
          recognitionButton.setOnClickListener(new OnClickListener(){
	    	   	    @Override
	    	   	    public void onClick(View v) {
	    	   	    	   try {
                        Intent intent = new Intent(
                                RecognizerIntent.ACTION_RECOGNIZE_SPEECH);
                        intent.putExtra(
                                RecognizerIntent.EXTRA_LANGUAGE_MODEL,
                                RecognizerIntent.LANGUAGE_MODEL_FREE_FORM);
                        intent.putExtra(
                                RecognizerIntent.EXTRA_PROMPT,
                                getText(R.string.dialog_recognition));
                                     LANGUAGE_MODEL_WEB_SEARCH
                        startActivityForResult(intent, REQUEST_CODE);
                                                  Web
                   } catch (ActivityNotFoundException e) {
                   }                 LANGUAGE_MODEL_FREE_FORM
	    	   	    }
          });
protected void onActivityResult(int requestCode, int resultCode, Intent data) {
    if (requestCode == REQUEST_CODE && resultCode == RESULT_OK) {
        String resultsString = "";

        //
        ArrayList<String> results = data.getStringArrayListExtra(
                RecognizerIntent.EXTRA_RESULTS);

        for (int i = 0; i< results.size(); i++) {
            resultsString += results.get(i);
        }

        this.searchText.setText(resultsString);
    }

    super.onActivityResult(requestCode, resultCode, data);
}
•
    →        API Google


    3G Wifi




              →Google     →Activity
         →                →           Android
        →
•

    →




    ※ RecognizerIntent.EXTRA_LANGUAGE
•   mp3      API


    →

•   Google   API


    →         ML
Text-To-Speech                      API
(android.speech.tts.TextToSpeech)



  android.intent.action.START_TTS_SERVICE




                                            Activity
TTS
//TTS
	   @Override
	   public void onInit(int status) {
	   	   if(status == TextToSpeech.SUCCESS){
	   	   	   if(tts.isLanguageAvailable(Locale.US) == TextToSpeech.LANG_MISSING_DATA){
	   	   	   	   new AlertDialog.Builder(this).setTitle("warning").setMessage("tts(us)
not supprted").show();
	   	   	   }else{
	   	   	   	   tts.setLanguage(Locale.US);
	   	   	   	   tts.setPitch(1.8f);
	   	   	   	   tts.setSpeechRate(0.8f);
	   	   	   }
	   	   }else{
	   	   	   new AlertDialog.Builder(this).setTitle("error").setMessage("tts#onInit
error").show();
	   	   	   finish();
	   	   }
	   	
	   }
TTS
//TTS
	   @Override
	   public void onInit(int status) {
	   	   if(status == TextToSpeech.SUCCESS){
	   	   	   if(tts.isLanguageAvailable(Locale.US) == TextToSpeech.LANG_MISSING_DATA){
	   	   	   	   new AlertDialog.Builder(this).setTitle("warning").setMessage("tts(us)
not supprted").show();
	   	   	   }else{
	   	   	   	   tts.setLanguage(Locale.US);
	   	   	   	   tts.setPitch(1.8f);
	   	   	   	   tts.setSpeechRate(0.8f);
	   	   	   }
	   	   }else{
	   	   	   new AlertDialog.Builder(this).setTitle("error").setMessage("tts#onInit
error").show();
	   	   	   finish();
	   	   }
	   	
	   }
SearchResult result = currentResult.get(position);
	   if(tts.isSpeaking()){
	   	   tts.stop();
	   }
	   HashMap<String, String> params = new HashMap<String, String>();
	   params.put(TextToSpeech.Engine.KEY_PARAM_STREAM,String.valueOf
(AudioManager.STREAM_MUSIC));
	   tts.speak(result.getChn(), TextToSpeech.QUEUE_FLUSH, params);



※


※




(tts.isSpeaking()
SearchResult result = currentResult.get(position);
	   if(tts.isSpeaking()){
	   	   tts.stop();
	   }
	   HashMap<String, String> params = new HashMap<String, String>();
	   params.put(TextToSpeech.Engine.KEY_PARAM_STREAM,String.valueOf
(AudioManager.STREAM_MUSIC));
	   tts.speak(result.getChn(), TextToSpeech.QUEUE_FLUSH, params);


               STREAM_ALARM
※
               STREAM_MUSIC

※              STREAM_NOTIFICATION




(tts.isSpeaking()
Text-To-Speech
                       API
http://eyes-free.googlecode.com/
eSpeak
          TTS    PICO
Google           TTS                   20



                                   C
Text-To-Speech                                      API

http://gimite.net/pukiwiki/index.php?Android%20JaTTS

Android


                                                mp3



                              Galatea Talk
http://hil.t.u-tokyo.ac.jp/~galatea/index-jp.html
※
TTS Expanded
           Android



JaTTS

            →Android
Android
API



Android
Androidの音声認識とテキスト読み上げ機能について

More Related Content

What's hot

Baksik3 enug baksik_xmlinvoice
Baksik3 enug baksik_xmlinvoiceBaksik3 enug baksik_xmlinvoice
Baksik3 enug baksik_xmlinvoice
ENUG
 

What's hot (8)

Perl6 one-liners
Perl6 one-linersPerl6 one-liners
Perl6 one-liners
 
Baksik3 enug baksik_xmlinvoice
Baksik3 enug baksik_xmlinvoiceBaksik3 enug baksik_xmlinvoice
Baksik3 enug baksik_xmlinvoice
 
Fewd week5 slides
Fewd week5 slidesFewd week5 slides
Fewd week5 slides
 
Storytelling By Numbers
Storytelling By NumbersStorytelling By Numbers
Storytelling By Numbers
 
[4developers2016] PHP 7 (Michał Pipa)
[4developers2016] PHP 7 (Michał Pipa)[4developers2016] PHP 7 (Michał Pipa)
[4developers2016] PHP 7 (Michał Pipa)
 
PHP Conference Asia 2016
PHP Conference Asia 2016PHP Conference Asia 2016
PHP Conference Asia 2016
 
CLI, the other SAPI phpnw11
CLI, the other SAPI phpnw11CLI, the other SAPI phpnw11
CLI, the other SAPI phpnw11
 
Php & my sql
Php & my sqlPhp & my sql
Php & my sql
 

Similar to Androidの音声認識とテキスト読み上げ機能について

Android Best Practices
Android Best PracticesAndroid Best Practices
Android Best Practices
Yekmer Simsek
 
Overview of Android Infrastructure
Overview of Android InfrastructureOverview of Android Infrastructure
Overview of Android Infrastructure
Alexey Buzdin
 
Overview of Android Infrastructure
Overview of Android InfrastructureOverview of Android Infrastructure
Overview of Android Infrastructure
C.T.Co
 

Similar to Androidの音声認識とテキスト読み上げ機能について (20)

Introduction to Voice I/O on Android
Introduction to Voice I/O on AndroidIntroduction to Voice I/O on Android
Introduction to Voice I/O on Android
 
Writing Mirror API and Native Apps for Google Glass
Writing Mirror API and Native Apps for Google GlassWriting Mirror API and Native Apps for Google Glass
Writing Mirror API and Native Apps for Google Glass
 
Android Best Practices
Android Best PracticesAndroid Best Practices
Android Best Practices
 
Day 5
Day 5Day 5
Day 5
 
Clean coding-practices
Clean coding-practicesClean coding-practices
Clean coding-practices
 
Minicurso Android
Minicurso AndroidMinicurso Android
Minicurso Android
 
Android training day 5
Android training day 5Android training day 5
Android training day 5
 
Introduction to Android Wear - Peter Friese
Introduction to Android Wear - Peter FrieseIntroduction to Android Wear - Peter Friese
Introduction to Android Wear - Peter Friese
 
안드로이드 세미나 2
안드로이드 세미나 2안드로이드 세미나 2
안드로이드 세미나 2
 
안드로이드 세미나 2
안드로이드 세미나 2안드로이드 세미나 2
안드로이드 세미나 2
 
02 hello world - Android
02   hello world - Android02   hello world - Android
02 hello world - Android
 
mobl
moblmobl
mobl
 
Using the Windows 8 Runtime from C++
Using the Windows 8 Runtime from C++Using the Windows 8 Runtime from C++
Using the Windows 8 Runtime from C++
 
Slightly Advanced Android Wear ;)
Slightly Advanced Android Wear ;)Slightly Advanced Android Wear ;)
Slightly Advanced Android Wear ;)
 
Android studio plugin 作ってみた 〜 create intent method generator 〜
Android studio plugin 作ってみた 〜 create intent method generator 〜Android studio plugin 作ってみた 〜 create intent method generator 〜
Android studio plugin 作ってみた 〜 create intent method generator 〜
 
Backendless apps
Backendless appsBackendless apps
Backendless apps
 
Overview of Android Infrastructure
Overview of Android InfrastructureOverview of Android Infrastructure
Overview of Android Infrastructure
 
Overview of Android Infrastructure
Overview of Android InfrastructureOverview of Android Infrastructure
Overview of Android Infrastructure
 
Android For All The Things
Android For All The ThingsAndroid For All The Things
Android For All The Things
 
Android wear (coding)
Android wear (coding)Android wear (coding)
Android wear (coding)
 

More from moai kids

FluentdとRedshiftの素敵な関係
FluentdとRedshiftの素敵な関係FluentdとRedshiftの素敵な関係
FluentdとRedshiftの素敵な関係
moai kids
 
Twitterのsnowflakeについて
TwitterのsnowflakeについてTwitterのsnowflakeについて
Twitterのsnowflakeについて
moai kids
 
Programming Hive Reading #4
Programming Hive Reading #4Programming Hive Reading #4
Programming Hive Reading #4
moai kids
 
Programming Hive Reading #3
Programming Hive Reading #3Programming Hive Reading #3
Programming Hive Reading #3
moai kids
 
"Programming Hive" Reading #1
"Programming Hive" Reading #1"Programming Hive" Reading #1
"Programming Hive" Reading #1
moai kids
 
Casual Compression on MongoDB
Casual Compression on MongoDBCasual Compression on MongoDB
Casual Compression on MongoDB
moai kids
 
Introduction to MongoDB
Introduction to MongoDBIntroduction to MongoDB
Introduction to MongoDB
moai kids
 
Hadoop Conference Japan 2011 Fallに行ってきました
Hadoop Conference Japan 2011 Fallに行ってきましたHadoop Conference Japan 2011 Fallに行ってきました
Hadoop Conference Japan 2011 Fallに行ってきました
moai kids
 
HBase本輪読会資料(11章)
HBase本輪読会資料(11章)HBase本輪読会資料(11章)
HBase本輪読会資料(11章)
moai kids
 
第四回月次セミナー(公開版)
第四回月次セミナー(公開版)第四回月次セミナー(公開版)
第四回月次セミナー(公開版)
moai kids
 
第三回月次セミナー(公開版)
第三回月次セミナー(公開版)第三回月次セミナー(公開版)
第三回月次セミナー(公開版)
moai kids
 
Pythonで自然言語処理
Pythonで自然言語処理Pythonで自然言語処理
Pythonで自然言語処理
moai kids
 
HandlerSocket plugin Client for Javaとそれを用いたベンチマーク
HandlerSocket plugin Client for Javaとそれを用いたベンチマークHandlerSocket plugin Client for Javaとそれを用いたベンチマーク
HandlerSocket plugin Client for Javaとそれを用いたベンチマーク
moai kids
 
Yammer試用レポート(公開版)
Yammer試用レポート(公開版)Yammer試用レポート(公開版)
Yammer試用レポート(公開版)
moai kids
 
掲示板時間軸コーパスを用いたワードトレンド解析(公開版)
掲示板時間軸コーパスを用いたワードトレンド解析(公開版)掲示板時間軸コーパスを用いたワードトレンド解析(公開版)
掲示板時間軸コーパスを用いたワードトレンド解析(公開版)
moai kids
 
中国と私(仮題)
中国と私(仮題)中国と私(仮題)
中国と私(仮題)
moai kids
 
不自然言語処理コンテストLT資料
不自然言語処理コンテストLT資料不自然言語処理コンテストLT資料
不自然言語処理コンテストLT資料
moai kids
 
n-gramコーパスを用いた類義語自動獲得手法について
n-gramコーパスを用いた類義語自動獲得手法についてn-gramコーパスを用いた類義語自動獲得手法について
n-gramコーパスを用いた類義語自動獲得手法について
moai kids
 

More from moai kids (20)

中国最新ニュースアプリ事情
中国最新ニュースアプリ事情中国最新ニュースアプリ事情
中国最新ニュースアプリ事情
 
FluentdとRedshiftの素敵な関係
FluentdとRedshiftの素敵な関係FluentdとRedshiftの素敵な関係
FluentdとRedshiftの素敵な関係
 
Twitterのsnowflakeについて
TwitterのsnowflakeについてTwitterのsnowflakeについて
Twitterのsnowflakeについて
 
Programming Hive Reading #4
Programming Hive Reading #4Programming Hive Reading #4
Programming Hive Reading #4
 
Programming Hive Reading #3
Programming Hive Reading #3Programming Hive Reading #3
Programming Hive Reading #3
 
"Programming Hive" Reading #1
"Programming Hive" Reading #1"Programming Hive" Reading #1
"Programming Hive" Reading #1
 
Casual Compression on MongoDB
Casual Compression on MongoDBCasual Compression on MongoDB
Casual Compression on MongoDB
 
Introduction to MongoDB
Introduction to MongoDBIntroduction to MongoDB
Introduction to MongoDB
 
Hadoop Conference Japan 2011 Fallに行ってきました
Hadoop Conference Japan 2011 Fallに行ってきましたHadoop Conference Japan 2011 Fallに行ってきました
Hadoop Conference Japan 2011 Fallに行ってきました
 
HBase本輪読会資料(11章)
HBase本輪読会資料(11章)HBase本輪読会資料(11章)
HBase本輪読会資料(11章)
 
snappyについて
snappyについてsnappyについて
snappyについて
 
第四回月次セミナー(公開版)
第四回月次セミナー(公開版)第四回月次セミナー(公開版)
第四回月次セミナー(公開版)
 
第三回月次セミナー(公開版)
第三回月次セミナー(公開版)第三回月次セミナー(公開版)
第三回月次セミナー(公開版)
 
Pythonで自然言語処理
Pythonで自然言語処理Pythonで自然言語処理
Pythonで自然言語処理
 
HandlerSocket plugin Client for Javaとそれを用いたベンチマーク
HandlerSocket plugin Client for Javaとそれを用いたベンチマークHandlerSocket plugin Client for Javaとそれを用いたベンチマーク
HandlerSocket plugin Client for Javaとそれを用いたベンチマーク
 
Yammer試用レポート(公開版)
Yammer試用レポート(公開版)Yammer試用レポート(公開版)
Yammer試用レポート(公開版)
 
掲示板時間軸コーパスを用いたワードトレンド解析(公開版)
掲示板時間軸コーパスを用いたワードトレンド解析(公開版)掲示板時間軸コーパスを用いたワードトレンド解析(公開版)
掲示板時間軸コーパスを用いたワードトレンド解析(公開版)
 
中国と私(仮題)
中国と私(仮題)中国と私(仮題)
中国と私(仮題)
 
不自然言語処理コンテストLT資料
不自然言語処理コンテストLT資料不自然言語処理コンテストLT資料
不自然言語処理コンテストLT資料
 
n-gramコーパスを用いた類義語自動獲得手法について
n-gramコーパスを用いた類義語自動獲得手法についてn-gramコーパスを用いた類義語自動獲得手法について
n-gramコーパスを用いた類義語自動獲得手法について
 

Recently uploaded

Cloud Frontiers: A Deep Dive into Serverless Spatial Data and FME
Cloud Frontiers:  A Deep Dive into Serverless Spatial Data and FMECloud Frontiers:  A Deep Dive into Serverless Spatial Data and FME
Cloud Frontiers: A Deep Dive into Serverless Spatial Data and FME
Safe Software
 
Modular Monolith - a Practical Alternative to Microservices @ Devoxx UK 2024
Modular Monolith - a Practical Alternative to Microservices @ Devoxx UK 2024Modular Monolith - a Practical Alternative to Microservices @ Devoxx UK 2024
Modular Monolith - a Practical Alternative to Microservices @ Devoxx UK 2024
Victor Rentea
 
Finding Java's Hidden Performance Traps @ DevoxxUK 2024
Finding Java's Hidden Performance Traps @ DevoxxUK 2024Finding Java's Hidden Performance Traps @ DevoxxUK 2024
Finding Java's Hidden Performance Traps @ DevoxxUK 2024
Victor Rentea
 
+971581248768>> SAFE AND ORIGINAL ABORTION PILLS FOR SALE IN DUBAI AND ABUDHA...
+971581248768>> SAFE AND ORIGINAL ABORTION PILLS FOR SALE IN DUBAI AND ABUDHA...+971581248768>> SAFE AND ORIGINAL ABORTION PILLS FOR SALE IN DUBAI AND ABUDHA...
+971581248768>> SAFE AND ORIGINAL ABORTION PILLS FOR SALE IN DUBAI AND ABUDHA...
?#DUbAI#??##{{(☎️+971_581248768%)**%*]'#abortion pills for sale in dubai@
 
Why Teams call analytics are critical to your entire business
Why Teams call analytics are critical to your entire businessWhy Teams call analytics are critical to your entire business
Why Teams call analytics are critical to your entire business
panagenda
 
Cloud Frontiers: A Deep Dive into Serverless Spatial Data and FME
Cloud Frontiers:  A Deep Dive into Serverless Spatial Data and FMECloud Frontiers:  A Deep Dive into Serverless Spatial Data and FME
Cloud Frontiers: A Deep Dive into Serverless Spatial Data and FME
Safe Software
 

Recently uploaded (20)

WSO2's API Vision: Unifying Control, Empowering Developers
WSO2's API Vision: Unifying Control, Empowering DevelopersWSO2's API Vision: Unifying Control, Empowering Developers
WSO2's API Vision: Unifying Control, Empowering Developers
 
Web Form Automation for Bonterra Impact Management (fka Social Solutions Apri...
Web Form Automation for Bonterra Impact Management (fka Social Solutions Apri...Web Form Automation for Bonterra Impact Management (fka Social Solutions Apri...
Web Form Automation for Bonterra Impact Management (fka Social Solutions Apri...
 
Apidays New York 2024 - Scaling API-first by Ian Reasor and Radu Cotescu, Adobe
Apidays New York 2024 - Scaling API-first by Ian Reasor and Radu Cotescu, AdobeApidays New York 2024 - Scaling API-first by Ian Reasor and Radu Cotescu, Adobe
Apidays New York 2024 - Scaling API-first by Ian Reasor and Radu Cotescu, Adobe
 
Cloud Frontiers: A Deep Dive into Serverless Spatial Data and FME
Cloud Frontiers:  A Deep Dive into Serverless Spatial Data and FMECloud Frontiers:  A Deep Dive into Serverless Spatial Data and FME
Cloud Frontiers: A Deep Dive into Serverless Spatial Data and FME
 
Vector Search -An Introduction in Oracle Database 23ai.pptx
Vector Search -An Introduction in Oracle Database 23ai.pptxVector Search -An Introduction in Oracle Database 23ai.pptx
Vector Search -An Introduction in Oracle Database 23ai.pptx
 
Spring Boot vs Quarkus the ultimate battle - DevoxxUK
Spring Boot vs Quarkus the ultimate battle - DevoxxUKSpring Boot vs Quarkus the ultimate battle - DevoxxUK
Spring Boot vs Quarkus the ultimate battle - DevoxxUK
 
Polkadot JAM Slides - Token2049 - By Dr. Gavin Wood
Polkadot JAM Slides - Token2049 - By Dr. Gavin WoodPolkadot JAM Slides - Token2049 - By Dr. Gavin Wood
Polkadot JAM Slides - Token2049 - By Dr. Gavin Wood
 
Understanding the FAA Part 107 License ..
Understanding the FAA Part 107 License ..Understanding the FAA Part 107 License ..
Understanding the FAA Part 107 License ..
 
AWS Community Day CPH - Three problems of Terraform
AWS Community Day CPH - Three problems of TerraformAWS Community Day CPH - Three problems of Terraform
AWS Community Day CPH - Three problems of Terraform
 
DEV meet-up UiPath Document Understanding May 7 2024 Amsterdam
DEV meet-up UiPath Document Understanding May 7 2024 AmsterdamDEV meet-up UiPath Document Understanding May 7 2024 Amsterdam
DEV meet-up UiPath Document Understanding May 7 2024 Amsterdam
 
Modular Monolith - a Practical Alternative to Microservices @ Devoxx UK 2024
Modular Monolith - a Practical Alternative to Microservices @ Devoxx UK 2024Modular Monolith - a Practical Alternative to Microservices @ Devoxx UK 2024
Modular Monolith - a Practical Alternative to Microservices @ Devoxx UK 2024
 
Finding Java's Hidden Performance Traps @ DevoxxUK 2024
Finding Java's Hidden Performance Traps @ DevoxxUK 2024Finding Java's Hidden Performance Traps @ DevoxxUK 2024
Finding Java's Hidden Performance Traps @ DevoxxUK 2024
 
Mcleodganj Call Girls 🥰 8617370543 Service Offer VIP Hot Model
Mcleodganj Call Girls 🥰 8617370543 Service Offer VIP Hot ModelMcleodganj Call Girls 🥰 8617370543 Service Offer VIP Hot Model
Mcleodganj Call Girls 🥰 8617370543 Service Offer VIP Hot Model
 
[BuildWithAI] Introduction to Gemini.pdf
[BuildWithAI] Introduction to Gemini.pdf[BuildWithAI] Introduction to Gemini.pdf
[BuildWithAI] Introduction to Gemini.pdf
 
EMPOWERMENT TECHNOLOGY GRADE 11 QUARTER 2 REVIEWER
EMPOWERMENT TECHNOLOGY GRADE 11 QUARTER 2 REVIEWEREMPOWERMENT TECHNOLOGY GRADE 11 QUARTER 2 REVIEWER
EMPOWERMENT TECHNOLOGY GRADE 11 QUARTER 2 REVIEWER
 
Artificial Intelligence Chap.5 : Uncertainty
Artificial Intelligence Chap.5 : UncertaintyArtificial Intelligence Chap.5 : Uncertainty
Artificial Intelligence Chap.5 : Uncertainty
 
+971581248768>> SAFE AND ORIGINAL ABORTION PILLS FOR SALE IN DUBAI AND ABUDHA...
+971581248768>> SAFE AND ORIGINAL ABORTION PILLS FOR SALE IN DUBAI AND ABUDHA...+971581248768>> SAFE AND ORIGINAL ABORTION PILLS FOR SALE IN DUBAI AND ABUDHA...
+971581248768>> SAFE AND ORIGINAL ABORTION PILLS FOR SALE IN DUBAI AND ABUDHA...
 
Why Teams call analytics are critical to your entire business
Why Teams call analytics are critical to your entire businessWhy Teams call analytics are critical to your entire business
Why Teams call analytics are critical to your entire business
 
Cloud Frontiers: A Deep Dive into Serverless Spatial Data and FME
Cloud Frontiers:  A Deep Dive into Serverless Spatial Data and FMECloud Frontiers:  A Deep Dive into Serverless Spatial Data and FME
Cloud Frontiers: A Deep Dive into Serverless Spatial Data and FME
 
Connector Corner: Accelerate revenue generation using UiPath API-centric busi...
Connector Corner: Accelerate revenue generation using UiPath API-centric busi...Connector Corner: Accelerate revenue generation using UiPath API-centric busi...
Connector Corner: Accelerate revenue generation using UiPath API-centric busi...
 

Androidの音声認識とテキスト読み上げ機能について

  • 2.
  • 3.
  • 4.
  • 5.
  • 6.
  • 7. Android iPhone Android iPhone API Android
  • 8.
  • 9.
  • 10. Google API ( ) Android API
  • 11.
  • 12. Google API (TTS:Text-To-Speech Android API
  • 13.
  • 14. Android → → →
  • 17.
  • 18. Activity Activity
  • 19. → →Droid Jammer droid → →Twitroid Twitter →
  • 21. Intent // recognitionButton.setOnClickListener(new OnClickListener(){ @Override public void onClick(View v) { try { Intent intent = new Intent( RecognizerIntent.ACTION_RECOGNIZE_SPEECH); intent.putExtra( RecognizerIntent.EXTRA_LANGUAGE_MODEL, RecognizerIntent.LANGUAGE_MODEL_FREE_FORM); intent.putExtra( RecognizerIntent.EXTRA_PROMPT, getText(R.string.dialog_recognition)); startActivityForResult(intent, REQUEST_CODE); } catch (ActivityNotFoundException e) { } } });
  • 22. Intent // recognitionButton.setOnClickListener(new OnClickListener(){ @Override public void onClick(View v) { try { Intent intent = new Intent( RecognizerIntent.ACTION_RECOGNIZE_SPEECH); intent.putExtra( RecognizerIntent.EXTRA_LANGUAGE_MODEL, RecognizerIntent.LANGUAGE_MODEL_FREE_FORM); intent.putExtra( RecognizerIntent.EXTRA_PROMPT, getText(R.string.dialog_recognition)); LANGUAGE_MODEL_WEB_SEARCH startActivityForResult(intent, REQUEST_CODE); Web } catch (ActivityNotFoundException e) { } LANGUAGE_MODEL_FREE_FORM } });
  • 23. protected void onActivityResult(int requestCode, int resultCode, Intent data) { if (requestCode == REQUEST_CODE && resultCode == RESULT_OK) { String resultsString = ""; // ArrayList<String> results = data.getStringArrayListExtra( RecognizerIntent.EXTRA_RESULTS); for (int i = 0; i< results.size(); i++) { resultsString += results.get(i); } this.searchText.setText(resultsString); } super.onActivityResult(requestCode, resultCode, data); }
  • 24. → API Google 3G Wifi →Google →Activity → → Android →
  • 25. → ※ RecognizerIntent.EXTRA_LANGUAGE
  • 26. mp3 API → • Google API → ML
  • 27. Text-To-Speech API (android.speech.tts.TextToSpeech) android.intent.action.START_TTS_SERVICE Activity
  • 28. TTS //TTS @Override public void onInit(int status) { if(status == TextToSpeech.SUCCESS){ if(tts.isLanguageAvailable(Locale.US) == TextToSpeech.LANG_MISSING_DATA){ new AlertDialog.Builder(this).setTitle("warning").setMessage("tts(us) not supprted").show(); }else{ tts.setLanguage(Locale.US); tts.setPitch(1.8f); tts.setSpeechRate(0.8f); } }else{ new AlertDialog.Builder(this).setTitle("error").setMessage("tts#onInit error").show(); finish(); } }
  • 29. TTS //TTS @Override public void onInit(int status) { if(status == TextToSpeech.SUCCESS){ if(tts.isLanguageAvailable(Locale.US) == TextToSpeech.LANG_MISSING_DATA){ new AlertDialog.Builder(this).setTitle("warning").setMessage("tts(us) not supprted").show(); }else{ tts.setLanguage(Locale.US); tts.setPitch(1.8f); tts.setSpeechRate(0.8f); } }else{ new AlertDialog.Builder(this).setTitle("error").setMessage("tts#onInit error").show(); finish(); } }
  • 30. SearchResult result = currentResult.get(position); if(tts.isSpeaking()){ tts.stop(); } HashMap<String, String> params = new HashMap<String, String>(); params.put(TextToSpeech.Engine.KEY_PARAM_STREAM,String.valueOf (AudioManager.STREAM_MUSIC)); tts.speak(result.getChn(), TextToSpeech.QUEUE_FLUSH, params); ※ ※ (tts.isSpeaking()
  • 31. SearchResult result = currentResult.get(position); if(tts.isSpeaking()){ tts.stop(); } HashMap<String, String> params = new HashMap<String, String>(); params.put(TextToSpeech.Engine.KEY_PARAM_STREAM,String.valueOf (AudioManager.STREAM_MUSIC)); tts.speak(result.getChn(), TextToSpeech.QUEUE_FLUSH, params); STREAM_ALARM ※ STREAM_MUSIC ※ STREAM_NOTIFICATION (tts.isSpeaking()
  • 32. Text-To-Speech API http://eyes-free.googlecode.com/ eSpeak TTS PICO Google TTS 20 C
  • 33. Text-To-Speech API http://gimite.net/pukiwiki/index.php?Android%20JaTTS Android mp3 Galatea Talk http://hil.t.u-tokyo.ac.jp/~galatea/index-jp.html
  • 34.
  • 35.
  • 36. TTS Expanded Android JaTTS →Android
  • 37.