Пример #1
0
        //Updating background noise vector with c_no = pc_+(1-p)c_i formula;
        //computing similarity between c_no(background noise vector) and current mfcc vector;
        private double[] ComputeSimilarity(double[] mfccList, double[] avrgNoise)
        {
            List <double> normalized = new List <double>();
            List <double> similarity = new List <double>();

            foreach (double[] Ci in mfccList.ToArray().Split(32))
            {
                var newAmounts = Ci.Select(a => a * (1.0 - p)).ToList();
                var Cno        = avrgNoise.Zip(newAmounts, (a, y) => a + y);
                var coeffCorr  = 1.0 - MathExtensions.ComputeCoeff(Ci.ToArray(), Cno.ToArray());
                similarity.Add(coeffCorr);
            }
            double length = similarity.Sum(a => a * a);

            length = Math.Sqrt(length);
            foreach (double ddd in similarity)
            {
                normalized.Add(ddd / length);
            }
            return(normalized.ToArray());
        }