linear phase eq/crossover -- can it be done in SM?
Archive · 201026 old posts
From the original SynthMaker forum (2004–2014), with its members’ names and dates.
overhishead ·
have linear phase filters been made in SE before? what about linear phase eqs/crossovers?
i haven't seen much linear phase stuff around at all, its scarce. is this because the algorithms are guarded trade secrets or patented?
i would figure if it were easy to do, there would be a ton of SM/SE creations using linear phase filters, but nope...
thoughts?
infuzion ·
overhishead wrote: i haven't seen much linear phase stuff around at all, its scarce.
We're waiting for you to make one! Or you can look on the Image-Line forum.
Andrew J ·
Do a search on Remez exchange algorithm and maybe take a look here.
trogluddite ·
Part of the reason for the scarcity I think is that linear phase filters introduce latency. That makes them a little troublesome to use in synths etc. - but they're cool for channel/master FX. (there's a delay compensation primitive in the VST toolbox so that you can tell the host how much latency to adjust for)
infuzion ·
trogluddite wrote: Part of the reason for the scarcity I think is that linear phase filters introduce latency. That makes them a little troublesome to use in synths etc. - but they're cool for channel/master FX. (there's a delay compensation primitive in the VST toolbox so that you can tell the host how much latency to adjust for)
There is also a Time Machine primitive in the toolbox also to compensate for the synths.
tor ·
Troluditte you mentioned delay compensation primitive. It is x'ed out and I'm not able to load it. Any idea why?
Tzarls ·
You can only drag this primitive when being inside a module.
tor ·
Ah... I might have read that some time. Sorry I forgot and thank you for the reminder. 🙂
Dell ·
Hi.
Bear in mind Linear Phase Equalisers are not popular for two reasons.
1. They leave a ringing artefact in the high frequencies.
2. They don't sound appealing.
Sometimes perfect is not what the majority prefers.
Cheers!
JIftw ·
Dell wrote: They don't sound appealing.
Subjective.
Using linear phase EQ can be a good thing in the low frequencies. Phase warping on these frequencies leave audible artifacts: those can be used voluntarily to add a certain 'sloppy' character, or instead use linear phase EQs for a more 'transparent' processing. The only time I'd consider using non-linear minimum phase EQs in the low frequencies would be to undo previous processing (ahem: damage) done with similar filters (inverting the response), or when compensating for less-than-perfect loudspeaker LF roll-off. For other mastering purposes, linear phase is superior except when artifacts are desired.
Phase linear EQs' impulse response is symetric in pre and post-echo. With the pre-echo artifact being more audible than post-echo, non-linear, minimum-phase EQs are usually preferable in the high frequencies.
Dell ·
JIftw wrote:
Dell wrote: They don't sound appealing.
Subjective.
Using linear phase EQ can be a good thing in the low frequencies. Phase warping on these frequencies leave audible artifacts: those can be used voluntarily to add a certain 'sloppy' character, or instead use linear phase EQs for a more 'transparent' processing. The only time I'd consider using non-linear minimum phase EQs in the low frequencies would be to undo previous processing (ahem: damage) done with similar filters (inverting the response), or when compensating for less-than-perfect loudspeaker LF roll-off. For other mastering purposes, linear phase is superior except when artifacts are desired.
Phase linear EQs' impulse response is symetric in pre and post-echo. With the pre-echo artifact being more audible than post-echo, non-linear, minimum-phase EQs are usually preferable in the high frequencies.
Linear Phase Equalisers are terrible for bass.
"Sloppy" is based on choosing the wrong frequency which unfortunately many do not have good understanding of. The terms Tight, Sloppy, Punchy, Muddy, & Transparent, are used quite often yet, can never pinpoint the frequencies that are either enhancing or creating a problem.
Linear Phase Equalisers tries to go against the laws of physics. Which is why it offers it's own artefacts in the mix. There are also other issues that will apply between the mastered track using a Linear Phase Equaliser and our ears, which none of us have control over. Trying to having everything "in phase" is not possible.
Linear Phase equalisers were around for decades and never caught on for the majority do not like the sound they project.
Cheers!
MichaelBenjamin ·
really? what are the artifacts of linear phase filters? i always thought linear phase filtering is just more expensive and difficult to do than not caring about phase which in most cases doesnt really matter or is even desired and thats why it hasnt been used so much?
MegaHurtz ·
Dell wrote: Hi.
Bear in mind Linear Phase Equalisers are not popular for two reasons.
1. They leave a ringing artefact in the high frequencies.
2. They don't sound appealing.
Sometimes perfect is not what the majority prefers.
Cheers!
I agree it`s mixing up what looks good with what sounds good.
but not in a bad way I think liniar is a good starting point for understanding the basics.
JIftw ·
Dell, my use of the word 'sloppy' is not referring to boosting a certain frequency range over another. (I reckon that it is often erroneously used as such.) I used this word to refer to audible temporal artifacts, specifically the non-uniform delay (group delay) that varies with frequency inherent in non-linear EQs.
MichaelBenjamin wrote: really? what are the artifacts of linear phase filters? i always thought linear phase filtering is just more expensive and difficult to do than not caring about phase which in most cases doesnt really matter or is even desired and thats why it hasnt been used so much?
Filters exhibit a ringing artifact, hence are unable to perfectly deal with transients in the signal.
In the case of minimum phase filters, all ringing occurs after the transient. The temporal masking effect can make this ringing unnoticeable. On the other hand, the delay introduced by the filter varies with frequency, which above a certain threshold becomes an audible artifact. Also, phase warping in the low frequencies has a negative impact on spatial imaging.
Phase linear filters introduce a uniform time delay to all component frequencies in your sound. Linear filters exhibit ringing differently: Their ringing is partly before, and partly after the transient. Pre-ringing, or pre-echo as it is also called, is unnatural-sounding and more obvious than post-echo (again because post-echo is 'masked' by the transient that precedes it)
Each has advantages and disadvantages. What matters in the end is choosing what sounds good to one's ears, for a specific application. Choosing a filter topology and sticking to it, no matter the current knowledge on psychoacoustics, no matter the frequency range affected, no matter if the song has very sharp transients or not, makes no sense to me.
Take for example a high-quality EQ such as Refined Audiometrics Labs' PLParEQ, engineered to be 'transparent', minimizes rounding/truncation errors (using 64bit fp), uses upsampling, minimizes IMD, uses dither optimized for later processing, etc. But, ultimately, it lets you choose linear or minimum phase for each filter, allowing near-real-time comparison and choosing the best for each frequency range for a particular usage.
Dell ·
JIftw wrote: Dell, my use of the word 'sloppy' is not referring to boosting a certain frequency range over another. (I reckon that it is often erroneously used as such.) I used this word to refer to audible temporal artifacts, specifically the non-uniform delay (group delay) that varies with frequency inherent in non-linear EQs.
Fair enough.
As long as you know physics dictates the end result and, no amount tricks can override that.
Linear Equalisation is just another means of manipulating frequencies. One must always take into consideration the pitfalls when altering certain frequencies and, not assume Linear Equalisers will stop all means of phase cancellations on stereo tracks. 😉
Cheers!
Dell ·
MegaHurtz wrote:
Dell wrote: Hi.
Bear in mind Linear Phase Equalisers are not popular for two reasons.
1. They leave a ringing artefact in the high frequencies.
2. They don't sound appealing.
Sometimes perfect is not what the majority prefers.
Cheers!
I agree it`s mixing up what looks good with what sounds good.
but not in a bad way I think liniar is a good starting point for understanding the basics.
I believe there are some who prefer a perfect sound, whereas I aim for what sounds pleasing to my ears. 🙂
Cheers!
steph_tsf ·
Hi. It can be done and it has been done. Let's forget the FIR implementations and let's concentrate on IIR implementations. There may be an article about this in Elektor soon. First of all, let me remember what is a phase linear crossover. The phase linearity of a crossover must be assessed after summing the signals from the outputs (like they were followed by ideal speakers), then reading the phase of this reconstructed signal. If the phase is zero, that's perfect. If the phase is different from zero you need to plot it using a linear frequency axis. Then you can assess if the phase grows linearly with the frequency. Another way to see this is to plot the group delay in function of the frequency. The group delay must be essentially flat (say less than 20 µs variation) from DC to 15 kHz. No need to say, on top of the phase linearity criterion, what you also need is an essentially (+/- 0.5 dB ?) flat reconstructed amplitude. What also matters, is to ensure a minimal phase shift between the speakers when they blend together in the transition bands. This is essential for ensuring a nice polar pattern, especially when the emission points are not coincidents. In any case, the relative phase shift should not exceed 45 degree when the speakers do blend.
Here is the list of some notorious linear phase shift crossover structures.
The first order is inherently phase linear. But the selectivity is poor and the relative phase shift is 90 degree. Rule them out.
All N-order complementary crosovers (high = in - lowpass) (low = in - highpass) are inherently phase linear irrespectively of their order. The issue is that the complementary output is always asymptotically 1st order. And the more the order, the bigger the phase shift. Rule them out.
The 2nd order universal state variable filter is phase-linear but it delivers 3 outputs, making a 3-way crossover. The selectivity of the high pass and low pass is 2nd order. The "gap filler" mid starts with a 1st order positive slope and ends with a 1st order negative slope, so lacking selectivity. By lowering the Q of the filter, you extend the bandwith of the "gap filler" mid. The relative phase shifts are quite big. I would say "rule them out" but I like them because they purely reflect the essence of the 2nd order transfer functions. Okay, I know, music is not to be confused with transfer functions.
The N-order Lipshitz-Vanderkooy is THE preferred linear phase crossover arrangement. It is a substractive arrangement with a trick. The trick is to compensate the group delay of the lowpass filter, using a delay line, before making the substraction. The good surprise with the Lipshitz-Vanderkooy is that if you use a N-order Bessel lowpass, then the relative phase shifts are very small, less than 20 degree, irrespective of the order. A mild surprise is that the complementary filter is 2nd order using the Bessel low pass kernel. There is an optional second trick with the Lipshitz-Vanderkooy. If instead of a N-order Bessel lowpass, you use two cascaded 2nd order Butterworth lowpass as kernel, you get a 3rd order complementary filter. That's no so ridiculous. The tweeter now gets a decent protection against the low frequencies. The colateral damage is now the relative phase shift when the speakers do blend. It can attain 45 degree, but that's a very good figure compared with mainstream filters exhibiting 90 degree and more. - Okay okay, I know that the Linkwitz-Riley arrangement has zero relative phase shift beween the speakers when they blend, but such crossover is a plain disaster when considering phase linearity (360 degree error in total over the audio band, and absolutely not linear with frequency). There should be a ban on Linkwitz-Riley arrangements, now that everybody knows that the Lipshitz-Vanderkooy arrangements do preserve the phase.
I'd like to attach a few exemplative .osm files but before doing this I need to refer to Elektor.
Really, with the elements provided here, if you are technically minded, fluent with SynthMaker and accustomed to the RBJ cookbook about IIR biquads, it will take less than one hour.
By the way, I managed to use Winamp as audio source using VAC and ASIO4ALL. This way the Winamp sound gets into the Synthmaker ASIO In block. Synthmaker does the crossover job. Synthmaker outputs the 6 channels on the ASIO Out block. Those channels are taken by the ASIO4ALL wrapper, and sent to the regular Windows HD audio driver. My PC is thus outputting the 6 sound channels through the standard Realtek 6 channel HD audio chip (3 MiniJacks outs) of my motherboard.
It is also working with some inexpensive external USB multichannel audio cards. Still with ASIO4ALL on top of the driver of the USB multichannel audio card. I tested and succeeded with the TRUST SC-5500 (6 channels out) and the SWEEX SC016 (8 channels out).
By the way, can somebody explain the code of the "optimized" delay in SynthMaker ? This delay is a plain delay on a sample base without resampling, it seems to works better than the standard one, but the code is using tables in such a way that I don't understand the way the circular buffer and pointer get organized.
A last remark : I am currently designing an analog Lipshitz-Vanderkooy crossover, two-way operating at 3,400 Hz. For implementing the delay line, it is using allpass cells having a group delay of 8µs each roughly. Using 16 cascaded cells, I get a 137µs (group) delay with less 20µs variation from DC to 15 kHz. Anybody interested discussing the details of this, somewhere on the web, outside of SynthMaker ? I'm scared with those 16 opamps in the signal path of the tweeter. Will they add their own sonic signature ? What opamp model would you advise ?
Cheers,
Steph
trogluddite ·
The optimised delay looks more complex than it is - I'm assuming you mean the one written in assembly.
The single line of code mem[n]=variable or variable=mem[n] each translate into the big chunks of code using the non sse opcodes (fld, ftsp, shl etc.), together with a little code to explicitly round the index to an integer.
It's just because there isn't an sse opcode that allows indirect addressing (at least not in SM's assembler) - so the pointer calculation and memory read/write have to be done seperately for each of the four sse channels if the code is to remain compatible with mono4 and poly data types, with each pointer offset to allow for the interleaving of 4 channels of data in memory - in effect there are four simultaneous circular buffers in there, which is implicit in sse code, but has to be written explicitly when using non sse instructions.
steph_tsf ·
yes indeed, it is the one in assembler with the arrays. See attached .osm. In the maybe future Elektor article, I would like to name the creator of this efficient non-interpolated delay, why it was needed, how it got designed and who programmed it.
MegaHurtz ·
I beleive it was MyCo, But he dit another interpolated one..Maybe ittl be more worthwile.
trogluddite ·
P.S. If you haven't done so already, try connecting a text primitive to the string output on the code module inside the normal unoptimised version - that shows you the assembly output of SMs code compiler.
You'll see how SMs rndint function also compiles to a big four channel non-sse chunk of ASM - it has to do this for compatability with old CPUs - one of the big optimisations that MyCo put in place is the use of the sse2 cvtps2dq opcode to replace all of that clumsiness - it gives a great sense of just how much difference sse makes to the efficiency of parallel-stream DSP.
steph_tsf ·
Are we sure that connecting a text primitive to the string output on the code module always shows the assembly of SMs code compiler ? I'm asking this because I see no correlation between the source code and the assembly code. Let us take the optimized delay from MyCo. What is the reality behind the binary table labelled stage2/size 2=123 and the binary table labelled stage3/size3=158 ? On top of this, what are the meanings of the arrayindex=0 2.14,2.21,2.43,2.70 etc ... and the other lines, quite similar with memmax, index, mem, in, delay, out ?
infuzion ·
steph_tsf wrote: Are we sure that connecting a text primitive to the string output on the code module always shows the assembly of SMs code compiler ?
Yes.
I'm not too sure what issues you are talking about?
infuzion ·
steph_tsf wrote: Really, with the elements provided here, if you are technically minded, fluent with SynthMaker and accustomed to the RBJ cookbook about IIR biquads, it will take less than one hour.
Which can take a year to educate to that point. 😉
trogluddite ·
steph_tsf wrote: Are we sure that connecting a text primitive to the string output on the code module always shows the assembly of SMs code compiler ?
Yes, quite sure - you are not examining a code module.
I think we need to tune our terminology to the same wavelength...
Code = the one that looks a bit like C, or a list of algebra - e.g . "X = Y + rndint (10/Z); mem[index]=in"
Assembly = x86 and sse opcodes - e.g. "movaps xmm1,xmm0; addps xmm1,MyVar" (the xmm's are the clue here)
Machine Language = Lots of Hex numbers and cryptic parameter tables.
Maybe the terms are used differently in other contexts, I'm not quite sure - and it is often a source of confusion within the SM forum too, the terms assembly (or ASM) and code are often used a little loosely.
In your example you are seeing the machine language output of the assembly compiler - as you point out, the correlation is a tad tricky to see - and I have never seen explained what the parameters of the variable initialisations mean. Most likely they only have meaning to SMs developers for de-bugging purposes.
Using a text box to look at the assembly ( generated from a code module (e.g. the SM stock delay) can be a very useful tool for learning how assembly optimisations (e.g. MyCo's delay) work.
The machine language (hex) stuff, you can safely ignore - there are no 'algorithmic' tricks to be learned there, and you can't edit the hex/binary anyway.
Talking of machine language, it reminds me of a little geek joke...
There are only 10 different kinds of people...
...those who understand binary and those who don't.
TomC ·
trogluddite wrote: There are only 10 different kinds of people...
...those who understand binary and those who don't.
Wrote something here? To have a post removed or your name hidden, write to [email protected].