Exemple #1
0
 public static void ShowHistogram(int[][] value)
 {
     if (value[0].SequenceEqual(value[1]) == false && value[0].SequenceEqual(value[2]) == false)
     {
         CharWindow formR = FormFactory.CreateCharForm(value[0]);
         formR.Name = "ValueR";
         formR.Histogram.Series[0].Name      = "valueR";
         formR.Histogram.Series[0].ChartType = System.Windows.Forms.DataVisualization.Charting.SeriesChartType.Spline;
         CharWindow formG = FormFactory.CreateCharForm(value[1]);
         formG.Name = "ValueG";
         formG.Histogram.Series[0].Name      = "valueG";
         formG.Histogram.Series[0].ChartType = System.Windows.Forms.DataVisualization.Charting.SeriesChartType.Spline;
         CharWindow formB = FormFactory.CreateCharForm(value[2]);
         formB.Name = "ValueB";
         formB.Histogram.Series[0].Name      = "valueB";
         formB.Histogram.Series[0].ChartType = System.Windows.Forms.DataVisualization.Charting.SeriesChartType.Spline;
         formR.Show();
         formG.Show();
         formB.Show();
     }
     else
     {
         CharWindow form = FormFactory.CreateCharForm(value[2]);
         form.Name = "ValueLight";
         form.Histogram.Series[0].Name      = "ValueLight";
         form.Histogram.Series[0].ChartType = System.Windows.Forms.DataVisualization.Charting.SeriesChartType.Spline;
         form.Show();
     }
 }
        private void notCausal_Click(object sender, EventArgs e)
        {
            int windowSize;
            int hopSize;
            int filterSize;
            int fc;

            int.TryParse(this.WindowSize.Text, out windowSize);
            int.TryParse(this.R.Text, out hopSize);
            int.TryParse(this.L.Text, out filterSize);
            int.TryParse(this.Fc.Text, out fc);

            Stopwatch time = new Stopwatch();

            time.Start();
            float[] result = _audio.FrequencyFiltration(windowSize, filterSize, fc, hopSize, windowType.SelectedIndex, "notCasual");
            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("freqNotCasualFilter", _audio.fileName, _audio.sampleRate, result);
        }