Create Text to speech converter app using Sketchware
If you haven't yet watched the video , watch it right now !
Open Sketchware. Create new project .Go to the logic section . In on Create event , add the following code
t1=new android.speech.tts.TextToSpeech(getApplicationContext(), new android.speech.tts.TextToSpeech.OnInitListener() {
@Override public void onInit(int status) {
if(status != android.speech.tts.TextToSpeech.ERROR) {
t1.setLanguage(Locale.UK); } } });
}android.speech.tts.TextToSpeech t1;
private void nothing(){
@Override public void onInit(int status) {
if(status != android.speech.tts.TextToSpeech.ERROR) {
t1.setLanguage(Locale.UK); } } });
}android.speech.tts.TextToSpeech t1;
private void nothing(){
Go to the logic section and tap on Button1 on Click event
Create a string variable named "speak". Now set the value of that string variable using blocks.
Please watch the above video for Reference.
Now use add source directly block and add the following code
t1.speak(speak, android.speech.tts.TextToSpeech.QUEUE_FLUSH, null);
Run the app.
If you have any doubts comment below
How to change Language?
ReplyDeleteJust instead of the first code, insert this t1=new android.speech.tts.TextToSpeech(getApplicationContext(), new android.speech.tts.TextToSpeech.OnInitListener() {
Delete@Override public void onInit(int status) {
if(status != android.speech.tts.TextToSpeech.ERROR) { } } });
}android.speech.tts.TextToSpeech t1;
private void nothing(){