Sorry, I had the debdiff ready, but forgot to attach, here it is.

Samuel
diff -Nru speech-dispatcher-0.8.6/debian/changelog 
speech-dispatcher-0.8.6/debian/changelog
--- speech-dispatcher-0.8.6/debian/changelog    2017-02-04 10:59:22.000000000 
+0100
+++ speech-dispatcher-0.8.6/debian/changelog    2017-03-05 23:13:08.000000000 
+0100
@@ -1,3 +1,9 @@
+speech-dispatcher (0.8.6-4) unstable; urgency=medium
+
+  * Fix stripped audio output of flite module (Closes: #856895).
+
+ -- Samuel Thibault <[email protected]>  Sun, 05 Mar 2017 23:13:08 +0100
+
 speech-dispatcher (0.8.6-3) unstable; urgency=medium
 
   [ Samuel Thibault ]
diff -Nru speech-dispatcher-0.8.6/debian/patches/flite-strip-silence 
speech-dispatcher-0.8.6/debian/patches/flite-strip-silence
--- speech-dispatcher-0.8.6/debian/patches/flite-strip-silence  1970-01-01 
01:00:00.000000000 +0100
+++ speech-dispatcher-0.8.6/debian/patches/flite-strip-silence  2017-03-05 
23:12:16.000000000 +0100
@@ -0,0 +1,45 @@
+--- a/src/modules/flite.c
++++ b/src/modules/flite.c
+@@ -238,21 +238,29 @@ int module_close(void)
+ 
+ void flite_strip_silence(AudioTrack * track)
+ {
+-      int playlen, skip;
++      assert(track->bits == 16);
++      unsigned i;
++      float silence_limit = 0.001;
+ 
+-      float stretch =
+-          get_param_float(flite_voice->features, "duration_stretch", 1.);
+-      int speed = (int)(1000. / stretch);
+-      skip = (187 * track->sample_rate) / speed;
+-      playlen = track->num_samples - skip * 2;
+-      if (playlen > 0 && playlen < 500)
+-              playlen += (skip * 2) / 3;
+-      if (playlen < 0)
+-              playlen = 0;
++      while (track->num_samples >= track->num_channels) {
++              for (i = 0; i < track->num_channels; i++)
++                      if (abs(track->samples[i])
++                          >= silence_limit * (1L<<(track->bits-1)))
++                              goto stripped_head;
++              track->samples += track->num_channels;
++              track->num_samples -= track->num_channels;
++      }
++stripped_head:
+ 
+-      track->num_samples = playlen;
+-      assert(track->bits == 16);
+-      track->samples += skip * track->num_channels;
++      while (track->num_samples >= track->num_channels) {
++              for (i = 0; i < track->num_channels; i++)
++                      if (abs(track->samples[track->num_samples - i - 1])
++                          >= silence_limit * (1L<<(track->bits-1)))
++                              goto stripped_tail;
++              track->num_samples -= track->num_channels;
++      }
++stripped_tail:
++      ;
+ }
+ 
+ void *_flite_speak(void *nothing)
diff -Nru speech-dispatcher-0.8.6/debian/patches/series 
speech-dispatcher-0.8.6/debian/patches/series
--- speech-dispatcher-0.8.6/debian/patches/series       2017-02-04 
08:13:39.000000000 +0100
+++ speech-dispatcher-0.8.6/debian/patches/series       2017-03-05 
22:50:12.000000000 +0100
@@ -1,3 +1,4 @@
 pulse-default-latency.patch
 doc-figures
 change-default-module.patch
+flite-strip-silence

Reply via email to