speechd-discuss
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

[PATCH] Make espeak rate control configurable instead of hard-coded in t


From: Rui Batista
Subject: [PATCH] Make espeak rate control configurable instead of hard-coded in the module
Date: Sun, 24 Apr 2011 19:13:47 +0100

Added three new parameters to the espeak module:
EspeakMinRate (for the -100 speech-dispatcher rate value)
EspeakNormalRate (for the 0 speech-dispatcher rate value)
EspeakMaxRate (for the 100 speech-dispatcher rate value)

Changed the set_rate function in the module to use the config values.
For compatibility the default values are 80, 170, and 390
 like hard-coded before.
---
 config/modules/espeak.conf |   15 +++++++++++++++
 src/modules/espeak.c       |    8 +++++++-
 2 files changed, 22 insertions(+), 1 deletions(-)

diff --git a/config/modules/espeak.conf b/config/modules/espeak.conf
index 5379cc0..ce9963a 100644
--- a/config/modules/espeak.conf
+++ b/config/modules/espeak.conf
@@ -22,6 +22,21 @@ EspeakSoundIconVolume 0
 EspeakPunctuationList "@+_"
 EspeakCapitalPitchRise 0
 
+# -- Rate control --
+# The following options are in words per minute
+#the same as the -s parameter for the -s option in espeak command line tool.
+
+# Minimum rate (-100 in speech-dispatcher)
+EspeakMinRate 80
+
+# Normal rate (0 in speech-dispatcher)
+EspeakNormalRate 170
+
+# Maximum rate (100 in speech-dispatcher)
+EspeakMaxRate 390
+
+
+
 # -- Internal parameters --
 
 # Number of ms of audio returned by the espeak callback function.
diff --git a/src/modules/espeak.c b/src/modules/espeak.c
index e32810b..72f22c1 100644
--- a/src/modules/espeak.c
+++ b/src/modules/espeak.c
@@ -194,6 +194,9 @@ static void *_espeak_stop_or_pause(void *);
 MOD_OPTION_1_INT(EspeakPitchRange)
     MOD_OPTION_1_STR(EspeakPunctuationList)
     MOD_OPTION_1_INT(EspeakCapitalPitchRise)
+    MOD_OPTION_1_INT(EspeakMinRate)
+    MOD_OPTION_1_INT(EspeakNormalRate)
+    MOD_OPTION_1_INT(EspeakMaxRate)
 
     MOD_OPTION_1_INT(EspeakAudioChunkSize)
     MOD_OPTION_1_INT(EspeakAudioQueueMaxSize)
@@ -216,6 +219,9 @@ int module_load(void)
        MOD_OPTION_1_INT_REG(EspeakSoundIconVolume, 0);
 
        MOD_OPTION_1_INT_REG(EspeakPitchRange, 0);
+       MOD_OPTION_1_INT_REG(EspeakMinRate, 80);
+       MOD_OPTION_1_INT_REG(EspeakNormalRate, 170);
+       MOD_OPTION_1_INT_REG(EspeakMaxRate, 390);
        MOD_OPTION_1_STR_REG(EspeakPunctuationList, "@/+-_");
        MOD_OPTION_1_INT_REG(EspeakCapitalPitchRise, 800);
        if (EspeakCapitalPitchRise == 1 || EspeakCapitalPitchRise == 2) {
@@ -602,7 +608,7 @@ static void espeak_set_rate(signed int rate)
 {
        assert(rate >= -100 && rate <= +100);
        int speed;
-       int normal_rate = 170, max_rate = 390, min_rate = 80;
+       int normal_rate = EspeakNormalRate, max_rate = EspeakMaxRate, min_rate 
= EspeakMinRate;
 
        if (rate < 0)
                speed = normal_rate + (normal_rate - min_rate) * rate / 100;
-- 
1.7.1




reply via email to

[Prev in Thread] Current Thread [Next in Thread]