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

Character limit + text highlighting #1

Open
strikerlulu opened this issue Jan 20, 2020 · 11 comments · Fixed by #5
Open

Character limit + text highlighting #1

strikerlulu opened this issue Jan 20, 2020 · 11 comments · Fixed by #5
Assignees
Labels
bug Something isn't working

Comments

@strikerlulu
Copy link

It shows "There was an error during speech synthesis" toast message..... Does it have limit for characters ? which we can paste and [speak text]

@drmfinlay
Copy link
Owner

I haven't noticed any character limits in the app. If there are any limits, they certainly weren't intentional on my part. Is the message only occurring for a large amount of text?

Could you please let me know what Android version you're using and which text-to-speech engine is selected in the settings (e.g. Pico TTS).

@strikerlulu
Copy link
Author

strikerlulu commented Jan 22, 2020

Android 10
I was using Google TTS
and the language was Malayalam (India)

@drmfinlay
Copy link
Owner

Thanks 👍. I will do some testing and see if I can reproduce and fix the problem.

Incidentally, let me know if the clipboard-related features don't work properly in Android 10. Google added some privacy features for clipboard access which I couldn't find much documentation on at the time.

@drmfinlay drmfinlay self-assigned this Jan 24, 2020
@drmfinlay drmfinlay added the bug Something isn't working label Jan 24, 2020
@strikerlulu
Copy link
Author

Its working when i paste the text in a file and try to use [read from file]
But the same text is not working on [Read text] and [Read from clipboard] i think its something related to the edit text or something else....

@strikerlulu
Copy link
Author

test
Is is hard to implement functionality like this ?
(Highlighting current text which is synthesizing)

@drmfinlay
Copy link
Owner

Thanks. I agree that it sounds like a problem with the edit text fields.

It should be possible to highlight the current text being synthesized within the text fields, but only with the current chunk of text being read. It would highlight paragraphs at a time, rather than individual words. I could add a setting for queuing words as single utterances, but this might change how the text-to-speech engine pronounces the input. I'd have to do some testing and get back to you on that.

@strikerlulu
Copy link
Author

Ok thanks,also a continue button would be nice...so instead of starting it from the begging it could continue where it stopped...

@drmfinlay
Copy link
Owner

That's a good idea. There should probably be separate buttons for stopping, pausing and resuming. I'll see if I can add those in. It would also be nice if the notification allowed for finer control like this.

As a side note, mostly for future me, the text field should be locked/disabled during text-to-speech output or if audio output has been paused because it doesn't make sense to edit while speech is occurring, especially if we're highlighting the text as we go.

BTW these new features should really be in separate issues. I'll try to open some new ones soon :)

@drmfinlay
Copy link
Owner

@strikerlulu Don't worry about my technobabble below, just making a few notes on this feature while I think of it :)

If an utterance was in progress when paused, then it has to be repeated once speech output is resumed because, unfortunately, Android's text-to-speech API does not give us the level of fine-grained control needed to pick up again in the middle of an utterance.

However, we can get around this by synthesising input text as a wave file internally and then playing it, keeping track of the playback position like music apps must do. This also avoids splitting up the input into one utterance per word.

Hopefully this approach doesn't mean there will be more of a delay before speech output starts. If it does create a noticeable delay, then we can try to sensibly split input text into smaller chunks and synthesize those into wave files one at a time. We could also just have one of those spinning progress things while the text is processed, that might be simpler.

drmfinlay added a commit that referenced this issue Jun 2, 2020
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.
drmfinlay added a commit that referenced this issue Jun 12, 2020
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.
@drmfinlay
Copy link
Owner

@strikerlulu I thought I would let you know that the input limit you discovered with TTSUtil will be fixed in the next release for both text-to-speech output and wave file synthesis.

Regarding the highlighting, skip backward/forward and play/pause functionality, I don't think I will be able to implement that. It would be quite involved and I am hesitant to add new features. You could use the app to create wave files to do the playback control part in a separate media player app.

If it helps, Firefox's Reader View has text-to-speech with highlighting as text is read. I imagine Chrome has something similar. There are probably other solutions out there too.

@drmfinlay drmfinlay changed the title Limit Character limit + text highlighting Sep 13, 2022
@drmfinlay
Copy link
Owner

I'm reopening this issue for the text highlighting part, @strikerlulu. I think that can be implemented in a future version. However, it will only work in the application's own text input fields.

@drmfinlay drmfinlay reopened this Sep 13, 2022
drmfinlay added a commit that referenced this issue May 21, 2023
This will be used by the UI code to highlight currently spoken text,
as discussed in issue #1.

The TaskProgressObserver interface has been renamed to TaskObserver.
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug Something isn't working
Projects
None yet
Development

Successfully merging a pull request may close this issue.

2 participants