List of usage examples for android.speech.tts TextToSpeech getMaxSpeechInputLength
public static int getMaxSpeechInputLength()
From source file:ca.rmen.android.poetassistant.PoemAudioExport.java
void speakToFile(TextToSpeech textToSpeech, String text) { final File audioFile = getAudioFile(); if (audioFile == null) { notifyPoemAudioFailed();//from www . j a va2 s .c o m } else { EventBus.getDefault().register(this); notifyPoemAudioInProgress(); String textToRead = text.substring(0, Math.min(text.length(), TextToSpeech.getMaxSpeechInputLength())); Completable.fromRunnable(() -> deleteExistingAudioFile(audioFile)).subscribeOn(Schedulers.io()) .observeOn(AndroidSchedulers.mainThread()) .subscribe(() -> speakToFile(textToSpeech, textToRead, audioFile)); } }