Esempio n. 1
0
        public IWaveSource CreateASineSource()
        {
            double frequency = 1200;
            double amplitude = 0.6;
            double phase     = 0.0;

            //Create a ISampleSource
            SG = new SineGenerator(frequency, amplitude, phase);

            //Convert the ISampleSource into a IWaveSource
            return(SG.ToWaveSource());
        }
        public void startPlaying()
        {
            foreach (double freq in frequencies)
            {
                SineGenerator generator = new SineGenerator(freq, 1.0, 0);
                VolumeSource  vol;
                mixer.AddSource(

                    generator.ToWaveSource()
                    .AppendSource(x => new DmoChannelResampler(x, monoToStereoChannelMatrix, sampleRate))
                    .AppendSource(x => new VolumeSource(x.ToSampleSource()), out vol)
                    );
            }

            soundOut.Initialize(mixer.ToWaveSource());
            soundOut.Play();
        }