Example #1
0
 private void btnRemove_Click(object sender, EventArgs e)
 {
     btnBuild.Enabled  = false;
     btnRemove.Enabled = false;
     DataBase.Clear();
     TmpPlot.Clear();
 }
Example #2
0
        private void btnBuild_Click(object sender, EventArgs e)
        {
            double    qde  = 0;
            ArrayList temp = new ArrayList(dataLength);

            for (int i = 0; i < dataLength; i++)
            {
                double summ = 0;
                for (int j = 0; j < DataBase.Count; j++)
                {
                    summ += (double)((ArrayList)DataBase[j])[i];
                }
                summ /= DataBase.Count;
                for (int j = 0; j < DataBase.Count; j++)
                {
                    qde += Math.Pow((double)((ArrayList)DataBase[j])[i] - summ, 2);
                }
                temp.Add(summ);
            }
            qde = Math.Sqrt(qde) / DataBase.Count / dataLength;
            TmpPlot.Clear();
            TmpPlot.AddData(temp);
            pictureBox3.Image = new Bitmap(pictureBox3.Width, pictureBox3.Height);
            TmpPlot.Restore(Graphics.FromImage(pictureBox3.Image));
            TmpPlot.DrawData();
            lbVariation.Text = "Среднее отклонение - " + qde.ToString();
        }
Example #3
0
        private void DWTTest_Resize(object sender, EventArgs e)
        {
            if (FilePlot != null)
            {
                pictureBox1.Image = new Bitmap(pictureBox1.Width, pictureBox1.Height);
                pictureBox2.Image = new Bitmap(pictureBox2.Width, pictureBox2.Height);
                pictureBox3.Image = new Bitmap(pictureBox3.Width, pictureBox3.Height);

                FilePlot.Resize(pictureBox1.DisplayRectangle);
                FilePlot.Restore(Graphics.FromImage(pictureBox1.Image));

                FPlot.Resize(pictureBox2.DisplayRectangle);
                FPlot.Restore(Graphics.FromImage(pictureBox2.Image));

                TmpPlot.Resize(pictureBox3.DisplayRectangle);
                TmpPlot.Restore(Graphics.FromImage(pictureBox3.Image));

                FilePlot.DrawData();
                FPlot.DrawData();
                TmpPlot.DrawData();
            }
        }
Example #4
0
        private void button1_Click(object sender, EventArgs e)
        {
            OpenFileDialog OpD = new OpenFileDialog();

            if (OpD.ShowDialog() == System.Windows.Forms.DialogResult.OK)
            {
                label1.Text = OpD.FileName;
                WaveInput WI = new WaveInput(out Data);
                WI.TeachFromFiles(OpD.FileName);
                WI.StopRecording();
                pictureBox1.Image = new Bitmap(pictureBox1.Width, pictureBox1.Height);
                pictureBox2.Image = new Bitmap(pictureBox2.Width, pictureBox2.Height);
                pictureBox3.Image = new Bitmap(pictureBox3.Width, pictureBox3.Height);
                FilePlot          = new LBPlot(Graphics.FromImage(pictureBox1.Image), pictureBox1.DisplayRectangle);
                FPlot             = new LBPlot(Graphics.FromImage(pictureBox2.Image), pictureBox2.DisplayRectangle);
                if (TmpPlot == null)
                {
                    TmpPlot = new LBPlot(Graphics.FromImage(pictureBox3.Image), pictureBox3.DisplayRectangle);
                }
                else
                {
                    TmpPlot.Restore(Graphics.FromImage(pictureBox3.Image));
                }
                int l, r;
                FindVocal(Data, 32, out l, out r);
                //Data = Data.GetRange(l, r - l);
                PrepareArray(ref Data, 512);
                FilePlot.AddData(Data);
                FilePlot.SelectView(l, r);
                FilePlot.FreeView();
                FilePlot.ShowRange = true;
                FilePlot.DrawData();
                ProcessData(512);
                TmpPlot.DrawData();
                btnBuild.Enabled  = true;
                btnRemove.Enabled = true;
            }
        }
Example #5
0
        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();
        }