예제 #1
0
        private void TimeFilter_Click(object sender, EventArgs e)
        {
            int filterSize;
            int fc;

            int.TryParse(this.L.Text, out filterSize);
            int.TryParse(this.Fc.Text, out fc);

            Stopwatch time = new Stopwatch();

            time.Start();
            double[] result = _audio.TimeFiltration(filterSize, fc, windowType.SelectedIndex);
            time.Stop();
            MessageBox.Show(time.ElapsedMilliseconds.ToString() + " ms");


            #region filterChar
            CharWindow resultSignalChar = new CharWindow();
            resultSignalChar.setPropert();

            resultSignalChar.Histogram.Series.Add("WindowCharm");
            resultSignalChar.Text = "SignalChar";
            resultSignalChar.Histogram.Series["WindowCharm"].ChartType  = System.Windows.Forms.DataVisualization.Charting.SeriesChartType.FastLine;
            resultSignalChar.Histogram.Series["WindowCharm"].MarkerSize = 2;
            resultSignalChar.Histogram.ChartAreas[0].AxisX.Title        = "Index";
            resultSignalChar.Histogram.ChartAreas[0].AxisY.Title        = "signal value";

            for (int i = 0; i < result.Count(); i++)
            {
                resultSignalChar.Histogram.Series["WindowCharm"].Points.AddXY(i, result[i]);
            }

            resultSignalChar.Show();
            #endregion

            SoundUtil.SaveSound("timeFilter", _audio.fileName, _audio.sampleRate, SoundUtil.ConvertDoubleArrayToFloatArray(result));
        }