• R/O
  • SSH
  • HTTPS

cadencii: コミット


コミットメタ情報

リビジョン1984 (tree)
日時2012-02-13 02:56:04
作者haruneko24

ログメッセージ

[StandConverter] Transcriberが正常に動作するように変更.また時間伸縮関数が正しく読めていなかったのを修正.

変更サマリ

差分

--- vConnect/trunk/stand2.0/StandConverter/main.cpp (revision 1983)
+++ vConnect/trunk/stand2.0/StandConverter/main.cpp (revision 1984)
@@ -19,7 +19,7 @@
1919
2020 // 実行
2121 // ConverterWindow w;
22-// w.setWindowTitle("Compressor");
22+// w.setWindowTitle("Compressor");
2323 TranscriberWindow w;
2424 w.setWindowTitle("Transcriber");
2525 w.show();
--- vConnect/trunk/stand2.0/StandConverter/io/StandFile.h (revision 1983)
+++ vConnect/trunk/stand2.0/StandConverter/io/StandFile.h (revision 1984)
@@ -89,6 +89,10 @@
8989 {
9090 return _baseTimeAxis;
9191 }
92+ float *timeAxis()
93+ {
94+ return _t;
95+ }
9296
9397 float framePeriod() const
9498 {
--- vConnect/trunk/stand2.0/StandConverter/io/StandFile.cpp (revision 1983)
+++ vConnect/trunk/stand2.0/StandConverter/io/StandFile.cpp (revision 1984)
@@ -101,6 +101,7 @@
101101 if(fread(&_baseTimeLength, sizeof(qint32), 1, fp) == 1 && _baseTimeLength > 0)
102102 {
103103 _baseTimeAxis = new float[_baseTimeLength];
104+ fread(_baseTimeAxis, sizeof(float), _baseTimeLength, fp);
104105 }
105106 else
106107 {
@@ -278,11 +279,15 @@
278279 _calculateVolumeEnvelope(src_env, src, src_len);
279280 _calculateVolumeEnvelope(dst_env, dst, dst_len);
280281
281- for( int i = 0; i < src_len - 1; i++ ){
282+ for( int i = 0; i < src_len - 1; i++ )
283+ {
282284 double tmp = (double)i / (double)src_len * (double)dst_len;
283- if( tmp >= dst_len - 1 ){
285+ if( tmp >= dst_len - 1 )
286+ {
284287 dst_to_src_stretched[i] = dst_env[dst_len-1];
285- }else{
288+ }
289+ else
290+ {
286291 dst_to_src_stretched[i] = stand::math::interpolateArray(tmp, dst_env);
287292 }
288293 }
@@ -290,13 +295,12 @@
290295
291296 stand::math::smoothMatching(dst_to_src_stretched, src_to_dst, src_env, dst_to_src_stretched, src_len);
292297
293- double framePeriod = src->framePeriod();
294298 for( int i = 0; i < dst_len - 1; i++ )
295299 {
296300 double tmp = (double)i / (double)dst_len * (double)src_len;
297301 if( tmp >= src_len - 1 )
298302 {
299- dst_to_src[i] = dst_to_src_stretched[src_len-1] * dst->framePeriod() / 1000.0 / (double)src_len * (double)dst_len;
303+ dst_to_src[i] = (dst_len - 1) * dst->framePeriod() / 1000.0;
300304 }
301305 else
302306 {
@@ -303,13 +307,12 @@
303307 dst_to_src[i] = stand::math::interpolateArray(tmp, dst_to_src_stretched) * dst->framePeriod() / 1000.0 / (double)src_len * (double)dst_len;
304308 }
305309 }
306- dst_to_src[dst_len-1] = dst_to_src_stretched[src_len-1] * dst->framePeriod() / 1000.0 / (double)src_len * (double)dst_len;
310+ dst_to_src[dst_len-1] = (dst_len - 1) * dst->framePeriod() / 1000.0;
307311
308312 for( int i = 0; i < src_len; i++ )
309313 {
310- dst_to_src_stretched[i] = src_to_dst[i] * framePeriod / 1000.0;
314+ src_to_dst[i] *= src->framePeriod() / 1000.0;
311315 }
312- memcpy( src_to_dst, dst_to_src_stretched, sizeof( double ) * src_len );
313316
314317 dst->setTimeAxis(dst_to_src, dst_len);
315318 dst->setBaseTimeAxis(src_to_dst, src_len);
@@ -391,6 +394,7 @@
391394 {
392395 if(length != _tLen)
393396 {
397+ qDebug("StandFile::setTimeAxis(%d); // length is not equalt to innner data(%d)", length, _tLen);
394398 return;
395399 }
396400 for(int i = 0; i < length; i++)
--- vConnect/trunk/stand2.0/StandConverter/math/SmootMatching.cpp (revision 1983)
+++ vConnect/trunk/stand2.0/StandConverter/math/SmootMatching.cpp (revision 1984)
@@ -25,6 +25,16 @@
2525 /* 変形関数の傾きに対する重み */
2626 const double G_WEIGHT = 1.5;
2727
28+void stand::math::applyStretching( double *T, double *target, int length )
29+{
30+ int i;
31+ double *tmp = (double *)malloc(sizeof(double) * length);
32+ for( i = 0; i < length; i++ )
33+ tmp[i] = interpolateArray( T[i], target );
34+ memcpy( target, tmp, sizeof(double) * length );
35+ free(tmp);
36+}
37+
2838 void get_graduation( double* src, double* dst, int length,
2939 double *d1s, double *d2s, double *d1d, double *d2d)
3040 {
--- vConnect/trunk/stand2.0/StandConverter/math/MFCCSet.cpp (revision 1983)
+++ vConnect/trunk/stand2.0/StandConverter/math/MFCCSet.cpp (revision 1984)
@@ -51,6 +51,10 @@
5151
5252 _ffft->execute();
5353 stretchFromMelScale(result, (double *)_ffft->out(), length() / 2 + 1, fs / 2);
54+ for(int i = 0; i <= length() / 2; i++)
55+ {
56+ result[i] = exp(result[i]);
57+ }
5458 return result;
5559 }
5660
@@ -72,6 +76,10 @@
7276
7377 _ffft->execute();
7478 stretchFromMelScale(result, (double *)_ffft->out(), length() / 2 + 1, fs / 2);
79+ for(int i = 0; i <= length() / 2; i++)
80+ {
81+ result[i] = exp(result[i]);
82+ }
7583 return result;
7684 }
7785
--- vConnect/trunk/stand2.0/stand/vConnectPhoneme.cpp (revision 1983)
+++ vConnect/trunk/stand2.0/stand/vConnectPhoneme.cpp (revision 1984)
@@ -131,6 +131,7 @@
131131 if(fread(&baseTimeLength, sizeof(int), 1, fp) == 1 && baseTimeLength > 0)
132132 {
133133 baseTimeAxis = new float[baseTimeLength];
134+ fread(baseTimeAxis, sizeof(float), baseTimeLength, fp);
134135 }
135136 else
136137 {
旧リポジトリブラウザで表示