About speakup punctuation

Chris Brannon chris at the-brannons.com
Tue Mar 14 20:01:29 EDT 2017

Samuel Thibault <samuel.thibault at ens-lyon.org> writes:

> 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)

Yeah, having soft/punct default to the "all" value seems like a good
thing for direct mode.  But tying those two variables together seems
kind of problematic.  Maybe just let this be something that happens in a
startup script, or even in some startup code in the softsynth daemon itself?

>> 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?

Oh, it seems I'm partially wrong about punc_level and reading_punc.  No
 matter what you set it to, it will always send some punctuation
 characters  to the synth for prosody.  Examples are period, comma,
colon, question mark, maybe some others?
Try the following with espeakup, direct mode enabled, soft/punct set to 1.
Run the following command at each of the punctuation levels:
echo 'printf("Hello, world %d\n", 1 + 1 < 3);'
and listen to the output.  Review that line on the screen at the
 different reading_punc levels, with the speak-line commands.  You'll
 hear what I mean.

>> * 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 probably depends on what the user does with the computer.  It's not
the setting I usually use, but isn't a bad 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...

Explained above why they aren't working as expected.  And the punc_level
parameter is magic.  The spk_punc_level variable is never read.
Instead, the effect is carried out through some code in spk_set_num_var
in varhandlers.c.

> 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)?

Yeah, fixing espeakup to do what speechd-up does seems right.

> 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?

For direct mode, this sounds like an excellent idea.  When not in
direct mode, Speakup is deciding how to pronounce the punctuation, so
this really doesn't work so well.
Also what about reading_punc?  To accomodate that, you need to
account for whether a given utterance came from output to the screen or
a review command, and then use the appropriate punctuation level.  It'll
get complicated.

I think my biggest take-away from this discussion is that it would be
really nice to simplify how Speakup handles punctuation.  Ideally, we'd
just have one setting, used everywhere, rather than up to three
punctuation settings.  In direct mode, that setting directly controls
the punctuation level of the synthesizer.  All punctuation is always
passed to the synth, and the synth decides whether it is spoken and how
it is pronounced.  In non-direct mode, which I'll call "processed" mode,
that setting determines what level of punctuation is spoken by Speakup.
The synth's punctuation setting is always "none", so that punctuation
used for prosody is never spoken, and Speakup decides which punctuation
characters to speak and how to pronounce them.
This also eliminates the distinction between punc_level (punctuation in
spoken output) and reading_punc (punctuation in reviewed text).  Hope
this idea is clear and doesn't ruffle too many feathers.

-- Chris

More information about the Speakup mailing list