Пример #1
0
        private void BtnStop_Click(object sender, EventArgs e)
        {
            Learn.RecCommands.Add(SoundProcessing.Stop());

            ComCounter--;
            if (ComCounter == 0)
            {
                LblProg.Text = string.Format("Запишите команду еще {0} раз", ComCounter);
            }
            else
            {
                LblProg.Text = string.Format("Запишите команду еще {0} раза", ComCounter);
            }
            PrbLearning.Value = 100 * (Learning.COUNT - ComCounter) / Learning.COUNT;

            BtnStart.Visible = true;
            BtnStop.Visible  = false;

            if (ComCounter == 0)
            {
                BtnSave.Visible = true;
            }

            Bitmap Bmp = new Bitmap(pictureBox1.Width, pictureBox1.Height);

            pictureBox1.BackgroundImage = Bmp;
            LBPlot.DrawPlot(SoundProcessing.LastFFT /*. GetRange(0,SoundProcessing.LastAmplify.Length/128)*/, Bmp, false);
            //DigitalSignal.DrawPlot(SoundProcessing.LastFFT, Bmp, false);
        }
Пример #2
0
 private void btnClear_Click(object sender, EventArgs e)
 {
     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);
     TmpPlot           = new LBPlot(Graphics.FromImage(pictureBox3.Image), pictureBox3.DisplayRectangle);
     btnBuild.Enabled  = false;
 }
Пример #3
0
 private void btnClear_Click(object sender, EventArgs e)
 {
     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);
     TmpPlot = new LBPlot(Graphics.FromImage(pictureBox3.Image), pictureBox3.DisplayRectangle);
     btnBuild.Enabled = false;
 }
Пример #4
0
        private void DrawCoeffs()
        {
            if (ListCommands.SelectedIndex < 0)
            {
                return;
            }
            Bitmap Bmp = new Bitmap(pictureBox1.Width, pictureBox1.Height);

            pictureBox1.BackgroundImage = Bmp;
            LBPlot LB = new LBPlot(Graphics.FromImage(Bmp), pictureBox1.DisplayRectangle);

            LB.ShowText = true;
            LB.AddData((double[])((Command)Speech.Commands[ListCommands.SelectedIndex]).Coefs.ToArray(typeof(System.Double)));

            /*LB.AddData(ArrayList.Repeat(-1d, RawTransform.NEEDED_COEFS));
             * LB.AddData(ArrayList.Repeat(1d, RawTransform.NEEDED_COEFS));*/
            LB.SelectView(0, RawTransform.NEEDED_COEFS, 1, -1);
            //LBPlot.DrawPlot((double[])((Command)Speech.Commands[ListCommands.SelectedIndex]).Coefs.ToArray(typeof(System.Double)), Bmp);
            LB.DrawData();
        }
Пример #5
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;
            }
        }
Пример #6
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;
     }
 }
Пример #7
0
 private void DrawCoeffs()
 {
     if (ListCommands.SelectedIndex < 0) return;
     Bitmap Bmp = new Bitmap(pictureBox1.Width, pictureBox1.Height);
     pictureBox1.BackgroundImage = Bmp;
     LBPlot LB = new LBPlot(Graphics.FromImage(Bmp), pictureBox1.DisplayRectangle);
     LB.ShowText = true;
     LB.AddData((double[])((Command)Speech.Commands[ListCommands.SelectedIndex]).Coefs.ToArray(typeof(System.Double)));
     /*LB.AddData(ArrayList.Repeat(-1d, RawTransform.NEEDED_COEFS));
     LB.AddData(ArrayList.Repeat(1d, RawTransform.NEEDED_COEFS));*/
     LB.SelectView(0, RawTransform.NEEDED_COEFS, 1, -1);
     //LBPlot.DrawPlot((double[])((Command)Speech.Commands[ListCommands.SelectedIndex]).Coefs.ToArray(typeof(System.Double)), Bmp);
     LB.DrawData();
 }