Menu

Measuring distortion

2018-12-14
2018-12-24
  • Ivan Nikitin

    Ivan Nikitin - 2018-12-14

    Hello


    It sounds like complex chained GraphicEQ commands reduce sound quality. If I join the two commands into one, it sounds better.

    Is there a way to measure distortions caused by the processing?

    --
    Ivan Nikitin

     
    • Juha

      Juha - 2018-12-15

      To get the difference, you could try by making either a lossless file (WAV) or simultaenous stream of both and then reverse phase of the other source. In 1st case, bundled Benchmark -command lets you create needed WAV files where current config.txt is included and in the latter case, Virtual Audio Cable (as like Voicemeeter Banana) allows you route streams to a 3rd party (DAW, editor, etc.) software where you then be able to (record the streams and) reverse the phase of the other stream/file and finally render the difference to a lossless file needed for to closer look on some analyzing software.

       
      • Ivan Nikitin

        Ivan Nikitin - 2018-12-24

        Thank you for the reply!
        Is there any software to generate reference samples to test the equalizer? For example, if I need to check how good the LP filter is.

         
        • Juha

          Juha - 2018-12-24

          There are many ... Benchmark, as I mentioned already (disable all effects from config.txt to get clean sample) ... Audacity is free ... etc.

          BTW, (ATM) EqualizerAPO implements RBJ's Audio EQ textbook for its biquad LP filter so, you actually can run the LPF test in Octave/Matlab as well:

          pkg load signal
          clf;
          % Parameters
          fs = 44100;
          fc = 2000;
          Q  = 1/sqrt(2); % 1/sqrt(2) = 0.7071...
          
          % s-plane LPF prototype
          w0 = 2*pi*fc;
          Bproto = w0^2;
          Aproto = [1 w0/Q w0^2];
          A = tf(Bproto,Aproto);
          
          % z-plane LPF (RBJ Audio EQ cookbook)
          w0 = 2*pi*fc/fs;
          cw0 = cos(w0);
          sw0 = sin(w0);
          alpha = sw0/(2*Q);
          
          b0 = (1-cw0)/2;
          b1 = 1-cw0;
          b2 = (1-cw0)/2;
          a0 = 1+alpha;
          a1 = -2*cw0;
          a2 = 1-alpha;
          
          Brbj = [b2 b1 b0];
          Arbj = [a2 a1 a0];
          
          RBJ = tf(Brbj,Arbj,1/fs);
          
          %% Plot
          fs2 = fs/2;
          nf = logspace(0, 5, fs2);
          
          figure(1);
          [mag0, pha0] = bode(A,2*pi*nf);
          semilogx(nf, 20*log10(abs(mag0)), 'color', 'g', 'linewidth', 2.0, 'linestyle', '-');
          axis([20 fs2 -10 10]);
          hold on;
          % RBJ
          [mag, pha] = bode(RBJ,2*pi*nf);
          semilogx(nf, 20*log10(abs(mag)), 'color', 'k', 'linewidth', 1.0, 'linestyle', '--');
          % Phases
          semilogx(nf, pha0, 'color', 'g', 'linewidth', 2.0, 'linestyle', '-');
          semilogx(nf, -pha, 'color', 'k', 'linewidth', 1.0, 'linestyle', '--');
          legend('Prototype LPF', 'RBJ LPF', 'location', 'southwest');
          xlabel('Hz');ylabel('dB');
          grid on;
          

          Above code just plots the responses.
          You can easily add some code to run the filter for signal or audio file as well and then make your measurements with plots or numerical data. See the Octave documentation and google some examples.

          By making a custom IIR you can improve the filter(s) response(s)a bit but by the cost of CPU usage.

           
          👍
          1

          Last edit: Juha 2018-12-25

Log in to post a comment.

MongoDB Logo MongoDB