aard2-android icon indicating copy to clipboard operation
aard2-android copied to clipboard

Added Text to Speech feature

Open bpanthi977 opened this issue 5 years ago • 4 comments

Hello! I have tried to add text to speech feature to the app. I guess requires some finishing touch but it works. A "Text to Speech" option is added to the activity bar and on clicking that the TTS api of android is used to read out the text. The speech can be cancled by clicking the button again.

bpanthi977 avatar Aug 18 '19 02:08 bpanthi977

Could you create a apk-file of it, so I could test it? I have not the time to create it myself at the moment, thanks. Frank

francwalter avatar Aug 18 '19 07:08 francwalter

This is the debug build I tested on. debug.zip

bpanthi977 avatar Aug 18 '19 15:08 bpanthi977

This is an interesting proof of concept, but there are issues that would need to be resolved before it can be seriously considered for addition. The biggest one is TTS language and language selection. Just setting it to English doesn't cut it. TTS language needs to be set to that of the content. For HTML content, language can be specified with lang attribute for the entire document and/or individual elements. So to read it correctly, all the parts in various languages have to be fed into corresponding TTS engine instances (one per language) in the order in which they should be read. For plain text content tts language would have to come from somewhere else, maybe a tag in the dictionary that explicitly specifies content language. All the dictionary converters would need to be updated to mark html articles with lang attribute and/or include a dictionary tag specifying content language (and then all the dictionaries recompiled). TTS language probably also needs to be user-selectable, per dictionary, for the cases where it can't be determined from the content or the dictionary. User experience would also need to be improved: starting reading from the beginning each time after speech is cancelled only useable for very short text.

itkach avatar Aug 19 '19 03:08 itkach

I agree with you. I will surely get back to it after my exams are over. Moreover each language can have multiple voices installed, so I guess we will have to implement interface to select voice also.

On 19 Aug 2019 9:15 a.m., "itkach" [email protected] wrote:

This is an interesting proof of concept, but there are issues that would need to be resolved before it can be seriously considered for addition. The biggest one is TTS language and language selection. Just setting it to English doesn't cut it. TTS language needs to be set to that of the content. For HTML content, language can be specified with lang attribute for the entire document and/or individual elements. So to read it correctly, all the parts in various languages have to be fed into corresponding TTS engine instances (one per language) in the order in which they should be read. For plain text content tts language would have to come from somewhere else, maybe a tag in the dictionary that explicitly specifies content language. All the dictionary converters would need to be updated to mark html articles with lang attribute and/or include a dictionary tag specifying content language (and then all the dictionaries recompiled). TTS language probably also needs to be user-selectable, per dictionary, for the cases where it can't be determined from the content or the dictionary. User experience would also need to be improved: starting reading from the beginning each time after speech is cancelled only useable for very short text.

— You are receiving this because you authored the thread. Reply to this email directly, view it on GitHub https://github.com/itkach/aard2-android/pull/100?email_source=notifications&email_token=AEGM7K4SUKZPVAX3X2BHSUTQFIHXDA5CNFSM4IMRDFY2YY3PNVWWK3TUL52HS4DFVREXG43VMVBW63LNMVXHJKTDN5WW2ZLOORPWSZGOD4RSVMA#issuecomment-522398384, or mute the thread https://github.com/notifications/unsubscribe-auth/AEGM7K575KBTZBIJW7D4UBTQFIHXDANCNFSM4IMRDFYQ .

bpanthi977 avatar Aug 19 '19 10:08 bpanthi977