aboutsummaryrefslogtreecommitdiffstats
path: root/recipes-multimedia/hts_engine/hts-engine
diff options
context:
space:
mode:
authorNaoto Yamaguchi <i33399_YAMAGUCHI@aisin-aw.co.jp>2016-12-21 00:43:00 +0900
committerNaoto Yamaguchi <i33399_YAMAGUCHI@aisin-aw.co.jp>2016-12-21 00:43:00 +0900
commit611806e19ca6da042c5c3ad843c7d988f4e57783 (patch)
tree44b1cfeab61af4262a67afc42a0c3288f326fe44 /recipes-multimedia/hts_engine/hts-engine
parentf4743ec44fb3fdac04a82790b763cb84f51cc6b7 (diff)
Adding patch to adjust volume of TTS engine
OSS TTS engine has problems of low volume. This patch adds the normalize function to OSS TTS engine. Change-Id: I21c2c6d20bb9e8bef6f3b8ca1c8440baa7ffe2b8 Signed-off-by: Naoto Yamaguchi <i33399_YAMAGUCHI@aisin-aw.co.jp>
Diffstat (limited to 'recipes-multimedia/hts_engine/hts-engine')
-rw-r--r--recipes-multimedia/hts_engine/hts-engine/nomalize.patch31
1 files changed, 31 insertions, 0 deletions
diff --git a/recipes-multimedia/hts_engine/hts-engine/nomalize.patch b/recipes-multimedia/hts_engine/hts-engine/nomalize.patch
new file mode 100644
index 000000000..e292fbb1c
--- /dev/null
+++ b/recipes-multimedia/hts_engine/hts-engine/nomalize.patch
@@ -0,0 +1,31 @@
+diff --git a/lib/HTS_engine.c b/lib/HTS_engine.c
+old mode 100644
+new mode 100755
+index 5325426..b507226
+--- a/lib/HTS_engine.c
++++ b/lib/HTS_engine.c
+@@ -733,6 +733,9 @@ void HTS_Engine_save_riff(HTS_Engine * engine, FILE * fp)
+ HTS_fwrite_little_endian(data_37_40, sizeof(char), 4, fp);
+ HTS_fwrite_little_endian(&data_41_44, sizeof(int), 1, fp);
+ /* write data */
++
++ short peak = 0;
++
+ for (i = 0; i < HTS_GStreamSet_get_total_nsamples(gss); i++) {
+ x = HTS_GStreamSet_get_speech(gss, i);
+ if (x > 32767.0)
+@@ -741,6 +744,14 @@ void HTS_Engine_save_riff(HTS_Engine * engine, FILE * fp)
+ temp = -32768;
+ else
+ temp = (short) x;
++ short sample = abs(temp);
++ if(peak < sample)
++ peak = sample;
++ }
++ float mul = (32767.0f / peak);
++ for (i = 0; i < HTS_GStreamSet_get_total_nsamples(gss); i++) {
++ x = HTS_GStreamSet_get_speech(gss, i);
++ temp = ((short) x) * mul;
+ HTS_fwrite_little_endian(&temp, sizeof(short), 1, fp);
+ }
+ }