Tests.SpeechTests.TestDistortion C# (CSharp) Method

TestDistortion() private method

private TestDistortion ( ) : void
return void
        public void TestDistortion()
        {
            EventWaitHandle waitHandle = new AutoResetEvent(false);

            using (MemoryStream stream = new MemoryStream())
            using (SpeechSynthesizer synth = new SpeechSynthesizer())
            {
                foreach (InstalledVoice voice in synth.GetInstalledVoices())
                {
                    Console.WriteLine(voice.VoiceInfo.Name);
                }

                synth.SetOutputToWaveStream(stream);
                synth.Speak("Anaconda golf foxtrot lima one niner six eight requesting docking.");
                stream.Seek(0, SeekOrigin.Begin);

                IWaveSource source = new WaveFileReader(stream);
                DmoDistortionEffect distortedSource = new DmoDistortionEffect(source);
                distortedSource.Edge = 10;
                distortedSource.PreLowpassCutoff = 4800;

                var soundOut = new WasapiOut();
                soundOut.Stopped += (s, e) => waitHandle.Set();

                soundOut.Initialize(distortedSource);
                soundOut.Play();

                waitHandle.WaitOne();

                soundOut.Dispose();
                distortedSource.Dispose();
                source.Dispose();
            }
        }