private void microphone_Load(object sender, EventArgs e)
        {
            comboBox1.Text = comboBox1.Items[0].ToString();

            string SOX_DIR = @"C:\Program Files (x86)\sox-14-4-0";

            while (sox == null)
            {
                try{
                    sox = new SOX(SOX_DIR);
                }catch (Exception e2)
                {
                    sox = null;
                    MessageBox.Show(e2.Message, "sox load fail", MessageBoxButtons.OK, MessageBoxIcon.Warning);
                }

                if (sox == null)
                {
                    if (MessageBox.Show("musisz mieć zainstalowany sox\n\n http://sox.sourceforge.net/ \n\ninstal sox & click ok", "download sox!", MessageBoxButtons.OKCancel, MessageBoxIcon.Stop)
                        ==
                        DialogResult.Cancel)
                    {
                        Environment.Exit(-1);
                    }

                    using (FolderBrowserDialog dialog = new FolderBrowserDialog())
                    {
                        dialog.Description         = "Open a folder which contains SOX (sox.exe file)!";
                        dialog.ShowNewFolderButton = false;
                        dialog.RootFolder          = Environment.SpecialFolder.MyComputer;
                        if (dialog.ShowDialog() == DialogResult.OK)
                        {
                            SOX_DIR = dialog.SelectedPath;
                        }
                    }
                }
            }
        }
        private void button5_Click(object sender, EventArgs e)
        {
            TimeSpan ts = SOX.Execute(@"C:\Program Files (x86)\sox-14-4-0\rec.exe",
                                      "C:\\a.wav" +
                                      " silence 1 0.5 0.5% 1 0.5 1.0%" +
                                      " -r 16000 -b 16 -c 1 ", 10000);

            double time = Math.Round(ts.TotalMilliseconds / 1000.0, 2);

            MessageBox.Show("nagrano " + time + "s");

            if (time < 2)
            {
                MessageBox.Show("za malo!");
            }
            else
            {
                SOX.Execute(@"C:\Program Files (x86)\sox-14-4-0\rec.exe",
                            TMP_WAVFILENAME + " " + TMP_FLACFILENAME + " --norm=-3 silence 1 0.5 0.5%",
                            10 * 1000);

                RecognizeCommand(TMP_FLACFILENAME);
            }
        }
            private void microphone_Load(object sender, EventArgs e)
            {
                comboBox1.Text = comboBox1.Items[0].ToString();

                string SOX_DIR = @"C:\Program Files (x86)\sox-14-4-0";

                while (sox == null)
                {
                    try{
                        sox = new SOX(SOX_DIR);
                    }catch(Exception e2)  
                    {
                        sox = null;
                        MessageBox.Show(e2.Message,"sox load fail",MessageBoxButtons.OK,MessageBoxIcon.Warning);       
                    }

                    if(sox==null)
                    {
                        if (MessageBox.Show("musisz mieć zainstalowany sox\n\n http://sox.sourceforge.net/ \n\ninstal sox & click ok", "download sox!", MessageBoxButtons.OKCancel, MessageBoxIcon.Stop)
                            ==
                            DialogResult.Cancel)
                        {
                            Environment.Exit(-1);
                        }

                        using (FolderBrowserDialog dialog = new FolderBrowserDialog())
                        {
                            dialog.Description = "Open a folder which contains SOX (sox.exe file)!";
                            dialog.ShowNewFolderButton = false;
                            dialog.RootFolder = Environment.SpecialFolder.MyComputer;
                            if (dialog.ShowDialog() == DialogResult.OK)
                            {
                                SOX_DIR = dialog.SelectedPath;
                            }
                        }
                    }
                }
            }