Beispiel #1
0
        public void TestInitialise()
        {
            var ones = new float[100];

            for (int i = 0; i < 100; i++)
            {
                ones[i] = 1f;
            }

            transformProvider = Substitute.For <IFastFourierTransformProvider>();
            windowFunction    = Substitute.For <IWindowFunction>();
            windowFunction.CalculateCoefficients(Arg.Any <int>()).Returns(ones);

            target = new FourierTransform(transformProvider, windowFunction, 1);

            target.Format = new WaveFormat(44100, 1);
        }
Beispiel #2
0
        public FourierTransform(
            IFastFourierTransformProvider transformProvider,
            IWindowFunction windowFunction,
            int transformLength)
        {
            if (!IsPowerOfTwo(transformLength))
            {
                throw new ArgumentException("Transform length must be a power of two", "transformLength");
            }
            if (transformProvider == null)
            {
                throw new ArgumentNullException("transformProvider", "Transform provider cannot be null");
            }
            if (windowFunction == null)
            {
                throw new ArgumentNullException("windowFunction", "Window function cannot be null");
            }

            this.transformProvider = transformProvider;
            this.window            = windowFunction.CalculateCoefficients(transformLength);
            this.transformLength   = transformLength;
            this.m = (int)Math.Log(transformLength, 2d);
        }
Beispiel #3
0
        public FourierTransform(
            IFastFourierTransformProvider transformProvider, 
            IWindowFunction windowFunction,
            int transformLength)
        {
            if (!IsPowerOfTwo(transformLength))
            {
                throw new ArgumentException("Transform length must be a power of two", "transformLength");
            }
            if (transformProvider == null)
            {
                throw new ArgumentNullException("transformProvider", "Transform provider cannot be null");
            }
            if (windowFunction == null)
            {
                throw new ArgumentNullException("windowFunction", "Window function cannot be null");
            }

            this.transformProvider = transformProvider;
            this.window = windowFunction.CalculateCoefficients(transformLength);
            this.transformLength = transformLength;
            this.m = (int)Math.Log(transformLength, 2d);
        }
        public void TestInitialise()
        {
            var ones = new float[100];
            for (int i = 0; i < 100; i++)
            {
                ones[i] = 1f;
            }

            transformProvider = Substitute.For<IFastFourierTransformProvider>();
            windowFunction = Substitute.For<IWindowFunction>();
            windowFunction.CalculateCoefficients(Arg.Any<int>()).Returns(ones);

            target = new FourierTransform(transformProvider, windowFunction, 1);

            target.Format = new WaveFormat(44100, 1);
        }