speechd-discuss
[Top][All Lists]
Advanced

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

[PATCH 3/8] defined pitch_range functions for the language apis, and add


From: Luke Yelavich
Subject: [PATCH 3/8] defined pitch_range functions for the language apis, and added support for setting its value during configuration
Date: Fri, 24 Oct 2014 14:44:40 -0400

From: Hussain Jasim <address@hidden>
To: address@hidden

---
 src/api/c/libspeechd.c                  |  1 +
 src/api/c/libspeechd.h                  |  5 +++++
 src/api/cl/configuration.lisp           |  2 +-
 src/api/cl/ssip.lisp                    |  3 ++-
 src/api/guile/gssip.c                   |  4 ++++
 src/api/guile/gssip.scm.in              |  3 +++
 src/api/python/speechd/client.py        | 14 ++++++++++++++
 src/api/python/speechd_config/config.py |  5 +++++
 8 files changed, 35 insertions(+), 2 deletions(-)

diff --git a/src/api/c/libspeechd.c b/src/api/c/libspeechd.c
index 3f693b0..9f5cbeb 100644
--- a/src/api/c/libspeechd.c
+++ b/src/api/c/libspeechd.c
@@ -1085,6 +1085,7 @@ spd_w_set_voice_type(SPDConnection * connection, 
SPDVoiceType type,
 
 SPD_SET_COMMAND_INT(voice_rate, RATE, ((val >= -100) && (val <= +100)))
     SPD_SET_COMMAND_INT(voice_pitch, PITCH, ((val >= -100) && (val <= +100)))
+    SPD_SET_COMMAND_INT(voice_pitch_range, PITCH_RANGE, ((val >= -100) && (val 
<= +100)))
     SPD_SET_COMMAND_INT(volume, VOLUME, ((val >= -100) && (val <= +100)))
 
     SPD_SET_COMMAND_STR(language, LANGUAGE)
diff --git a/src/api/c/libspeechd.h b/src/api/c/libspeechd.h
index be0d439..6390c21 100644
--- a/src/api/c/libspeechd.h
+++ b/src/api/c/libspeechd.h
@@ -180,6 +180,11 @@ int spd_set_voice_pitch_all(SPDConnection * connection, 
signed int pitch);
 int spd_set_voice_pitch_uid(SPDConnection * connection, signed int pitch,
                            unsigned int uid);
 
+int spd_set_voice_pitch_range(SPDConnection * connection, signed int 
pitch_range);
+int spd_set_voice_pitch_range_all(SPDConnection * connection, signed int 
pitch_range);
+int spd_set_voice_pitch_range_uid(SPDConnection * connection, signed int 
pitch_range,
+                           unsigned int uid);
+       
 int spd_set_volume(SPDConnection * connection, signed int volume);
 int spd_set_volume_all(SPDConnection * connection, signed int volume);
 int spd_set_volume_uid(SPDConnection * connection, signed int volume,
diff --git a/src/api/cl/configuration.lisp b/src/api/cl/configuration.lisp
index 49a43f8..f0d8bed 100644
--- a/src/api/cl/configuration.lisp
+++ b/src/api/cl/configuration.lisp
@@ -51,7 +51,7 @@ CONNECTION-NAME is a connection name as expected to be in 
`speechd-client-name'
 and PARAMETERS is a property list with the pairs of parameter identifiers and
 parameter values.  Valid parameter names are the following symbols:
 language, message-priority, punctuation-mode, capital-character-mode, voice,
-rate, pitch, output-module.  See the corresponding speechd-set-* functions for
+rate, pitch, pitch_range, output-module.  See the corresponding speechd-set-* 
functions for
 valid parameter values.
 
 If the symbol t is specified as the connection name, the element defines
diff --git a/src/api/cl/ssip.lisp b/src/api/cl/ssip.lisp
index 3a2cddf..511288c 100644
--- a/src/api/cl/ssip.lisp
+++ b/src/api/cl/ssip.lisp
@@ -79,6 +79,7 @@ Useful only for diagnosing problems.")
     (voice . "VOICE")
     (rate . "RATE")
     (pitch . "PITCH")
+    (pitch_range . "PITCH_RANGE")
     (spelling-mode . "SPELLING")
     (output-module . "OUTPUT_MODULE")
     ))
@@ -383,7 +384,7 @@ Return the opened connection on success, nil otherwise."
     ("key")
     ("quit")
     ("block" ("end"))
-    ("set" ("self" ("rate" "pitch" "voice" "language")))))
+    ("set" ("self" ("rate" "pitch" "pitch_range" "voice" "language")))))
 
 (defun block-command-p (command &optional allowed)
   (unless allowed
diff --git a/src/api/guile/gssip.c b/src/api/guile/gssip.c
index 059a515..1951a4b 100644
--- a/src/api/guile/gssip.c
+++ b/src/api/guile/gssip.c
@@ -209,6 +209,10 @@ SSIP_OUTPUT_DECL(text, "text")
     SSIP_SET_DECL(pitch, "pitch")
     SSIP_SET_INT_BODY(voice_pitch)
 #undef FUNC_NAME
+#define FUNC_NAME s_ssip_set_pitch_range
+    SSIP_SET_DECL(pitch_range, "pitch_range")
+    SSIP_SET_INT_BODY(voice_pitch_range)
+#undef FUNC_NAME
 #define FUNC_NAME s_ssip_set_volume
     SSIP_SET_DECL(volume, "volume")
     SSIP_SET_INT_BODY(volume)
diff --git a/src/api/guile/gssip.scm.in b/src/api/guile/gssip.scm.in
index e1df3b8..629e891 100644
--- a/src/api/guile/gssip.scm.in
+++ b/src/api/guile/gssip.scm.in
@@ -66,6 +66,9 @@
 (define (ssip-set-pitch connection pitch)
   (%ssip-set-pitch connection pitch))
 
+(define (ssip-set-pitch-range connection pitch_range)
+  (%ssip-set-pitch-range connection pitch-range))
+
 (define (ssip-set-volume connection volume)
   (%ssip-set-volume connection volume))
 
diff --git a/src/api/python/speechd/client.py b/src/api/python/speechd/client.py
index 8d34363..0bc696e 100644
--- a/src/api/python/speechd/client.py
+++ b/src/api/python/speechd/client.py
@@ -890,6 +890,20 @@ class SSIPClient(object):
         assert isinstance(value, int) and -100 <= value <= 100, value
         self._conn.send_command('SET', scope, 'PITCH', value)
 
+    def set_pitch_range(self, value, scope=Scope.SELF):
+        """Set the pitch range for further speech commands.
+
+        Arguments:
+          value -- integer value within the range from -100 to 100, with 0
+            corresponding to the default pitch range of the current speech 
synthesis
+            output module, lower values meaning lower pitch range and higher 
values
+            meaning higher pitch range.
+          scope -- see the documentation of this class.
+          
+        """
+        assert isinstance(value, int) and -100 <= value <= 100, value
+        self._conn.send_command('SET', scope, 'PITCH_RANGE', value)
+
     def set_rate(self, value, scope=Scope.SELF):
         """Set the speech rate (speed) for further speech commands.
 
diff --git a/src/api/python/speechd_config/config.py 
b/src/api/python/speechd_config/config.py
index 294e14a..1f4d35d 100644
--- a/src/api/python/speechd_config/config.py
+++ b/src/api/python/speechd_config/config.py
@@ -740,6 +740,10 @@ class Configure:
             "Default speech pitch (on the scale of -100..100, 0 is default, 50 
is higher, -50 is lower)",
             "0")
     
+        self.default_speech_pitch_range = question(
+            "Default speech pitch range (on the scale of -100..100, 0 is 
default, 50 is higher, -50 is lower)",
+            "0")
+    
         # Substitute given configuration options
         if type == 'user':
             configfile = os.path.join(test.user_conf_dir(), "speechd.conf")
@@ -752,6 +756,7 @@ class Configure:
                                  "AudioOutputMethod": 
self.default_audio_method,
                                  "DefaultRate": self.default_speech_rate,
                                  "DefaultPitch": self.default_speech_pitch,
+                                 "DefaultPitchRange": 
self.default_speech_pitch_range,
                                  "DefaultLanguage": self.default_language,
                                  })
         if type == 'user':
-- 
2.1.0




reply via email to

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