sumom****@users*****
sumom****@users*****
2012年 10月 10日 (水) 11:47:11 JST
Index: julius4/libjulius/src/adin-cut.c diff -u julius4/libjulius/src/adin-cut.c:1.19 julius4/libjulius/src/adin-cut.c:1.20 --- julius4/libjulius/src/adin-cut.c:1.19 Wed Aug 15 15:50:27 2012 +++ julius4/libjulius/src/adin-cut.c Wed Oct 10 11:47:11 2012 @@ -95,7 +95,7 @@ * @author Akinobu LEE * @date Sat Feb 12 13:20:53 2005 * - * $Revision: 1.19 $ + * $Revision: 1.20 $ * */ /* @@ -159,6 +159,7 @@ } #endif adin->need_zmean = jconf->preprocess.use_zmean; + adin->level_coef = jconf->preprocess.level_coef; /* calc & set internal parameter from configuration */ freq = jconf->input.sfreq; samples_in_msec = (float) freq / (float)1000.0; @@ -414,6 +415,12 @@ if (a->bp == 0) break; } } + if (cnt > 0 && a->level_coef != 1.0) { + /* scale the level of incoming input */ + for (i = a->bp; i < a->bp + cnt; i++) { + a->buffer[i] = (SP16) ((float)a->buffer[i] * a->level_coef); + } + } /*************************************************/ /* execute callback here for incoming raw data stream.*/ Index: julius4/libjulius/src/default.c diff -u julius4/libjulius/src/default.c:1.15 julius4/libjulius/src/default.c:1.16 --- julius4/libjulius/src/default.c:1.15 Fri Jul 27 17:44:49 2012 +++ julius4/libjulius/src/default.c Wed Oct 10 11:47:11 2012 @@ -17,7 +17,7 @@ * @author Akinobu Lee * @date Fri Feb 16 15:05:43 2007 * - * $Revision: 1.15 $ + * $Revision: 1.16 $ * */ /* @@ -86,6 +86,7 @@ j->preprocess.strip_zero_sample = TRUE; j->preprocess.use_zmean = FALSE; + j->preprocess.level_coef = 1.0; j->reject.gmm_filename = NULL; j->reject.gmm_gprune_num = 10; Index: julius4/libjulius/src/jfunc.c diff -u julius4/libjulius/src/jfunc.c:1.9 julius4/libjulius/src/jfunc.c:1.10 --- julius4/libjulius/src/jfunc.c:1.9 Fri Jul 27 17:44:49 2012 +++ julius4/libjulius/src/jfunc.c Wed Oct 10 11:47:11 2012 @@ -19,7 +19,7 @@ * @author Akinobu Lee * @date Wed Aug 8 15:04:28 2007 * - * $Revision: 1.9 $ + * $Revision: 1.10 $ * */ /* @@ -1639,4 +1639,21 @@ #endif +/** + * Change the scaling factor of input audio level. Set to 1.0 to disable. + * + * @param recog [i/o] engine instance + * @param factor [in] factor value (1.0 to disable scaling) + * + * @callgraph + * @callergraph + * @ingroup engine + */ +void +j_adin_change_input_scaling_factor(Recog *recog, float factor) +{ + recog->adin->level_coef = factor; + recog->jconf->preprocess.level_coef = factor; +} + /* end of file */ Index: julius4/libjulius/src/m_info.c diff -u julius4/libjulius/src/m_info.c:1.15 julius4/libjulius/src/m_info.c:1.16 --- julius4/libjulius/src/m_info.c:1.15 Fri Jul 27 17:44:49 2012 +++ julius4/libjulius/src/m_info.c Wed Oct 10 11:47:11 2012 @@ -12,7 +12,7 @@ * @author Akinobu Lee * @date Thu May 12 14:14:01 2005 * - * $Revision: 1.15 $ + * $Revision: 1.16 $ * */ /* @@ -893,6 +893,12 @@ } else { jlog("\t long-term DC removal = off\n"); } + jlog("\t long-term DC removal = off\n"); + if (jconf->preprocess.level_coef != 1.0) { + jlog("\t level scaling factor = %.2f\n", jconf->preprocess.level_coef); + } else { + jlog("\t level scaling factor = %.2f (disabled)\n", jconf->preprocess.level_coef); + } } jlog("\t reject short input = "); if (jconf->reject.rejectshortlen > 0) { Index: julius4/libjulius/src/m_options.c diff -u julius4/libjulius/src/m_options.c:1.26 julius4/libjulius/src/m_options.c:1.27 --- julius4/libjulius/src/m_options.c:1.26 Fri Jul 27 17:44:49 2012 +++ julius4/libjulius/src/m_options.c Wed Oct 10 11:47:11 2012 @@ -18,7 +18,7 @@ * @author Akinobu Lee * @date Thu May 12 18:52:07 2005 * - * $Revision: 1.26 $ + * $Revision: 1.27 $ * */ /* @@ -979,6 +979,11 @@ if (!check_section(jconf, argv[i], JCONF_OPT_GLOBAL)) return FALSE; jconf->preprocess.use_zmean = FALSE; continue; + } else if (strmatch(argv[i],"-lvscale")) { /* input level scaling factor */ + if (!check_section(jconf, argv[i], JCONF_OPT_GLOBAL)) return FALSE; + GET_TMPARG; + jconf->preprocess.level_coef = (float)atof(tmparg); + continue; } else if (strmatch(argv[i],"-zmeanframe")) { /* enable frame-wise DC offset by zero mean */ if (!check_section(jconf, argv[i], JCONF_OPT_AM)) return FALSE; jconf->amnow->analysis.para.zmeanframe = TRUE; Index: julius4/libjulius/src/m_usage.c diff -u julius4/libjulius/src/m_usage.c:1.18 julius4/libjulius/src/m_usage.c:1.19 --- julius4/libjulius/src/m_usage.c:1.18 Sun Aug 5 10:26:54 2012 +++ julius4/libjulius/src/m_usage.c Wed Oct 10 11:47:11 2012 @@ -12,7 +12,7 @@ * @author Akinobu Lee * @date Fri May 13 15:04:34 2005 * - * $Revision: 1.18 $ + * $Revision: 1.19 $ * */ /* @@ -111,6 +111,7 @@ fprintf(fp, " [-adport portnum] adinnet port number to listen (%d)\n", jconf->input.adinnet_port); fprintf(fp, " [-48] enable 48kHz sampling with internal down sampler (OFF)\n"); fprintf(fp, " [-zmean/-nozmean] enable/disable DC offset removal (OFF)\n"); + fprintf(fp, " [-lvscale] input level scaling factor (1.0: OFF) (%.1f)\n", jconf->preprocess.level_coef); fprintf(fp, " [-nostrip] disable stripping off zero samples\n"); fprintf(fp, " [-record dir] record triggered speech data to dir\n"); fprintf(fp, " [-rejectshort msec] reject an input shorter than specified\n");