foobnix / LibreraReader

Book Reader for Android
http://librera.mobi
Other
2.87k stars 305 forks source link

TTS re-ordering words for no reason #1115

Closed rlpowell closed 9 months ago

rlpowell commented 1 year ago

OK this issue is really weird and hard to describe, so bear with me.

In this screenshot you'll see "After a moment, accolades began":

2023-05-07_10-16-32--Screenshot_20230507-101632

In this screenshot, you'll see "After moment, accolades begana":

2023-05-07_10-16-42--Screenshot_20230507-101642

The HTML for that section of the epub is:

<p style="margin-bottom: 0; font-style: normal; font-weight: normal" align="left"> </p>
<p style="margin-bottom: 0"><span style="font-style: normal"><span style="font-weight: normal">Ameliah ran a hand through her hair, sitting against the workbench. “</span></span><span style="font-style: normal"><span style="font-weight: normal">Depths, how didn’t I know about this?”</span></span></p>
<p style="margin-bottom: 0; font-style: normal; font-weight: normal" align="left"> </p>
<p style="margin-bottom: 0">“Here,” Rain said, concentrating. After a moment, accolades began clattering to the tabletop. “Take all the Speed boosting ones and the Perception one as well. You can train with those while I work on Strength. We can swap at some point. Tallheart, do you want in on this? I’ll give you all the Endurance ones. A plus three shouldn’t be too bad for you, right?”</p>
<p style="margin-bottom: 0; font-style: normal; font-weight: normal" align="left"> </p>
<p style="margin-bottom: 0">Tallheart rumbled noncommittally, but Rain was barely paying attention. He grinned at them both. “This is so cheese.”</p>

This taking of a word (normally the last word on the line) and shoving it to mush with another word is happening to me about every uh 3 pages or so maybe? Changing the font size changes which words it happens to, but doesn't stop it.

This still happens on beta 8.9.12

I have TTS replacements turned off.

I feel like this only started uh maybe a month ago?, so I feel like it was a recent change?, but it could also be a problem with this serious of books I'm reading, I'm not completely certain. I think that it started happening when I was in the middle of a book, so it would have had to be a software change, but as I said I'm not completely certain.

You can find the book that those examples came from at http://users.digitalkingdom.org/~rlpowell/media/public/002-Delve%20101-150.epub ; I can try a different book of your choice if you like.

rlpowell commented 1 year ago

Second example; the word "DO" moves in a very obvious fashion:

2023-05-07_10-08-05--Screenshot_20230507-100805 2023-05-07_10-08-19--Screenshot_20230507-100819

HTML is:

<p style="margin-bottom: 0; font-style: normal; font-weight: normal" align="left"> </p>
<p style="margin-bottom: 0">“You are correct, Rain,” Tallheart said, ignoring Ameliah’s sudden uncontrollable laughter. “My armor boosts my Endurance significantly. I have never been able to use Endurance accolades without pain. This formula….hmm. Now I understand why.”</p>
<p style="margin-bottom: 0; font-style: normal; font-weight: normal" align="left"> </p>
<p style="margin-bottom: 0">“<span style="font-style: normal"><span style="font-weight: normal">Depths, Tallheart, don’t </span></span><span style="font-style: normal"><span style="font-weight: normal">DO</span></span><span style="font-style: normal"><span style="font-weight: normal"> that!” Rain said, </span></span><span style="font-style: normal"><span style="font-weight: normal">pressing his hand to his chest</span></span><span style="font-style: normal"><span style="font-weight: normal">. </span></span><em><span style="font-weight: normal">He doesn’t have Soften Steps any more, so how didn’t I hear him?</span></em></p>
<p style="margin-bottom: 0; font-style: normal; font-weight: normal" align="left"> </p>
<p style="margin-bottom: 0">“Never lose focus on your surroundings,” Tallheart said as Ameliah managed to get herself back under control. Clearly, <em>she’d</em> heard Tallheart coming and had elected not to say anything.</p>
<p style="margin-bottom: 0; font-style: normal; font-weight: normal" align="left"> </p>
CaitlinMkaKatie commented 1 year ago

That's really weird, but I Can add something similar. When I let read my book by TTS in German, it switches the words E.g. < Moira war fasziniert von der offenen Tür> it read as <Moira fasziniert ist von Tür offen> which the second ist totally wrong German Grammar that hurts the eyes and ears

foobnix commented 1 year ago

Could you please send me a book, the link is not working (http://users.digitalkingdom.org/~rlpowell/media/public/002-Delve%20101-150.epub)

foobnix commented 1 year ago

Please also try to reset profile setting, or try to create new profile and check... it's a very strange. And send me please a book to verify.

CaitlinMkaKatie commented 1 year ago

Please also try to reset profile setting, or try to create new profile and check... it's a very strange. And send me please a book to verify.

That sorrowfully I must decline. The sending of my own book as it is a W.in.P. Project and not published yet. 2nd issue fodr me personally: I'm no dev - i'm a writer and user - idk how i shall dreate new profil and then that it works for me :-S

rlpowell commented 1 year ago

Try this: https://users.digitalkingdom.org/~rlpowell/media/public/delve-test.epub ; the link was actually fine, browsers are just getting weird about non-https redirects these days, but I've fixed it. Also I don't know how else to send you a book. :)

rlpowell commented 1 year ago

delve-test.zip

^^ Ah, I suppose that works.

rlpowell commented 1 year ago

I have created a new profile; I'll let you know how it goes, since it only happens every 10 pages or so most of the time.

rlpowell commented 1 year ago

New profile did not work ("OfIt uniformity"):

Screenshot_20230516-224123

Screenshot_20230516-224117

rlpowell commented 1 year ago

As far as I can recall the only things I changed on the new profile were the font size and the TTS speed.

rlpowell commented 1 year ago

I was also able to repro it with a totally different book. However it did not work with a profile in which I changed nothing. At this point I'm reasonably certain it's font size based; at the default font size of 21 it doesn't seem to happen, or it's so rare I haven't noticed yet. At 30 it happens every few pages, even on an otherwise fresh profile.

rlpowell commented 1 year ago

I've had it happen at font size 25 and 23 too. -_-;

rlpowell commented 1 year ago

Unfortunately, I just had it happen with a completely fresh and unchanged profile, so it's not actually tied to font size, it just happens less often. The issue here is in the last line of the on-screen text.

Screenshot_20230520-154823 Screenshot_20230520-154830 Screenshot_20230520-154842

rlpowell commented 1 year ago

I did a completely fresh install; that is, I deleted cache and data, uninstalled, deleted the Librera directory, installed the amd64 beta APK. Also, this is a different phone.

Once launched, the only changes I made were to increase the speech speed and the font size. It still happens. I also tried with and without hyphenation; it happens both ways.

I'm going to try a binary search across older versions.

rlpowell commented 1 year ago

It happened on 8.9.5 with in a couple of minutes. It did not happen on 8.8.107 after a couple of hours. The change is in there somewhere.

rlpowell commented 1 year ago

FWIW, I was able to trivially reproduce this issue in exactly the same way as https://github.com/foobnix/LibreraReader/issues/1085#issuecomment-1575441091 (and, indeed, in the same session). The issue occurs on page 1188:

image

image

rlpowell commented 1 year ago

Unfortunately, I've now conclusively narrowed it to a6d8fd038e7927196549aa2647ab2b02340cba7c , which is the hash where MuPDF was changed to 1.22.0. Which means it could be any of the many changes in that hash, or something in MuPDF itself. :sigh:

rlpowell commented 1 year ago

HOLY CRAP that was a TON of work, binary searching through MuPDF and waiting like 45 minutes for each build, but: this was caused by https://github.com/ArtifexSoftware/mupdf/commit/500c0299af8d086d0a20bb2c3a1e7d5c72872cc9 , which is the fix to https://bugs.ghostscript.com/show_bug.cgi?id=706426

It is fixed in https://bugs.ghostscript.com/show_bug.cgi?id=706642 , which isn't in a tagged release of MuPDF yet, which is why we've got the bugfix-bug and not the bugfix-bug-fix :D. Testing the relevant commit now.

rlpowell commented 1 year ago

Confirmed; https://github.com/ArtifexSoftware/mupdf/commit/dfaf6071fc6ef28c311dbedf81c2139fd1f8ffc4 , or possible the commit just before it, fixes this issue.

@foobnix , if you could please update this issue when you're shipping a version that includes that stuff (which currently isn't on any tagged release for MuPDF), I'll hold updating until then. :) 8.8.107 works fine in the meantime.

foobnix commented 1 year ago

@rlpowell As I understand the fix will be in the mupdf 1.22.2 version, I will update the application after the mupdf release.

foobnix commented 1 year ago

@rlpowell could you please check beta.librera.mobi I have add fix from mupdf master branch

rlpowell commented 9 months ago

This has been fixed for a long while, my apologies for not closing it out.