Play an audio file as soon as Text To Speech is completed in Android

孤者浪人 提交于 2020-01-02 05:34:05

问题


I'm trying to develop an Android app where as soon as the text to speech is completed an audio file has to be played. How to do this?


回答1:


If I didn't get wrong idea, you want to use text-to-speech to read some text and store the speech audio into phone in the meantime? And play the audio later?

Have you checked AudioRecordTest? You can record audio and then play it later. Worth to try but I don't think you can get a good quality from the microphone. Hope this helps:)

By the way, as far as I know, android only support to record from mic for unrooted phone, which you can check here. Let me know if you can record sound source from the android system.




回答2:


I have found the solution and that is in the method onUtteranceCompletedListener() we can know whether the speech is stopped or not and then we can write the code to play the audio file



来源:https://stackoverflow.com/questions/6222823/play-an-audio-file-as-soon-as-text-to-speech-is-completed-in-android

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!