Highlight sentence being read by TTS
The benefit is that it helps keep the eyes focused on what's being read.
I am planning to do this work, but I have no write permission now. I have a [Pull requests] waiting for merge now
Hi @testwind , it is great that you are planning to do this work, because sentence highlighting will be a very useful feature. How is it going for you with getting the write permissions?
I have made TTS sentence high light function for another Reader App.
- Split paragraph to sentences by punctuation mark.
- High light the split sentence.
- Auto turn page during TTS reading.
- Auto scroll page during TTS reading in horizontal mode. Keep high light sentence in the 2/5 middle of screen.
I am not contributor of this project, so I can not push commit, I have one pull request waiting for merge. The waiting time for a merge is too long. Can you give me permission to push commit ? @Hromakov
@testwind , I am also not the contributor of this project, so cannot give you this permission. Wrote an email to the project administrators asking them to provide you with the write access.
FYI @foobnix
@testwind , can you share the link to the pull request with sentence highlighting feature?
You can also create a fork if it takes to long and upstream your changes.
Foobnix is currently busy with the war in ukraine, so he wont be available for a while.
@testwind @DeanLemans @Hromakov
one general question.
when using "Librera Reader" source code , I need the current chapter text needs to preprocessed by sending to an API and show the output from API instead.
The API:
curl "https://generativelanguage.googleapis.com/v1beta/models/gemini-2.0-flash:generateContent?key=$GEMINI_API_KEY" \
-H 'Content-Type: application/json' \
-X POST \
-d '{
"contents": [{
"parts":[{"text": "translate to Tamil. Return the story only"}]
}]
}' 2> /dev/null
Is that possible ?
@RageshAntonyHm I think you have two methods ,
- translate the whole book , epub file, and read the new book. Epub is just html , you can translate the content.
- translate some sentences during reading time: LibreraReader can long press some word and popup a window for http translate
Hi @testwind , I would like to add the text highlighting during text-to-speech, but it seems to be complex. I have to use UtteranceProgressListener and somehow access the text contents as they are read. If you have an idea of possible solutions, could you please let me know?
@Hromakov
- Every page are PDF images. You can get the content strings of each page, and the string character’s position.
- Split one paragraph’s sentence by chars [,.;?!], and get a sentence list.
- Sent the list to TTS, and start speak
- When a sentence is played, you can receive a “STOP” and next new “START”.
- Check your sentence list to find the current character’s position. Top-left , bottom-right
- Draw a transparent color rectangle of the current sentence.
- Some long sentence has multi-lines, you should draw more than one rectangle.
- Also should check the sentence in two page.
- Clear the previous highlight before draw the new highlight.
- The page should be able to scroll automatically. Some you should change the current page’s position by calculate the reading sentence.
Hi @testwind , Thank you!
I am planning to do this work, but I have no write permission now. I have a [Pull requests] waiting for merge now
Hey, have you done this change possibly for your fork of this project? Tried to understand the changes in your commits there but I just got lost. Then lost a few hours trying to build it, but didn't see a highlight option in the tts settings.