-
Notifications
You must be signed in to change notification settings - Fork 19
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Release version 2.0 #5
Merged
Conversation
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This is being done in an effort to simplify the TextToSpeech API use.
- Replace checkTTS() method and usages with OnInitListener in SpeakerActivity classes. - Add four SpeakerActivity methods for dialog events and override them in QuickShareActivity. - Display a message if TTS initialisation fails. - Display messages if the selected and/or default speaker languages are not available. - Fallback on default language if the selected language is not available.
This is useful for applying changes to the TTS settings.
The icon is the built-in Android 'ic_menu_preferences' icon.
Notifications may not get dismissed automatically if the TTS engine is reinitialised. This makes sure they are removed.
This is to simplify and have consistency between the listener classes. Also for the next changes.
SpeakerEventListeners are able to check if speech synthesis is stopping.
An application context should not be used for creating alert dialogs. They seem to require a UI Context object, e.g. an Activity.
This adds different messages for each error code that can be passed to the UtteranceProgressListener.onError() method.
Re: #1. Long lines like this are now split into multiple smaller lines of reasonable length before they are passed to the TTS engine. This has not been implemented for Speaker.synthesizeToFile() yet.
These tasks will not succeed if the app is slow to post notifications or acquire audio focus, so we try to cancel them asynchronously in roughly 300 ms time. This is only an issue for onError() utterance events.
The current system locale is the preferred language as set in the system settings. The app was previously falling back on the default JVM locale, which doesn't change.
Show proper error messages if trying to synthesise text after TTS engine initialisation failed or if TTS isn't ready.
This was
linked to
issues
Jun 4, 2020
Closed
This is instead of using '.mp4'.
The main function in this file is joinWaveFiles(). It uses Java File objects. Only compatible PCM wave files can be joined. I have kept this implementation in a separate file without Android imports so it can be used on other platforms.
Closes #1. This works around Android's maximum speech input length for TTS file synthesis. Long text files are now split up, synthesised into smaller wave files and then joined back together as one larger wave file after all parts are synthesised successfully.
In my testing, I have noticed some utterances give repeated events. Using a set instead of a list works around that problem.
In this case, the single input file can just be written to the output file. This also handles the special case of a TTS engine that synthesises sound files of a different type (e.g. MP3 instead of wave). I note here that Android's TextToSpeech documentation makes no specific reference to wave files. That said, I have not encountered any other sound file type.
This required a few changes to the Speaker and SpeakerEventListener classes as well as storing notification *builders* instead so the existing notifications could be updated.
This is so utterance progress is shown in the notification when reading text files. This should have been done in the first place given that the TextToSpeech.speak() method is asynchronous.
This more makes sense because the class is only used via inheritance, never directly.
This commit makes the following notable changes: - Add Android support preference library (v7) as a dependency. - Add settings fragment for changing the app's TTS settings. - Add/change code in the ApplicationEx, SpeakerActivity and Speaker classes for applying the preferred TTS engine settings. - Add four material design icons used in the settings fragment. - Move code for opening system TTS settings into SpeakerActivity.
The app won't set the speech rate or pitch unless they are chosen in the app's TTS settings.
This allows resetting the app's TTS settings so that the system TTS settings will be used instead.
Many parts of Android's TextToSpeech API require at least this version. In my view, supporting version 20 is not worth the many conditional branches currently in the codebase. As a side note, I cannot even create an emulator for SDK version 20 to test with!
This app and other text-to-speech client apps can be sent parcelled exceptions via TextToSpeech class methods to be raised after being decoded. In my experience, these exceptions have all been NullPointerExceptions. They have only occurred for me on Android Lollipop 5.0/5.1 and only with Voice-related methods such as getVoice(). This change works around these errors by adding and using Speaker properties that catch these exceptions and return empty/null values.
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
Closes #1, #2, #4, #6.
There are quite a few changes, mostly bug fixes and improvements, plus a few additions. There are still a few things I need to fix. I will update this post with a summary of the changes before merging.
Summary