aboutsummaryrefslogtreecommitdiffstats
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
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>
-rw-r--r--recipes-multimedia/hts_engine/hts-engine/nomalize.patch31
-rw-r--r--[-rwxr-xr-x]recipes-multimedia/hts_engine/hts-engine_1.10.bb4
2 files changed, 34 insertions, 1 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);
+ }
+ }
diff --git a/recipes-multimedia/hts_engine/hts-engine_1.10.bb b/recipes-multimedia/hts_engine/hts-engine_1.10.bb
index 3522f666a..ed5cae63c 100755..100644
--- a/recipes-multimedia/hts_engine/hts-engine_1.10.bb
+++ b/recipes-multimedia/hts_engine/hts-engine_1.10.bb
@@ -12,7 +12,9 @@ BBCLASSEXTEND = "native"
S = "${WORKDIR}/hts_engine_API-${PV}"
-SRC_URI = "http://downloads.sourceforge.net/hts-engine/hts_engine_API-${PV}.tar.gz"
+SRC_URI = "http://downloads.sourceforge.net/hts-engine/hts_engine_API-${PV}.tar.gz \
+ file://nomalize.patch \
+ "
SRC_URI[md5sum] = "5626d1e2522659e93fb295f0b42339f5"
SRC_URI[sha256sum] = "e2132be5860d8fb4a460be766454cfd7c3e21cf67b509c48e1804feab14968f7"