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

espeak-ng-mbrola-generic: Fix missing sound at the end of messages #978

Closed
wants to merge 1 commit into from

Conversation

cwendling
Copy link
Contributor

At least espeak-ng 1.51 from Debian and Ubuntu eat the last character from stdin, so we need to pad with a safe dummy for the whole expected input to be processed.

All is good with espeak (non-ng) 1.48.15:

$ printf %s 'Bonjour' | espeak -v mb-fr1 -s 160 -p 50  -q --stdin --pho
b	70
o~	41	 0 94 20 95 40 96 59 97 80 99 100 99
Z	70
u	74	 0 102 80 76 100 76
R	70
_	350
_	1

But not so much with espeak-ng 1.51:

$ printf %s 'Bonjour' | espeak-ng -v mb-fr1 -s 160 -p 50  -q --stdin --pho
b	70
o~	41	 0 94 20 95 40 96 59 97 80 99 100 99
Z	70
u	120	 0 102 80 76 100 76
_	350
_	1

Notice the missing R.

Now, if we pad the input with a single space:

$ printf '%s ' 'Bonjour' | espeak-ng -v mb-fr1 -s 160 -p 50  -q --stdin --pho
b	70
o~	41	 0 94 20 95 40 96 59 97 80 99 100 99
Z	70
u	74	 0 102 80 76 100 76
R	70
_	350
_	1

So, do so in espeak-ng-mbrola-generic not to stumble on the issue. Adding one trailing space is likely safe enough that it will not start causing issues with future fixed version, and testing showed it doesn't affect the tested version: adding one or more spaces yielded the exact same results for both espeak and espeak-ng with the tested versions.

At least espeak-ng 1.51 from Debian and Ubuntu eat the last character
from stdin, so we need to pad with a safe dummy for the whole expected
input to be processed.

All is good with espeak (non-ng) 1.48.15:

> $ printf %s 'Bonjour' | espeak -v mb-fr1 -s 160 -p 50  -q --stdin --pho
> b	70
> o~	41	 0 94 20 95 40 96 59 97 80 99 100 99
> Z	70
> u	74	 0 102 80 76 100 76
> R	70
> _	350
> _	1

But not so much with espeak-ng 1.51:

> $ printf %s 'Bonjour' | espeak-ng -v mb-fr1 -s 160 -p 50  -q --stdin --pho
> b	70
> o~	41	 0 94 20 95 40 96 59 97 80 99 100 99
> Z	70
> u	120	 0 102 80 76 100 76
> _	350
> _	1

Notice the missing `R`.

Now, if we pad the input with a single space:

> $ printf '%s ' 'Bonjour' | espeak-ng -v mb-fr1 -s 160 -p 50  -q --stdin --pho
> b	70
> o~	41	 0 94 20 95 40 96 59 97 80 99 100 99
> Z	70
> u	74	 0 102 80 76 100 76
> R	70
> _	350
> _	1

So, do so in espeak-ng-mbrola-generic not to stumble on the issue.
Adding one trailing space is likely safe enough that it will not start
causing issues with future fixed version, and testing showed it doesn't
affect the tested version: adding one or more spaces yielded the exact
same results for both espeak and espeak-ng with the tested versions.
@sthibaul
Copy link
Collaborator

Does it not affect single-letter pronunciation? (for e.g. spelling)

@sthibaul
Copy link
Collaborator

Is the issue reported to espeak-ng?

@cwendling
Copy link
Contributor Author

Does it not affect single-letter pronunciation? (for e.g. spelling)

It probably does although I never got e.g. spd-say --spelling to do anything interesting with any module, so I'm not even entirely sure what it should actually do :)

However yes, it really just seems like an issue with reading the very end of the stream by espeak-ng, so it affects everything that ends up piped there.

Using Orca, there are a couple strange-sounding names (e.g. "tabulatio"), but it also prevents key echo or reading single characters when e.g. navigating in a text using the left and right arrows, which makes this module problematic there.

Is the issue reported to espeak-ng?

No. I didn't have time to check if this is still relevant for recent versions of it, let alone master. I unfortunately probably won't have time for this in the coming weeks, either.
I figured that given it's pretty serious, affects current versions of Debian and Ubuntu, and is reasonably easy and safe to fix here, I would. But indeed ultimately espeak-ng should be fixed indeed.

@sthibaul
Copy link
Collaborator

I bisected between 1.48.15 and 1.49, the "culprit" was eaa0c9aa08350ce8a1343aed4c0a87c1cc329b0e ("Fix truncated fgetc return value in main(espeak-ng.c). [Coverity]"). Before that, EOF would be taken as spurious character input... It's then p_text[ix-1] = 0; below which spuriously drops the last character. I guess it just never went noticed just because people usually pass text in the command or as a file.

@sthibaul
Copy link
Collaborator

I'll fix that upstream and upload fixes in debian

@sthibaul
Copy link
Collaborator

I guess it just never went noticed just because people usually pass text in the command or as a file.

Or echo with a newline character

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.

2 participants