On Fri, 1 Jun 2012, Eric Scheibler wrote:

> But brltty doesn't use the faster speech, I've set the speech speed to 20
> and it's relatively slow. Is there something I can do to make the espeak
> also faster in brltty?

The attached patch should provide that ability.


Nicolas
diff --git a/Drivers/Speech/eSpeak/Makefile.in 
b/Drivers/Speech/eSpeak/Makefile.in
index f3b386f..821a1c1 100644
--- a/Drivers/Speech/eSpeak/Makefile.in
+++ b/Drivers/Speech/eSpeak/Makefile.in
@@ -19,7 +19,7 @@
 DRIVER_CODE = es
 DRIVER_NAME = eSpeak
 DRIVER_COMMENT = text to speech engine 
-DRIVER_VERSION = 0.1 
+DRIVER_VERSION = 0.2 
 DRIVER_DEVELOPERS = Nicolas Pitre <[email protected]>
 SPK_OBJS = @speech_libraries_es@
 include $(SRC_TOP)speech.mk
diff --git a/Drivers/Speech/eSpeak/README b/Drivers/Speech/eSpeak/README
index f766686..23efe34 100644
--- a/Drivers/Speech/eSpeak/README
+++ b/Drivers/Speech/eSpeak/README
@@ -26,3 +26,8 @@ voice
        Specifies a voice/language to use.  The complete list of available
        voices may be obtained with the command 'espeak --voices'.
 
+maxrate
+
+       Overrides the maximum speech rate value. The default is 450.
+       This cannot be lower than 80.
+
diff --git a/Drivers/Speech/eSpeak/speech.c b/Drivers/Speech/eSpeak/speech.c
index 6367c7e..695633a 100644
--- a/Drivers/Speech/eSpeak/speech.c
+++ b/Drivers/Speech/eSpeak/speech.c
@@ -28,9 +28,10 @@
 typedef enum {
        PARM_PATH,
        PARM_PUNCTLIST,
-       PARM_VOICE
+       PARM_VOICE,
+       PARM_MAXRATE
 } DriverParameter;
-#define SPKPARMS "path", "punctlist", "voice"
+#define SPKPARMS "path", "punctlist", "voice", "maxrate"
 
 #define SPK_HAVE_TRACK
 #define SPK_HAVE_RATE
@@ -46,6 +47,7 @@ typedef enum {
 #define espeakRATE_MAXIMUM     450
 #endif
 
+static int maxrate = espeakRATE_MAXIMUM;
 static int IndexPos;
 
 static int SynthCallback(short *audio, int numsamples, espeak_EVENT *events)
@@ -97,6 +99,11 @@ static int spk_construct(SpeechSynthesizer *spk, char 
**parameters)
                espeak_SetPunctuationList(w_punctlist);
        }
 
+       if (parameters[PARM_MAXRATE]) {
+               int val = atoi(parameters[PARM_MAXRATE]);
+               if (val > espeakRATE_MINIMUM) maxrate = val;
+       }
+
        espeak_SetSynthCallback(SynthCallback);
 
        return 1;
@@ -156,7 +163,7 @@ spk_setVolume(SpeechSynthesizer *spk, unsigned char setting)
 static void
 spk_setRate(SpeechSynthesizer *spk, unsigned char setting)
 {
-       int h_range = (espeakRATE_MAXIMUM - espeakRATE_MINIMUM)/2;
+       int h_range = (maxrate - espeakRATE_MINIMUM)/2;
        int rate = getIntegerSpeechRate(setting, h_range) + espeakRATE_MINIMUM;
        espeak_SetParameter(espeakRATE, rate, 0);
 }
_______________________________________________
This message was sent via the BRLTTY mailing list.
To post a message, send an e-mail to: [email protected]
For general information, go to: http://mielke.cc/mailman/listinfo/brltty

Reply via email to