public static ArrayList Calculate() { int secpow = Convert.ToInt32(Math.Ceiling(Math.Log(Signal.Count, 2))); Signal.AddRange(ArrayList.Repeat(0d, (int)Math.Pow(2, secpow) - Signal.Count)); //Signal.AddRange(Signal.GetRange(0,(int)Math.Pow(2, secpow) - Signal.Count)); double[] signal = (double[])Signal.ToArray(typeof(System.Double)); LastAmplify = (double[])signal.Clone(); RawTransform.Transform(ref signal); //ArrayList fftArray = DigitalSignal.FFTransform(Signal); LastFFT = (double[])signal.Clone(); Coefs = RawTransform.getMFCC(signal); Coefs = RawTransform.getNeedMFCC(Coefs); string s = ""; for (int i = 0; i < Coefs.Length; i++) { s += " " + Coefs[i].ToString(); } Logger.Add("Calculated coeficients: " + s); ArrayList coef = new ArrayList(Coefs.Length); for (int i = 0; i < Coefs.Length; i++) { coef.Add(Coefs[i]); } return(coef); }
private void ProcessData(int WindowSize) { ArrayList Mf = new ArrayList(); for (int left = 0; left + WindowSize < Data.Count; left += WindowSize / 2) { double[] temp = new double[WindowSize]; temp = (double[])Data.GetRange(left, WindowSize).ToArray(typeof(double)); RawTransform.Transform(ref temp); FPlot.AddData(temp); temp = RawTransform.getMFCC(temp); Mf.AddRange(temp); } if ((dataLength == 0) | (Mf.Count < dataLength)) { dataLength = Mf.Count; TmpPlot.SelectView(0, dataLength); } DataBase.Add(Mf); TmpPlot.AddData(Mf); FPlot.DrawData(); TmpPlot.DrawData(); }