private static void Start(int frequency)
        {
            if (waveOut != null)
            {
                waveOut.Stop();
                waveOut.Dispose();
                waveOut = null;
            }

            frequency = Math.Min(700, frequency);

            var sineWaveProvider = new SineWaveProvider32(frequency, 0.05f);

            sineWaveProvider.SetWaveFormat(44100, 2); // 16kHz mono
            using (waveOut = new WaveOut())
            {
                waveOut.Init(sineWaveProvider);
                waveOut.Play();

                while (waveOut.PlaybackState == PlaybackState.Playing)
                {
                    Thread.Sleep(2000);
                }
            }
        }
        private static void Start(int frequency, float pDuration)
        {
            try
            {
                if (waveOut != null)
                {
                    try
                    {
                        waveOut.Stop();
                        waveOut.Dispose();
                    }
                    catch (Exception ex)
                    {
                        Logger.Log(ex.ToString());
                    }
                    finally
                    {
                        waveOut = null;
                    }
                }

                frequency = Math.Min(700, frequency);

                var sineWaveProvider = new SineWaveProvider32(frequency, 0.05f, pDuration);
                sineWaveProvider.SetWaveFormat(44100, 2); // 16kHz mono
                using (waveOut = new WaveOut())
                {
                    waveOut.Init(sineWaveProvider);
                    waveOut.Play();

                    while (waveOut.PlaybackState == PlaybackState.Playing)
                    {
                        Thread.Sleep(2000);
                    }
                }
            }
            catch (Exception ex)
            {
                Logger.Log(ex.ToString());
            }
        }