Pre and Post Effin Ringing and shit like that

Discussion in 'Blind Testing and Psychoacoustics' started by ultrabike, Aug 17, 2016.

  1. Hrodulf

    Hrodulf Prohibited from acting as an MOT until year 2050

    Pyrate
    Joined:
    Sep 28, 2015
    Likes Received:
    4,382
    Trophy Points:
    113
    Ah, good to know! So, basically if you're playing back a file with two distinct transients, even if the second one is seconds apart there shouldn't be any pre ringing?
     
  2. ultrabike

    ultrabike Measurbator - Admin

    Staff Member Pyrate MZR
    Joined:
    Sep 25, 2015
    Likes Received:
    8,989
    Trophy Points:
    113
    Location:
    Irvine CA
    Yup.

    To test this is what I did:

    1) Generated a "Risset Drum" signal in Audacity (I moved settings around to get something I sort of liked).
    2) Loaded the stereo signal in Octave (don't have Matlab)
    3) Filtered with a linear and a minimum phase filter.
    4) Saw results and also saved results and listened.

    Here is the Octave code:

    Code:
    % Stereo Drum signal generated in Audacity
    [y, fs, bits] = wavread('Drum.wav');
    
    % Filters
    b = remez(700, [0 0.49 0.51 1], [1 1 0 0]).';
    [dummy, bm] = rceps(b);
    
    % Pass audio signal through filters
    z = filter(b, 1, y);
    zm = filter(bm, 1, y);
    
    % Find delay sample indexes (approx for min phase)
    d = find(max(b) == b);
    dm = find(max(bm) == bm);
    
    % Plot transients
    h1 = figure;
    subplot(2,1,1);
    plot(z(1:d,1));
    axis tight;
    grid on;
    title('transients linear phase');
    subplot(2,1,2);
    plot(zm(1:dm,1));
    axis tight;
    grid on;
    title('transients minimum phase');
    
    % Plot outputs w/o transients
    h2 = figure;
    subplot(2,1,1);
    plot(y(:,1));
    hold on;
    plot(z(d:end,1), 'r');
    plot(zm(dm:end,1), 'k');
    grid on;
    axis tight;
    title('outputs w/o transients (full)');
    legend('original','linear phase','min phase');
    subplot(2,1,2)
    plot(y(1:10,1), 'o');
    hold on;
    plot(z(d:d+9,1), 'rx');
    plot(zm(dm:dm+9,1), 'k+');
    grid on;
    axis tight;
    title('outputs w/o transients (zoom)');
    legend('original','linear phase','min phase');
    
    % Plot filters
    h3 = figure;
    plot(b);
    hold on;
    plot(bm,'r');
    grid on;
    axis tight;
    xlabel('samples');
    ylabel('magnitude');
    title('filter impulse response');
    legend('linear phase', 'min phase');
    
    % Save processed signals
    wavwrite(z, fs, bits, 'Drums_linear.wav');
    wavwrite(zm, fs, bits, 'Drums_min.wav');
    
    Here are some of the results (Octave sucks at saving things in JPG format)

    Filters:
    filters.jpg

    Transients (first few samples):
    transients.jpg

    Filtered output vs original signal after the transients (EDIT: well, what do you know! Octave did not choke while saving this file this time around!):
    transients_2.jpg

    Note the linear phase filter is right on top of the original, while the min phase is a bit off. This may be due to the fact that the minimum phase filter's group delay may not be exactly an integer, and due to some phase distortion which in the lows may not be too bad. The linear phase would be optimal in all respects after the transients. The linear phase would be right on top of the original. The minimum phase will exhibit a larger error.

    There is no "pre-ringing" through out the playback after the delay line of the filter is about half way filled. Which is when the transients die out. "Pre-ringing" issues are IMO a bunch of BS. It is possible that the files will sound different (min phase vs. linear phase), but that may be because the min phase one introduces some distortion in the phase relatively speaking, not the other way around.

    There are other parameters in the design of the FIR filter: stop band rejection, pass band and stop band ripple, pass band flatness, corner frequencies, filter length, filter type, and so on. Those can also affect performance, and they do come in linear and equivalent min phase version. I suggest to pick linear phase if some latency is not an issue.

    Here are the resulting files (wav format):

    Original:
    https://drive.google.com/open?id=0BzGhKu7Sq7bCZ3JTVzhXUHJ5UFU

    Linear Phase filter processed:
    https://drive.google.com/open?id=0BzGhKu7Sq7bCWlRwUlU1YWtNblk

    Minimum Phase filter processed:
    https://drive.google.com/open?id=0BzGhKu7Sq7bCdmRBQ1VhRVlJVG8
     
    Last edited: Feb 19, 2017
  3. Vorlon

    Vorlon self-important, pompous ass

    Pyrate Banned
    Joined:
    Jan 3, 2017
    Likes Received:
    401
    Trophy Points:
    63
    Location:
    Finland
    Your findings perfectly echo my subjective experience with various DACs that have a minimum phase filter option (such as Ayre QB-9 USB and Audiolab M-DAC). Never understood the appeal at all. Just sounds smeared and "off" to me along with a reduction in treble presence/detail.

    The Ayre DAC actually even has a listen vs. measure DIP switch filter selection, but the one me and my friend consistently thought sounded better (or more specifically did not sound broken) was the linear phase "measure" option... It wasn´t even something you had to particularly listen for, it just felt obvious to both of us.

    At the time that experience quickly made me discard (it was a weekend loaner from a store) that DAC as an option; no point in going Ayre if you disagree with one of their fundamental engineering choices.
     
  4. Hrodulf

    Hrodulf Prohibited from acting as an MOT until year 2050

    Pyrate
    Joined:
    Sep 28, 2015
    Likes Received:
    4,382
    Trophy Points:
    113
    Here's a good video on filtering differences.

     
  5. ultrabike

    ultrabike Measurbator - Admin

    Staff Member Pyrate MZR
    Joined:
    Sep 25, 2015
    Likes Received:
    8,989
    Trophy Points:
    113
    Location:
    Irvine CA
    @Hrodulf, based on what I know about filters, that video makes no sense.

    Reverb is not a transient, or even remotely alike. Reverb is effectively a two or more tap FIR filter with the taps separated possibly by a few hundred ms to a few seconds and not much in-between. Sort of like echo, or transmission line reflections. A transient is related to the initial conditions of a filter (analog or digital). Such effects in FIRs COMPLETELY die out after the transient time which in most linear phase filters is in the order of a few ms. And when they are gone, they are gone. They don't affect steady state of the filter during the whole playback.

    I mean, in IIRs and analog, transients never completely die out, though they virtually do as they tend to zero fast in many cases (think about differential equations and initial conditions). But in FIRs, again, they do completely die out.

    Possible they screwed up their linear phase implementations. Which I think is actually hard to screw up.

    AFAIK, a minimum phase filter will always screw up the signal in the passband more than a linear phase equivalent.
     
    Last edited: Feb 23, 2017
  6. ultrabike

    ultrabike Measurbator - Admin

    Staff Member Pyrate MZR
    Joined:
    Sep 25, 2015
    Likes Received:
    8,989
    Trophy Points:
    113
    Location:
    Irvine CA
    OK, I modified the code from 700 taps to 400 taps, because Octave did not like 700 taps today, and downloaded some percussion recording in FLAC from the web. While Octave is better than nothing, it truly sucks ballz relative to Matlab. Don't get your hopes too high with Python either. One does get what one pays for.

    I also increased the BW of the filters to allow as much as possible and filtered the signal since the new "Drums2.wav" is an actual recording with quite a bit of information in the treble (0 to 20.5065 kHz). Percussion instruments are NOT just bass, and there is some detail from the performers in the recording as well. To make things fair I pre-filtered the signal and called it "Drums2_ref.wav" and then applied linear and min phase filter again.

    Code:
    % Stereo Drum signal generated in Audacity
    [y, fs, bits] = wavread('Drums2.wav');
    
    % Filters
    b = remez(400, [0 0.93 0.95 1], [1 1 0 0]).';
    [dummy, bm] = rceps(b);
    
    % Bandlimit the signal to make things fair
    y = filter(b, 1, y);
    wavwrite(y, fs, bits, 'Drums2_ref.wav');
    
    % Pass audio signal through filters
    z = filter(b, 1, y);
    zm = filter(bm, 1, y);
    
    % Find delay sample indexes (approx for min phase)
    d = find(max(b) == b);
    dm = find(max(bm) == bm);
    
    % Plot transients
    h1 = figure;
    subplot(2,1,1);
    plot(z(1:d,1));
    axis tight;
    grid on;
    title('transients linear phase');
    subplot(2,1,2);
    plot(zm(1:dm,1));
    axis tight;
    grid on;
    title('transients minimum phase');
    
    % Plot outputs w/o transients
    offset = 200000;
    h2 = figure;
    subplot(2,1,1);
    plot(y(offset+1:offset+100,1));
    hold on;
    plot(z(offset+d:offset+100+d,1), 'r');
    plot(zm(offset+dm:offset+100+dm,1), 'k');
    grid on;
    axis tight;
    title('outputs w/o transients (full)');
    legend('original','linear phase','min phase');
    subplot(2,1,2)
    plot(y(offset+1:offset+100,1));
    hold on;
    plot(z(offset+d:offset+100+d,1), 'rx');
    plot(zm(offset+dm:offset+100+dm,1), 'k+');
    grid on;
    axis tight;
    title('outputs w/o transients (zoom)');
    legend('original','linear phase','min phase');
    
    % Plot filters
    h3 = figure;
    plot(b);
    hold on;
    plot(bm,'r');
    grid on;
    axis tight;
    xlabel('samples');
    ylabel('magnitude');
    title('filter impulse response');
    legend('linear phase', 'min phase');
    
    % Save processed signals
    wavwrite(z, fs, bits, 'Drums2_linear.wav');
    wavwrite(zm, fs, bits, 'Drums2_min.wav');
    
    Again, linear phase kicked minimum phase in the ass. Linear phase is right on top of the band limited original:

    (NOTE: the label says full, but the file is too large to fully visualize, so both are zoomed. Only difference is the line type used. The linear filter is blocking view of the original reference, so the +, and x help see the differences)

    Comparo.jpg

    I fail to hear this so-called-echo-reverb deal that video mumbles about. Take a listen (files are too large to listen directly from google, suggest to download and listen on your ref rig as these not compressed nor as shitty as the turd Audacity produced for me in the previous example):

    Drums original bandlimited reference

    https://drive.google.com/open?id=0BzGhKu7Sq7bCTG5PSkxjVUtWZVk

    Drums linear phase

    https://drive.google.com/open?id=0BzGhKu7Sq7bCOTZGUjJYU3d2ck0

    Drums minimum phase

    https://drive.google.com/open?id=0BzGhKu7Sq7bCcE1idXk2WlZ6Vjg

    It's not obvious from the results, but an equivalent minimum phase filter may also get you less stop band rejection, among other side effects.

    Again, IMO min phase only makes sense when one needs very little delay, perhaps when recording instruments or stuff like that. Or if the delay is so large that visuals stop correlating in time with audio, on say a movie or a game.
     
    Last edited: Feb 24, 2017
  7. Armaegis

    Armaegis Friend

    Pyrate BWC
    Joined:
    Sep 27, 2015
    Likes Received:
    8,163
    Trophy Points:
    113
    Location:
    Winnipeg
    (preface: computer being stupid; can't download those files)

    Buuut... does this math change when you apply the wonky amounts of EQ like they are in the video? Early on they even said that they "manufactured" the extreme example by applying the heavy and narrow EQs, and all the "time smearing" at those frequencies becomes worse the heavier the EQ processing.
     
  8. Abhishek Chowdhary

    Abhishek Chowdhary Friend

    Pyrate
    Joined:
    Sep 27, 2015
    Likes Received:
    423
    Trophy Points:
    63
    Location:
    India
    @ultrabike -
    Drums linear phase - Better air around instruments but everything sounds behind my head, bit artificial.
    Drums minimum phase - Comparatively muddy and low res.
    Drums original bandlimited reference - Aah, the microdynamics are back and proper instrument placement.

    What is actually linear phase and minimum phase? DAC filters ?
     
  9. ultrabike

    ultrabike Measurbator - Admin

    Staff Member Pyrate MZR
    Joined:
    Sep 25, 2015
    Likes Received:
    8,989
    Trophy Points:
    113
    Location:
    Irvine CA
    That is actually very puzzling to me. Usually when I think about parametric equalizers (like the one in the video) I think of bi-quads. Those are not FIRs but IIRs. You get a complex pair of poles and a complex pair of zeros per bi-quad. One moves those poles and zeros around and control both the location of a peak or null and it's q-factor by doing so.

    IIRs are not linear phase or necessarily minimum phase. IIRs are used because they are practical. They don't need too many taps to accomplish a narrow notch or peak. But the phase goes to hell.

    I guess I could take their word for it and call those parametric equalizers minimum phase or linear phase. But I honestly dunno what is going on in that implementation. IMO their arguments don't pass the stink test.

    linear phase means all frequencies are delayed in such a way that they coherently combine, and the filtered and original are the same in the passband with the difference being just an overall delay for everything. For a family of filters with the same frequency response magnitude, a linear phase filter may not yield the least amount of delay, but again, delays for all frequencies are a linear function of frequency and will coherently combine.

    In minimum phase you get the least amount of delay for all frequencies, but the delays of all frequencies are not the same, so they don't coherently combine. In many cases, this is not very disruptive. But it's not optimal. In some cases it is very disruptive.
     
    Last edited: Feb 24, 2017
  10. Armaegis

    Armaegis Friend

    Pyrate BWC
    Joined:
    Sep 27, 2015
    Likes Received:
    8,163
    Trophy Points:
    113
    Location:
    Winnipeg
    The specific math for all this is a bit outside my wheelhouse, but I suspect the operative phrase is the one I quoted above (maybe? I think? talking out my tuckus here).

    Perhaps their usage of the terminology is incorrect, but my interpretation of it is as such: "we did this thing to the FR (or some other parameter), this caused an undesirable time/phase/whatever shift at those particular frequencies, the nature of which is dependent on the type of mathematical buggery we used to accomplish the original thing"

    Which is why there are multiple types to choose from, so you can pick the lesser of evils.

    Maybe?
     
  11. ultrabike

    ultrabike Measurbator - Admin

    Staff Member Pyrate MZR
    Joined:
    Sep 25, 2015
    Likes Received:
    8,989
    Trophy Points:
    113
    Location:
    Irvine CA
    You can make a real linear phase filter that will do same or similar crazy things like multiple narrow and not so narrow, deep and no so deep notches/peaks in frequency response. As described in that video.

    The problem is not whether it can be done or not. The problem is that the FIR filter will be fairly large. Possible we end up with some round-off errors as well. Which also boils down to implementation. Making it tune-able is also another story. You don't have 2 complex pairs of poles and zeros. You got shit loads of them. And there is no unique linear phase filter with a large number of poles and zeros that will more or less accomplish what that video describes. There are a few well known optimizations techniques that can be used to arrive to one of many solutions: Parks-McClellan, LMS, Remez, BurritoCombo, and so forth.

    Hell, depending on how large the filter is, the computer may drown while doing the optimization numerically. Like Octave, where I had to reduce the number of taps or it would pull out the white flag and say "sorry sir, I'm fucked". You could do say a bunch of 400 or 300 tap linear phase filters, say five. And optimize each. Then cascade them the same way you would do the bi-quads. You end up with five time 400 taps equivalent filter. Say you want 10 notches per channel and you got 4000 taps per channel. Make it 32 bits or 64 bits and real time. As things start growing one may start looking into GPUs or something like that.

    To see what's going on, just do an FFT or something of the sort and look at the phase vs. frequency. If it's a line, life is good. If it's some random 2 year old drawing, shit might happen.

    The deal is, to do a parametric/tune-able large filter with linear phase FIR requires a shit load of horse power and some crazy programming the likes I've not seen yet. There maybe something out there, but I'm not aware of it. I think those guys are doing some IIRs (the usual) and who knows how they are arriving to "linear phase" or "minimum phase" implementations (or approximate implementations).
     
    Last edited: Feb 24, 2017
  12. Armaegis

    Armaegis Friend

    Pyrate BWC
    Joined:
    Sep 27, 2015
    Likes Received:
    8,163
    Trophy Points:
    113
    Location:
    Winnipeg
    Don't we have a filter thread around here somewhere? (I can't seem to find it...)
    We should move this stuff there to keep it organized.
     
  13. ultrabike

    ultrabike Measurbator - Admin

    Staff Member Pyrate MZR
    Joined:
    Sep 25, 2015
    Likes Received:
    8,989
    Trophy Points:
    113
    Location:
    Irvine CA
    I think we do. Gave this another thread though. If you can point me to it, I'll merge the threads.
     
  14. ultrabike

    ultrabike Measurbator - Admin

    Staff Member Pyrate MZR
    Joined:
    Sep 25, 2015
    Likes Received:
    8,989
    Trophy Points:
    113
    Location:
    Irvine CA
    BTW guys. Hope this sharing of what I think I know helps in understanding what available options there are. And why I feel this "pre-ringing" and minimum phase awesomeness maybe a bit misguided. There are good uses for minimum phase. But some of the things I read about it don't pass the stink test.

    Just letting you guys know where I'm coming from.
     
    Last edited: Feb 24, 2017
  15. Armaegis

    Armaegis Friend

    Pyrate BWC
    Joined:
    Sep 27, 2015
    Likes Received:
    8,163
    Trophy Points:
    113
    Location:
    Winnipeg
  16. Riotvan

    Riotvan Snoofer in the Woofer

    Pyrate
    Joined:
    Sep 27, 2015
    Likes Received:
    4,518
    Trophy Points:
    113
    Location:
    The Netherlands
    Great read @ultrabike!

    I've been messing with Equilibrium to tune my HD800's and it has very extensive settings for phase and filter types. It allows to set certain frequencies to minimum phase and others to linear. The designer recommends this for maximum transparency but to my ears fully linear sounds best when i give it enough horsepower. But i am only cutting frequencies though.

    I don't know what half the settings do though so i just use my ears.

    Btw Bob Katz also has some interesting comments over at IF, let me try and find the link.
    Edit: http://www.innerfidelity.com/conten...shootout-part-5-revisions#85iW0frUXTXz72JZ.97
     
  17. Armaegis

    Armaegis Friend

    Pyrate BWC
    Joined:
    Sep 27, 2015
    Likes Received:
    8,163
    Trophy Points:
    113
    Location:
    Winnipeg
    So perhaps the most likely explanation for this whole thing (from the video) is that they're just botching the terminology? Or perhaps the terms mean something else in a different context? (I'm reaching, I know)
     
  18. ultrabike

    ultrabike Measurbator - Admin

    Staff Member Pyrate MZR
    Joined:
    Sep 25, 2015
    Likes Received:
    8,989
    Trophy Points:
    113
    Location:
    Irvine CA
    Proly.

    (BTW, threads merged)

    @Hrodulf, thanks for bringing up the video. It is possible I'm wrong and they are right. But I'm giving it my hobby-best to show where I'm coming from.

    @Armaegis, you should also give the processed Drum2 files a shot. I've been told some folks actually did like them. They are not as shitty as the Drum original files I generated in Audacity previously.
     
    Last edited: Feb 24, 2017
  19. Hrodulf

    Hrodulf Prohibited from acting as an MOT until year 2050

    Pyrate
    Joined:
    Sep 28, 2015
    Likes Received:
    4,382
    Trophy Points:
    113
    So am I, Ultra. To be honest, I pinged my engineers about this and they were curious and spat back this video to me. If you're right, it'd change a lot how we communicate linear phase filter benefits.

    My standing is that there's still no free lunch with DSP. Closest I can get to free lunch is using minphase for bass and linphase for highs. Saves precious taps and bass hearing is pretty phase insensitive anyways.

    P.S. Not naming this thread "effin ringing" is a missed opportunity supreme.
     
    • Like Like x 1
    • heart heart x 1
    • List
    Last edited: Feb 24, 2017
  20. Armaegis

    Armaegis Friend

    Pyrate BWC
    Joined:
    Sep 27, 2015
    Likes Received:
    8,163
    Trophy Points:
    113
    Location:
    Winnipeg
    Maybe I'm just missing something... but so far I'm not seeing a discrepancy. The EQ's being done in the video are probably (relatively) simple and phase gets skewered. This is a necessary evil to keep the computing requirements low for latency or whatever because when you're mastering you've got a dozen processes going on everywhere.

    Is it not true that a simple/low taps/whatever EQ filter will skewer phase, and that different types of filters will skewer in different ways? Because that's how I'm reading the entire thing. I dunno... it makes "sense" in my head how this sort of thing can cause the "smearing" of sound by taking a complex sound and only shifting one portion of its frequency content over.
     

Share This Page