Exemple #1
0
        public static Tuple <double, double>[] Test4()
        {
            int size   = 1024 * 16;
            int pros   = 4;
            int Base   = 880 / 5;
            int Base2  = (int)(Base * (3.0 / 2.0));
            var ret    = new Tuple <double, double> [size / 4];
            var ToF    = new Complex[size];
            var Sign   = Generators.Bit(size / pros, size / Base, 100);
            var Sign1  = Generators.Bit(size / pros, size / Base / 2, 100 / 2);
            var Sign2  = Generators.Bit(size / pros, size / Base / 3, 100 / 3);
            var Sign3  = Generators.Bit(size / pros, size / Base / 4, 100 / 4);
            var Sign4  = Generators.Bit(size / pros, size / Base / 5, 100 / 5);
            var Sign5  = Generators.Bit(size / pros, size / Base / 6, 100 / 6);
            var Sign6  = Generators.Bit(size / pros, size / Base / 7, 100 / 7);
            var Sign7  = Generators.Bit(size / pros, size / Base / 8, 100 / 8);
            var Sign8  = Generators.Bit(size / pros, size / Base / 9, 100 / 9);
            var Sign9  = Generators.Bit(size / pros, size / Base / 10, 100 / 10);
            var Sign10 = Generators.Bit(size / pros, size / Base / 11, 100 / 11);
            var Sign11 = Generators.Bit(size / pros, size / Base / 12, 100 / 12);
            var Sign12 = Generators.Bit(size / pros, size / Base / 13, 100 / 13);

            var Signa   = Generators.Bit(size / pros, size / Base2, 100);
            var Signa1  = Generators.Bit(size / pros, size / Base2 / 2, 100 / 2);
            var Signa2  = Generators.Bit(size / pros, size / Base2 / 3, 100 / 3);
            var Signa3  = Generators.Bit(size / pros, size / Base2 / 4, 100 / 4);
            var Signa4  = Generators.Bit(size / pros, size / Base2 / 5, 100 / 5);
            var Signa5  = Generators.Bit(size / pros, size / Base2 / 6, 100 / 6);
            var Signa6  = Generators.Bit(size / pros, size / Base2 / 7, 100 / 7);
            var Signa7  = Generators.Bit(size / pros, size / Base2 / 8, 100 / 8);
            var Signa8  = Generators.Bit(size / pros, size / Base2 / 9, 100 / 9);
            var Signa9  = Generators.Bit(size / pros, size / Base2 / 10, 100 / 10);
            var Signa10 = Generators.Bit(size / pros, size / Base2 / 11, 100 / 11);
            var Signa11 = Generators.Bit(size / pros, size / Base2 / 12, 100 / 12);
            var Signa12 = Generators.Bit(size / pros, size / Base2 / 13, 100 / 13);

            int i = 0;

            for (i = 0; i < size / pros; i++)
            {
                ToF[i] = new Complex(Sign[i] + Sign1[i] + Sign2[i] + Sign3[i] + Sign4[i] + Sign5[i] + Sign6[i] + Sign7[i] + Sign8[i] + Sign9[i] + Sign10[i] + Sign11[i] + Sign12[i] +
                                     Signa[i] + Signa1[i] + Signa2[i] + Signa3[i] + Signa4[i] + Signa5[i] + Signa6[i] + Signa7[i] + Signa8[i] + Signa9[i] + Signa10[i] + Signa11[i] + Signa12[i], 0);
            }
            for (; i < size; i++)
            {
                ToF[i] = new Complex(0, 0);
            }

            ToF = FastFourierTransform.DecimationInTime(ToF, false);

            for (i = 0; i < size / 4; i++)
            {
                ret[i] = new Tuple <double, double>(i * 5, ToF[i].Magnitude);
            }

            return(ret);
        }
Exemple #2
0
        public static double[] Test3WTF()
        {
            int beatSize = 256;
            var sin      = Generators.Bit(beatSize, 8, 128);

            var convertSignal = new double[beatSize];

            for (int i = 0; i < beatSize; i++)
            {
                convertSignal[i] = 0;
                if (i + 0 < sin.Length)
                {
                    convertSignal[i] = sin[i + 0] * WindowFilters.Gausse(i, beatSize);
                }
            }

            var FFT = FastFourierTransform.DecimationInTime(sin.Select(x => { return(new Complex(x, 0)); }).ToArray(), false);

            for (var i = 0; i < FFT.Length; i++)
            {
                FFT[i] /= beatSize;
            }
            return(FFT.Select(x => { return x.Magnitude; }).ToArray());
        }