/// <summary> /// /// </summary> public PitchShifter(Queue input, Queue temp1, Queue temp2, Queue output, int size, int overlap, double rate, int maxSkip) : base(input, output) { this.cap = new EllipticFilterDesigner(8, 0.99, 0.05).GetAnalogPrototype(); this.cd = new Coefficient[this.cap.Length]; for (int i = 0; i < this.cd.Length; ++i) { this.cd[i] = new Coefficient(); } this.peq = new ParametricEqualizer.Parameter[this.cap.Length]; for (int i = 0; i < this.peq.Length; ++i) { this.peq[i] = new ParametricEqualizer.Parameter(); } this.pipes = new Pipe[3]; this.fl = new ParametricEqualizer(this.peq); this.fr = new ParametricEqualizer(this.peq); this.ts = new TimeStretcher(input, output, size, overlap, 1.0 / rate, maxSkip); this.rt = new RateTransposer(input, output, rate); this.fp = new FilteredPipe(input, output, fl, fr); this.temp1 = temp1; this.temp2 = temp2; this.SetRate(rate); this.cp = new CascadePipe(this.pipes); }
/// <summary> /// /// </summary> public PitchShifter(Queue input, Queue temp1, Queue temp2, Queue output, int size, int overlap, double rate, int maxSkip) : base(input, output) { this.cap = new EllipticFilterDesigner(8, 0.99, 0.05).GetAnalogPrototype(); this.cd= new Coefficient[this.cap.Length]; for(int i=0; i<this.cd.Length; ++i) this.cd[i] = new Coefficient(); this.peq = new ParametricEqualizer.Parameter[this.cap.Length]; for(int i=0; i<this.peq.Length; ++i) this.peq[i] = new ParametricEqualizer.Parameter(); this.pipes = new Pipe[3]; this.fl = new ParametricEqualizer(this.peq); this.fr = new ParametricEqualizer(this.peq); this.ts = new TimeStretcher(input, output, size, overlap, 1.0/rate, maxSkip); this.rt = new RateTransposer(input, output, rate); this.fp = new FilteredPipe(input, output, fl, fr); this.temp1 = temp1; this.temp2 = temp2; this.SetRate(rate); this.cp = new CascadePipe(this.pipes); }
public static void ToPeqCoefficient(Coefficient[] digital, ParametricEqualizer.Parameter[] peq) { for(int i=0; i<digital.Length; ++i) { ToPeqCoefficient(digital[i], peq[i]); } }
public static void ToPeqCoefficient(Coefficient digital, ParametricEqualizer.Parameter peq) { double[] a = digital.a; double[] b = digital.b; peq.c = b[0] / a[0]; peq.a1 = -a[1] / a[0]; peq.a2 = -a[2] / a[0]; peq.b1 = b[1] / b[0]; peq.b2 = b[2] / b[0]; }