Skip to content
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

Added support for Samsung TTS Engine #24

Merged
merged 7 commits into from
Jun 25, 2024
Merged

Conversation

JingziC
Copy link
Contributor

@JingziC JingziC commented Jun 24, 2024

Hello,

Thank you so much for the awesome offline realtime translator app. It is very convenient and helpful even without text-to-speech services. I tried to modify the "app/src/main/java/nie/translator/rtranslator/tools/TTS.java" to support the Samsung TTS engine in this app and tested on the Samsung Galaxy S21 with Android 14. The built app could use text-to-speech engine from Samsung successfully.

As mentioned in Issue #8 and #15, it sometimes could not load Google TTS engine thus disable text-to-speech functionality. I also encountered this bug and noticed that only Samsung's TTS engine could be loaded when importing "android.speech.tts.TextToSpeech" and the Google TTS Engine was missed (although Google TTS engine was set as the default text-to-speech output). Thus the app could not find the correct text-to-speech engine.

In the modified TTS.java, some lines pairing the engine and corresponding available languages were added. It is expected to support at least samsung's engine while keeping compatible with the Google TTS engine in previous program.

However, it still requires validations on other devices. The program for validation has been built in an .apk file for a quick check and also can be built from this branch.

Available TTS Engine from "android.speech.tts.TextToSpeech" (https://github.com/JingziC/TTSLister was used to check the available tts engines on device directly):

Available_TTS_Engine

@JingziC JingziC marked this pull request as draft June 24, 2024 17:02
@JingziC JingziC marked this pull request as ready for review June 24, 2024 17:04
@niedev
Copy link
Owner

niedev commented Jun 24, 2024

Thank you for the appreciation and for your contribution! Tomorrow I will check your changes 👍

@JingziC JingziC changed the title Add support to Samsung TTS Engine Try to add support for Samsung TTS Engine Jun 24, 2024
@niedev
Copy link
Owner

niedev commented Jun 25, 2024

Great work, thanks!

I made some changes to the format of the code and for some comments, and I restored the default low quality value to false.

The default behavior of the app is to not show languages ​​with low quality TTS, if Japanese does not have high quality it is not a problem, in that case the user can still use the language by changing the RTranslator settings, but knowing that the quality of the TTS is lower than normal.

I will do other tests and then merge the pull request.

@niedev
Copy link
Owner

niedev commented Jun 25, 2024

Ok, with the quality threshold set to QUALITY_HIGH, the supported languages with Samsung TTS were only 3. So I lowered the default threshold to QUALITY_NORMAL.

Plus I discovered a bug where the low-quality TTS option in RTranslator wasn't working (in case you noticed something was wrong this was it), I will correct it right after the merge.

I tested everything else and it works, so I will merge the pull request.

@niedev niedev changed the title Try to add support for Samsung TTS Engine Added support for Samsung TTS Engine Jun 25, 2024
@niedev niedev merged commit ea0d7b0 into niedev:v2.00 Jun 25, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

None yet

2 participants