Example #1
0
        public void BiquadXover2NdOrder()
        {
            var butter2Lp1000A = DspCoefficients.GetXoverSOS(1000, 2, FilterType.ButterworthLp, 48000).First().DspParams();
            var butter2Lp1000B = new[] { 0.003916126660547, 0.007832253321095, 0.003916126660547, 1.815341082704568, -0.831005589346758 };

            Assert.IsTrue(butter2Lp1000A.SequenceEqual(butter2Lp1000B, new DspParamComarer()));
        }
Example #2
0
        public void BiquadXover1StOrder()
        {
            var x = DspCoefficients.GetXoverSOS(1000, 1, FilterType.ButterworthLp, 48000).First().DspParams();
            var y = new[] { 0.061511768503622, 0.061511768503622, 0, 0.876976462992757, 0 };

            Assert.IsTrue(x.SequenceEqual(y, new DspParamComarer()));
        }
Example #3
0
        public void BesselH4Th()
        {
            var x = DspCoefficients.GetXoverSOS(384, 4, FilterType.BesselLp, 48000).Select(n => n.DspParams());
            var y =
                new[]
            {
                new[]
                {
                    0.000605188228776, 0.001210376457552, 0.000605188228776, 1.914182371441551,
                    -0.916603124356656
                },
                new[]
                {
                    0.000605188228776, 0.001210376457552, 0.000605188228776, 1.914182371441551,
                    -0.916603124356656
                },
            };

            var i = 0;

            foreach (var d in x)
            {
                Assert.IsTrue(d.SequenceEqual(y[i++], new DspParamComarer()));
            }
        }
Example #4
0
        public void LinkWitz4Th()
        {
            var x = DspCoefficients.GetXoverSOS(512, 4, FilterType.LinkWitzHp, 48000).Select(n => n.DspParams());
            var y =
                new[]
            {
                new[]
                {
                    0.953714080094688, -1.907428160189375, 0.953714080094688, 1.905284625122248,
                    -0.909571695256502
                },
                new[]
                {
                    0.953714080094688, -1.907428160189375, 0.953714080094688, 1.905284625122248,
                    -0.909571695256502
                },
            };

            var i = 0;

            foreach (var d in x)
            {
                Assert.IsTrue(d.SequenceEqual(y[i++], new DspParamComarer()), "failed on biquad " + (i - 1));
            }
        }
Example #5
0
        public void LinkWitz6Th()
        {
            var x = DspCoefficients.GetXoverSOS(384, 6, FilterType.LinkWitzLp, 48000).Select(n => n.DspParams());
            var y =
                new[]
            {
                new[]
                {
                    0.000601309320184, 0.001202618640367, 0.000601309320184, 1.901913563002136,
                    -0.904318800282870
                },
                new[]
                {
                    0.000616045308739, 0.001232090617477, 0.000616045308739, 1.948522813110796,
                    -0.950986994345750
                },

                new[]
                {
                    0.000616045308739, 0.001232090617477, 0.000616045308739, 1.948522813110796,
                    -0.950986994345750
                },
            };

            var i = 0;

            foreach (var d in x)
            {
                Assert.IsTrue(d.SequenceEqual(y[i++], new DspParamComarer()), "failed on biquad " + (i - 1));
            }
        }
Example #6
0
        public void Bessel2Nd()
        {
            var x = DspCoefficients.GetXoverSOS(10000, 2, FilterType.BesselHp, 48000).First().DspParams();
            var y =

                new[]
            {
                0.342719267599336, -0.685438535198671, 0.342719267599336, 0.281858695809837, -0.089018374587505
            };

            Assert.IsTrue(x.SequenceEqual(y, new DspParamComarer()));
        }
Example #7
0
        public void LinkWitz2Nd()
        {
            var x = DspCoefficients.GetXoverSOS(512, 2, FilterType.LinkWitzHp, 48000).First().DspParams();
            var y =

                new[]
            {
                0.936180987547197, -1.872361975094395, 0.936180987547197, 1.870257846804933, -0.874466103383856
            };

            Assert.IsTrue(x.SequenceEqual(y, new DspParamComarer()));
        }
Example #8
0
        public void SosXOver3RdOrder()
        {
            var butter3Lp1000A = DspCoefficients.GetXoverSOS(1000, 3, FilterType.ButterworthLp, 48000).Select(n => n.DspParams());
            var butter3Lp1000B =
                new[]
            {
                new [] { 0.061511768503622, 0.061511768503622, 0, 0.876976462992757, 0 },
                new [] { 0.004015505022858, 0.008031010045716, 0.004015505022858, 1.861408444532108, -0.877470464623539 }
            };

            var i = 0;

            foreach (var d in butter3Lp1000A)
            {
                Assert.IsTrue(d.SequenceEqual(butter3Lp1000B[i++], new DspParamComarer()));
            }
        }
Example #9
0
        public void BesselH3Rd()
        {
            var x = DspCoefficients.GetXoverSOS(10, 3, FilterType.BesselHp, 48000).Select(n => n.DspParams());
            var y =
                new[]
            {
                new[]
                {
                    0.999345929525232, -0.999345929525232, 0, 0.998691859050465, 0
                },
                new[]
                {
                    0.998867231486796, -1.997734462973593, 0.998867231486796, 1.997733607207339,
                    -0.997735318739846
                }
            };

            var i = 0;

            foreach (var d in x)
            {
                Assert.IsTrue(d.SequenceEqual(y[i++], new DspParamComarer()));
            }
        }
Example #10
0
 /// <summary>
 /// Sends a multi biquad passband filter
 /// there should be enough biquads assigned to this filter
 /// </summary>
 public override IEnumerable <PeqParam> GetParamData()
 {
     return(DspCoefficients.GetXoverSOS(PEQDataModel.Frequency, PEQDataModel.Order,
                                        PEQDataModel.FilterType, DspCoefficients.Fs).Select((source, index) =>
                                                                                            GetSosParamPackage(source, GetBiquad(index))));
 }