shithub: opus

Download patch

ref: ac3ac4a30c4c07587dadb77666ab6251d88921ad
parent: bb7b4f4e5e41893f8df0b059b5a8a753cfeb21a0
author: Jean-Marc Valin <[email protected]>
date: Mon Nov 21 09:35:41 EST 2011

Adds cepstral mean subtraction (CMS) to analysis

--- a/src/analysis.c
+++ b/src/analysis.c
@@ -81,6 +81,7 @@
    float E[NB_FRAMES][NB_TBANDS];
    float lowE[NB_TBANDS], highE[NB_TBANDS];
    float mem[32];
+   float cmean[8];
    int E_count;
    int count;
 } TonalityAnalysisState;
@@ -280,13 +281,15 @@
     tonal->count++;
     info->tonality = frame_tonality;
 
-    for (i=1;i<8;i++)
-        features[i-1] = -0.12299*(BFCC[i]+tonal->mem[i+24]) + 0.49195*(tonal->mem[i]+tonal->mem[i+16]) + 0.69693*tonal->mem[i+8];
+    for (i=0;i<8;i++)
+       features[i] = -0.12299*(BFCC[i]+tonal->mem[i+24]) + 0.49195*(tonal->mem[i]+tonal->mem[i+16]) + 0.69693*tonal->mem[i+8] - 1.4349*tonal->cmean[i];
+    for (i=0;i<8;i++)
+       tonal->cmean[i] = .95*tonal->cmean[i] + .05*BFCC[i];
 
     for (i=0;i<8;i++)
-        features[7+i] = 0.63246*(BFCC[i]-tonal->mem[i+24]) + 0.31623*(tonal->mem[i]-tonal->mem[i+16]);
+        features[8+i] = 0.63246*(BFCC[i]-tonal->mem[i+24]) + 0.31623*(tonal->mem[i]-tonal->mem[i+16]);
     for (i=0;i<8;i++)
-        features[15+i] = 0.53452*(BFCC[i]+tonal->mem[i+24]) - 0.26726*(tonal->mem[i]+tonal->mem[i+16]) -0.53452*tonal->mem[i+8];
+        features[16+i] = 0.53452*(BFCC[i]+tonal->mem[i+24]) - 0.26726*(tonal->mem[i]+tonal->mem[i+16]) -0.53452*tonal->mem[i+8];
     for (i=0;i<8;i++)
     {
        tonal->mem[i+24] = tonal->mem[i+16];
@@ -294,8 +297,7 @@
        tonal->mem[i+8] = tonal->mem[i];
        tonal->mem[i] = BFCC[i];
     }
-    features[23] = info->tonality;
-    features[24] = info->tonality_slope;
+    features[24] = info->tonality;
     features[25] = info->activity;
     features[26] = frame_stationarity;
 
--- a/src/mlp_data.c
+++ b/src/mlp_data.c
@@ -1,71 +1,71 @@
 #include "mlp.h"
 
-/* RMS error was 0.196871, seed was 1321340808 */
+/* RMS error was 0.289219, seed was 1321882865 */
 
 static const float weights[291] = {
 
 /* hidden layer */
-1.93994, 0.00636575, -0.0838112, 0.188811, -0.157845, 
--0.122662, 0.296779, -0.066386, -0.0764464, -0.00372055, 
--0.0397377, -0.000976218, -0.03931, 0.0111525, -0.0377797, 
--0.003592, 0.00213057, 0.115952, -0.0864595, 0.170621, 
--0.139312, -0.125683, 0.226746, -0.148058, -3.11536, 
--5.7119, -0.325896, -4.37802, 2.1242, -0.119952, 
-0.0232531, -0.0998321, -0.0909719, -0.164338, 0.0370311, 
-0.0196689, 0.0495503, -0.267277, -0.15925, -0.129835, 
--0.171845, -0.0672326, -0.0319364, -0.0960325, 0.132835, 
-0.0978292, -0.0204049, -0.128357, -0.0582566, -0.21682, 
-0.00496659, -0.0224912, -2.3249, 2.10627, -5.06275, 
-0.300689, -1.05938, 0.111387, 0.100606, 0.122446, 
--0.0175274, 0.0107236, -0.030947, -0.0712338, -0.0456196, 
-0.0158188, 0.0139863, 0.0122389, 0.0426144, 0.00963211, 
-0.00741379, 0.014572, -0.0365356, 0.0780221, 0.0835844, 
-0.101463, -0.0194471, 0.016752, -0.0360326, -0.0671933, 
-5.35889, -6.06707, 1.35677, -1.90924, 0.0347801, 
-0.0122876, 0.00258179, -0.0217294, 0.0827611, 0.0859281, 
--0.00417207, -0.109872, -0.238913, -0.288535, -0.0319008, 
-0.156671, -0.00911369, -0.0351284, 0.0355504, 0.101236, 
--0.140194, -0.128439, 0.0275677, -0.0507381, 0.106048, 
-0.0672367, 0.00438842, -0.0925318, 5.68238, -3.47798, 
-0.246634, 0.0970976, -1.33011, 0.0498353, 0.179046, 
-0.0162675, -0.102764, -0.227255, 0.234701, -0.00777973, 
-0.0767733, -0.00420136, 0.0344874, -0.0332389, 0.062122, 
--0.0360523, 0.0461029, 0.0861842, 0.0136479, 0.0133092, 
-0.165541, -0.0573712, -0.0694408, -0.196571, 0.222621, 
-0.0197353, 3.42359, 5.23165, -1.10221, 3.66079, 
-0.40144, -0.493484, 0.217106, -0.0143906, 0.295599, 
--0.614104, 0.596788, 0.956514, 0.107316, -0.172138, 
--0.111201, 0.0162694, -0.136564, 0.0567972, -0.107051, 
--0.0578785, 0.0597572, -0.592051, 0.11802, -0.0846178, 
-0.144399, -0.386859, 0.429763, 0.763419, 8.40166, 
-4.25269, -3.25962, 2.04492, -1.54948, 0.0286627, 
-0.0855541, -0.128902, 0.0428149, 0.147296, -0.178688, 
-0.582621, -0.0423034, -0.168806, -0.0930681, -0.0505222, 
--0.059881, 0.0344017, -0.0538223, -0.0095173, 0.044275, 
-0.178126, 0.0321441, -0.192936, -0.0359919, 0.0449504, 
--0.255187, 0.330503, 14.3362, -12.7585, 2.10511, 
-1.00446, -1.5146, 0.00315578, -0.0189675, 0.0506854, 
--0.0306224, -0.0343434, -0.0222091, 0.00040356, -0.179946, 
--0.213007, -0.046152, 0.0122855, 0.0335543, -0.0172102, 
-0.0236597, 0.088535, -0.0980871, -0.129909, -0.019153, 
-0.0544563, -0.0272701, -0.00304803, -0.00145721, 0.0190295, 
--6.75401, 2.83619, 2.38708, -0.904901, 0.670252, 
--0.0809205, -0.077534, -0.0347895, -0.0143415, -0.00527138, 
-0.0400907, 0.041551, 0.00823289, -0.00772847, -0.0172196, 
--0.0125943, -0.0285652, -0.00141913, -0.010938, -0.0154068, 
-0.0149916, -0.0577316, -0.0750255, -0.019028, -0.0175507, 
--0.00248046, 0.0350994, 0.0396102, -0.334886, 1.32123, 
--0.363775, 0.0925417, 7.5025, 0.76236, 0.489961, 
-0.514362, 0.350457, 0.321636, -0.000131804, 0.0942301, 
-0.506788, -0.325235, 0.162356, -0.147705, 0.155451, 
--0.111074, 0.120173, 0.0586432, 0.407685, 0.374031, 
-0.510908, 0.25445, 0.285288, 0.184939, 0.0386202, 
-0.089713, 12.6662, 2.54239, -14.9728, 7.46559, 
+-0.199585, 0.519784, -0.56124, 0.794181, -0.511447, 
+0.395744, -0.376191, 0.397133, -0.0705616, 0.0810292, 
+-0.122263, 0.0953031, -0.10071, 0.0797124, -0.0624449, 
+-0.0217925, 0.0169053, 0.37901, -0.327709, 0.541853, 
+-0.341477, 0.270965, -0.244754, 0.270282, -0.0416849, 
+1.12999, -0.40961, 1.22527, 0.233913, -0.387647, 
+0.453466, -0.607947, 0.408126, -0.30037, 0.300392, 
+-0.311586, 0.0725098, -0.0476953, 0.0892214, -0.0760982, 
+0.0761782, -0.0615639, 0.0485215, 0.0206805, -0.0129586, 
+-0.27531, 0.26983, -0.419162, 0.277476, -0.207749, 
+0.196334, -0.211023, 0.0450457, -2.12546, -0.165252, 
+-0.41337, 2.63555, 0.14104, -0.261118, -0.633559, 
+0.218407, 0.611674, -0.412547, -1.20741, 0.427266, 
+0.123023, 0.166406, 0.411747, -0.151141, 0.0896422, 
+0.173108, -0.00137031, 0.243854, 0.211839, -0.296422, 
+-0.628128, 0.149742, 0.248921, -0.156734, -0.874198, 
+0.281824, 2.12192, -4.86663, 7.22716, -4.02194, 
+-0.0303328, -0.084973, 0.130546, 0.934994, -0.130172, 
+-0.212654, 0.135762, -0.100151, -0.0773431, -0.0163684, 
+-0.0925923, -0.0533787, -0.00281159, -0.0454802, -0.0539635, 
+0.00801064, -0.0741279, -0.13163, 0.122988, 0.823681, 
+-0.104791, -0.159906, 0.150275, -0.0215005, -3.03836, 
+4.06664, -2.89737, -1.02205, -0.0923251, 0.0475099, 
+0.00546651, -0.0973161, 0.26429, -0.0825506, -0.0920445, 
+0.377156, -0.265505, -0.458065, -0.168825, -0.0202509, 
+-0.0429996, 0.0396544, -0.0239828, 0.165668, -0.0213517, 
+0.185042, -0.0250296, -0.120034, 0.214526, -0.0463617, 
+-0.1057, 0.135015, -19.0867, 1.25468, -2.08001, 
+-8.82707, -0.101745, 0.0956654, -0.11192, 0.0305665, 
+0.0417711, -0.0791366, 0.0595958, -0.0531078, -0.323443, 
+0.105116, 0.161608, -0.00247322, 0.1102, 0.06836, 
+-0.016405, 0.0748947, -0.40797, -0.0559214, -0.0119188, 
+0.00719443, 0.0839447, 0.00538025, 0.059951, 0.0361408, 
+-5.32823, 11.4557, -1.9048, -2.48173, 0.00338364, 
+0.216516, 0.137032, 0.18395, 0.119532, 0.103407, 
+0.0350206, -0.00728442, -0.144015, -0.149388, -0.10501, 
+-0.123531, -0.0464658, -0.0159831, -0.053265, 0.0481782, 
+-0.00839314, 0.284347, 0.0456719, 0.12639, 0.092542, 
+0.05617, -0.0303728, -0.0620569, 7.4721, 5.47042, 
+0.114486, 2.65169, -0.0866742, 0.145115, 0.559422, 
+0.247432, 0.225527, -0.453849, 0.511296, 0.441921, 
+0.110568, -0.0378332, -0.118717, -0.08303, -0.111274, 
+0.126658, -0.0864498, -0.0251473, -0.0759235, 0.12197, 
+0.529339, 0.0903978, 0.0657576, -0.362635, 0.365873, 
+0.328984, 9.14411, -2.79891, 2.43201, 2.56583, 
+-0.205957, -0.624725, -0.159719, -0.222437, -0.0953691, 
+-0.067294, 0.0302929, 0.0176202, 0.185405, 0.332995, 
+0.013006, 0.0113313, 0.0597282, -0.0178074, -0.000720698, 
+0.117357, -0.186799, -0.615088, -0.133286, -0.183112, 
+-0.0271545, -0.0700072, 0.0408067, 0.0998989, 2.10728, 
+-2.5687, 2.42354, 1.49565, 0.0194189, -0.0334431, 
+0.0516768, 0.180448, -0.179868, 0.00109635, 0.184112, 
+-0.256548, -0.315385, -0.52391, 0.146098, 0.467537, 
+0.251975, 0.0840594, 0.274851, 0.239901, -0.331939, 
+-0.597664, 0.145825, 0.228226, 0.0303611, 0.0232017, 
+0.298219, -0.145128, 19.4815, 0.038919, 0.101, 
 
 /* output layer */
--4.63633, -1.25936, -1.33365, 4.91614, 1.1609, 
-1.30642, -0.780207, 1.09432, -1.46686, 8.41454, 
-1.55149, };
+-5.28676, -5.60396, -5.78171, 0.576374, -1.09439, 
+-1.20859, -0.792729, 1.30723, 0.519472, 0.813985, 
+0.567552, };
 
 static const int topo[3] = {27, 10, 1};