https://github.com/williamh/espeakup/pull/18

commit a9657bbb2b2520f80869ba9ffb91eeab4c17acba
Author: Samuel Thibault <samuel.thibault@ens-lyon.org>
Date:   Sat Apr 25 21:47:00 2020 +0200

    Support pitch range configuration
    
    This allows to let users choose expressiveness of their synth.

---
 espeak.c    |   21 +++++++++++++++++++++
 espeakup.h  |    2 ++
 softsynth.c |    3 +++
 3 files changed, 26 insertions(+)

--- a/espeak.c
+++ b/espeak.c
@@ -30,6 +30,7 @@
 /* default voice settings */
 const int defaultFrequency = 5;
 const int defaultPitch = 5;
+const int defaultRange = 5;
 const int defaultRate = 2;
 const int defaultVolume = 5;
 char *defaultVoice = NULL;
@@ -38,6 +39,7 @@ int alsaVolume = 0;
 /* multipliers and offsets */
 const int frequencyMultiplier = 11;
 const int pitchMultiplier = 11;
+const int rangeMultiplier = 11;
 const int rateMultiplier = 41;
 const int rateOffset = 80;
 const int volumeMultiplier = 22;
@@ -90,6 +92,21 @@ static espeak_ERROR set_pitch(struct syn
 	return rc;
 }
 
+static espeak_ERROR set_range(struct synth_t *s, int range,
+							  enum adjust_t adj)
+{
+	espeak_ERROR rc;
+
+	if (adj == ADJ_DEC)
+		range = -range;
+	if (adj != ADJ_SET)
+		range += s->range;
+	rc = espeak_SetParameter(espeakRANGE, range * rangeMultiplier, 0);
+	if (rc == EE_OK)
+		s->range = range;
+	return rc;
+}
+
 static espeak_ERROR set_punctuation(struct synth_t *s, int punct,
 									enum adjust_t adj)
 {
@@ -348,6 +365,9 @@ static void queue_process_entry(struct s
 	case CMD_SET_PITCH:
 		error = set_pitch(s, current->value, current->adjust);
 		break;
+	case CMD_SET_RANGE:
+		error = set_range(s, current->value, current->adjust);
+		break;
 	case CMD_SET_PUNCTUATION:
 		error = set_punctuation(s, current->value, current->adjust);
 		break;
@@ -405,6 +425,7 @@ int initialize_espeak(struct synth_t *s)
 	}
 	set_frequency(s, defaultFrequency, ADJ_SET);
 	set_pitch(s, defaultPitch, ADJ_SET);
+	set_range(s, defaultRange, ADJ_SET);
 	set_rate(s, defaultRate, ADJ_SET);
 	set_volume(s, defaultVolume, ADJ_SET);
 	espeak_SetParameter(espeakCAPITALS, 0, 0);
--- a/espeakup.h
+++ b/espeakup.h
@@ -39,6 +39,7 @@ enum espeakup_mode_t {
 enum command_t {
 	CMD_SET_FREQUENCY,
 	CMD_SET_PITCH,
+	CMD_SET_RANGE,
 	CMD_SET_PUNCTUATION,
 	CMD_SET_RATE,
 	CMD_SET_VOICE,
@@ -66,6 +67,7 @@ struct espeak_entry_t {
 struct synth_t {
 	int frequency;
 	int pitch;
+	int range;
 	int punct;
 	int rate;
 	char voice[20];
--- a/softsynth.c
+++ b/softsynth.c
@@ -127,6 +127,9 @@ static int process_command(struct synth_
 		case 'p':
 			cmd = CMD_SET_PITCH;
 			break;
+		case 'r':
+			cmd = CMD_SET_RANGE;
+			break;
 		case 's':
 			cmd = CMD_SET_RATE;
 			break;
