Ejemplo n.º 1
0
        public void SineWave_1000_samples_500000_iterations_4_channels()
        {
            var buffers = new[]
            {
                new float[1000],
                new float[1000],
                new float[1000],
                new float[1000]
            };

            var target = new SineWave();
            target.Format = new WaveFormat(44100, 4);

            for (int i = 0; i < 500000; i++)
            {
                target.Process(buffers, 1000);
            }
        }
Ejemplo n.º 2
0
 public void TestInitialise()
 {
     target = new SineWave();
     target.Format = new WaveFormat(44100, 2);
 }
Ejemplo n.º 3
0
        private void BuildSineWaveChain(WaveFormat stereoFormat)
        {
            sineWave = new SineWave();
            sineWaveNode = new StereoSignalNode(stereoFormat, sineWave);

            sineWaveNode.LeftIn.Source = asioInput.Sources.ElementAt(0);
            sineWaveNode.RightIn.Source = asioInput.Sources.ElementAt(0);

            filter = new ComplexFilter(
                stereoFormat,
                new BlackmanHarrisWindowFunction(),
                new FirFilter());

            filter.Filters.Add(new DigitalFilter
            {
                FilterFunction = new BandStopFilterFunction(),
                LowerCutOffFrequency = 10000f,
                UpperCutOffFrequency = 12000f
            });

            stereoFilterNode = new StereoSignalNode(stereoFormat, filter.FilterImplementation);

            stereoFilterNode.LeftIn.Source = sineWaveNode.LeftOut;
            stereoFilterNode.RightIn.Source = sineWaveNode.RightOut;

            fourier = new FourierTransform(
                new FastFourierTransformProvider(),
                new BlackmanHarrisWindowFunction(),
                2048);
            fourierNode = new MonoSignalNode(stereoFormat, fourier);
            fourier.DataReady += fourierControl.fourier_DataReady;

            fourierNode.CentreIn.Source = stereoFilterNode.LeftOut;

            asioOutput.Sinks.ElementAt(0).Source = stereoFilterNode.LeftOut;
            asioOutput.Sinks.ElementAt(1).Source = stereoFilterNode.RightOut;
        }