## Copyright (C) 2020 Jens ## ## This program is free software: you can redistribute it and/or modify it ## under the terms of the GNU General Public License as published by ## the Free Software Foundation, either version 3 of the License, or ## (at your option) any later version. ## ## This program is distributed in the hope that it will be useful, but ## WITHOUT ANY WARRANTY; without even the implied warranty of ## MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the ## GNU General Public License for more details. ## ## You should have received a copy of the GNU General Public License ## along with this program. If not, see ## . ## -*- texinfo -*- ## @deftypefn {} {@var{retval} =} eq_eval (@var{input1}, @var{input2}) ## ## @seealso{} ## @end deftypefn ## Author: Jens ## Created: 2020-06-22 function points = eq_eval (filename_in) P = 1 fs = 48000 [x, fs] = audioread(filename_in); filename_out = to_filename_out(filename_in, "out"); points = []; points = addPoint_peak_notch(points, 120, 60, 6, P); points = addPoint_peak_notch(points, 540, 480, 3, P); points = addPoint_peak_notch(points, 1250, 2500, -3, P); points = addPoint_peak_notch(points, 8000, 8000, 12, P); points = addPoint_peak_notch(points, 4000, 8000, -12, P); points = addPoint_peak_notch(points, 15625, 1000, -16, P); Np = length(points) y = x; for n = 1:Np, P = points(n).P; gain = 10^(points(n).g/20); [B,A] = boost3(fs, points(n).f, points(n).b, gain, P); for p=1:P, y = filter(B(p,:), A(p,:), y); end endfor audiowrite(filename_out, y./max(y), fs) % Audition for n = 1:Np, P = points(n).P; gain = 10^(points(n).g/20); [B,A] = boost3(fs, points(n).f, points(n).b, gain, P); for p=1:P, y = filter(B(p,:), A(p,:), x) - x; end suffix = sprintf("%d_%d_%d", points(n).f, points(n).b, points(n).g); filename_aud = to_filename_out(filename_in, suffix); audiowrite(filename_aud, y, fs) endfor endfunction function points_out = addPoint_peak_notch(points_in, fc_Hz, bw_Hz, gain_dB, P) p.f = fc_Hz; p.b = bw_Hz; p.g = gain_dB; p.P = P; p.type = "PeakNotch"; points_out = [points_in p]; endfunction