static IFilter GetFilter() { double Fl = Common.Normalize(5000); double Fh = Common.Normalize(15000); LowPassFir lpf = new LowPassFir(16, Fl); BandPassFir bpf = new BandPassFir(16, Fl, Fh); HighPassFir hpf = new HighPassFir(16, Fh); PeakingEqualizer peql = new PeakingEqualizer(Common.Normalize(900), 3, 1.5); PeakingEqualizer peqm = new PeakingEqualizer(Common.Normalize(8000), 5, 2); PeakingEqualizer peqh = new PeakingEqualizer(Common.Normalize(20000), 2, 4); Delay dl = new Delay(4); Delay dm = new Delay(8); Delay dh = new Delay(16); #if OUTPUT_COEF using(StreamWriter writer = new StreamWriter("coef.txt")) { Write(writer, "LPF", lpf); Write(writer, "BPF", bpf); Write(writer, "HPF", hpf); Write(writer, "PEQ L", peql); Write(writer, "PEQ M", peqm); Write(writer, "PEQ H", peqh); Write(writer, "DLY L", dl); Write(writer, "DLY M", dm); Write(writer, "DLY H", dh); } #endif IFilter low = new SerialConnector(new IFilter[]{lpf, peql, dl}); IFilter mid = new SerialConnector(new IFilter[]{bpf, peqm, dm}); IFilter hig = new SerialConnector(new IFilter[]{hpf, peqh, dh}); IFilter filter = new Mixer( new IFilter[]{low, mid, hig}, new Double[]{2, 1, 0.5}); return filter; }
static void Write(StreamWriter writer, string title, Delay f) { writer.Write("{0}\n{1}\n", title, f.Taps); }