About speakup punctuation

Samuel Thibault samuel.thibault at ens-lyon.org
Tue Mar 14 17:45:23 EDT 2017

Zahari Yurukov, on lun. 13 mars 2017 02:34:35 +0200, wrote:
> espeak indeed reads the punctuation, except it doesn't read the space,

Chris Brannon, on lun. 13 mars 2017 04:20:15 -0700, wrote:
> I don't think espeakup will speak the space character in direct mode,
> and I don't know of the best way to make this happen.  It just speaks
> silence when you cursor over it.

Then it's just a bug that nobody fixed or reported :)

Could you try the attached patch?

> But when I wrote that it doesn't, I was misled  by the fact, that it really doesn't, except when reading by character, and not when reading strings longer than one character, i.e. screen updates, reading by word, line etc. And that's the correct behaviour. 

Well, depending on what the user wants, and...

> In direct mode, I can't control how much punctuation is spoken through speakup, I can't change the level with the speakup commands, i. e. punctuation level and reading punctuation .

You want something different depending on the situation :)

>  Or you're saying, that changing punctuation level and reading punctuation  in speakup with direct mode enabled should have effect in espeakup and espeak?

Well, I'm saying that we should make everything work as expected in
direct mode, so that we can just enable it by default.

Chris Brannon, on lun. 13 mars 2017 04:20:15 -0700, wrote:
> Here's what you need to do to make synth punctuation spelling work in
> direct mode:
> echo 1 > /sys/accessibility/speakup/soft/punct
> So to make a long story short, in direct mode, set soft/punct to 1 and
> forget it.

And so perhaps we should actually make this a default (once bugs are
fixed of course)? (but see more about the value below)

> Just use punclevel and reading_punc keyboard commands to
> control how much punctuation actually gets delivered to the synth.

So once direct mode is enabled and punct is set to 1, the obtained
behavior is the same as other synths?

(I'm not a speakup user, so I don't know the details).

> There are multiple punctuation settings in Speakup.

Thanks, that makes things clearer to me :)

> * punclevel: when speaking text as it is displayed on the console, what
> amount of punctuation do we deliver to the synthesizer?  Set by
> /sys/accessibility/speakup/punclevel, or keyboard commands.

It seems to be 1 by default, is this really what people want as default?
That being said, I don't see the spk_punc_level variable being used in
main.c, that's odd. And indeed, setting this to 0 doesn't prevent the
punctuation from being spoken...

> Now here's another problem that I see.  I don't think the synth
> punctuation setting was ever documented.  speechd-up does one thing,
> espeakup does another.
> With espeakup, 0 is no punctuation, 1 is all punctuation, and 2 is some
> punctuation.
> With speechd-up, 0 is all punctuation, 1 and 2 are some punctuation, 3
> is no punctuation.

Urgl... AIUI, speechd-up was there before espeakup, so that could
explain why the default was 0, and now that people use espeakup, they
have learnt they should set it to 1? So the actual bug fix would be to
fix the interpretation of espeakup, to match the historic values (and
thus the intended default value)?

Now, that being said, AIUI, setting the soft synth punctuation to all
means that either one gets the full punctuation, or one doesn't get the
punctuation (because it was stripped by speakup), but then in the latter
case one doesn't get the prosody either since the punctuation will have
been stripped by speakup before the synth can use it for prosody. So
AIUI, what should actually happen is that for synths which have a
PUNCT string, speakup should not strip punctuation itself, and rather
dynamically update the PUNCT value of the synth, so that the synth can
always either pronounce the punctuation, or use it for prosody. What do
you thing?

> There's one more problem with direct mode and punctuation.  The various
> messages that Speakup uses for help, errors, or indicating something to
> the user have punctuation characters in them.  With the synth
> punctuation setting set to 'all", you're going to hear those characters,
> even though they should never be heard by the user.  Perhaps they need
> to be stripped?

That's probably just a bug to be fixed, yes.  Actually in the source
code I see a lot of lines like

synth_printf("%s\n", spk_msg_get(MSG_UNPARKED));

We should instead define a helper function that just takes the
MSG_UNPARKED parameter, and does the synth_printf. To fix the bug
mentioned above, we could then make that helper temporarily disable the
punctuation from the synthesizer (while still getting the prosody).

-------------- next part --------------
espeak doesn't speak spaces unless strongly being told to do so :)

--- a/espeak.c
+++ b/espeak.c
@@ -170,9 +170,14 @@ static espeak_ERROR speak_text(struct sy
 	if (espeakup_mode == ESPEAKUP_MODE_SPEAKUP && (s->len == 1)) {
 		char *buf;
 		int n;
-		n = asprintf(&buf,
-			     "<say-as interpret-as=\"characters\">%c</say-as>",
-			     s->buf[0]);
+		const char *say_as;
+		if (s->buf[0] == ' ')
+			n = asprintf(&buf,
+				     "<say-as interpret-as=\"tts:char\"> </say-as>");
+		else
+			n = asprintf(&buf,
+				     "<say-as interpret-as=\"characters\">%c</say-as>",
+				     s->buf[0]);
 		if (n == -1) {
 			/* D'oh.  Not much to do on allocation failure.
 			 * Perhaps espeak will happen to say the character */

More information about the Speakup mailing list