Go Back   Home > Forums > >
Home Forums Rules Articles diyAudio Store Blogs Gallery Wiki Register Donations FAQ Calendar Search Today's Posts Mark Forums Read

PC Based Computer music servers, crossovers, and equalization

IDEA: Linkwitz-Transform LADSPA plugin with lookahead boost control
IDEA: Linkwitz-Transform LADSPA plugin with lookahead boost control
Please consider donating to help us continue to serve you.

Ads on/off / Custom Title / More PMs / More album space / Advanced printing & mass image saving
Reply
 
Thread Tools Search this Thread
Old 9th April 2016, 07:27 PM   #1
CharlieLaub is online now CharlieLaub  United States
diyAudio Member
 
Join Date: Mar 2007
Location: Michigan
Default IDEA: Linkwitz-Transform LADSPA plugin with lookahead boost control

I wanted to start up a thread about another LADSPA plugin that I am thinking of writing. The plugin would implement a Linkwitz Transform, the type typically used to boost bass response of a woofer/subwoofer. In addition, it would incorporate a feature that will reduce the boost (the LF gain) dynamically in response to the signal if/when the output level is boosted to a high enough level to cause digital clipping. The gain reduction would be implemented with some amount of lookahead to smooth out and reduce the perceived effect of the boost reduction.

The concept is related to, but not exactly the same as, a clipper/limiter. It's very well suited to a boosted-bass application such as the LT or any kind of low-frequency boosting filter (e.g. 1st or 2nd order shelf filter). Instead of operating in the time domain, peak reduction is done in the frequency domain by dynamically adjusting the LT transfer function. The underlying assumption is that the high gain at low frequencies is primarily responsible for the high signal levels, so reducing the gain there will bring the signal back into an acceptable range. This is different from a limiter, because there is no guarantee that the signal will be maintained within a given threshold value. A hard limiter could be placed next in the signal chain if that behavior was desired, or perhaps limiting or wideband gain reduction could be written into the plugin as optional features.

Control action similar to this has existed in the past but implemented with analog circuits. In a sense the proposed plugin is a bit like a dynamic "loudness" control (but for the low bass only). A loudness control was a feature found on some preamps in the 1980s and 1990s (e.g. from Yamaha and others) and was based on the Fletcher-Munson equal-loudness curve. An analog implementation of boost-limiting for a closed-box subwoofer (but using a double integrator instead of the more flexible LT) was patented by Long and Wickersham and (I believe) used in Bag-End's ELF line (see: Method and Apparatus for Operating a Loudspeaker Below Resonance Frequency - US Patent 4,481,662). For details, see the paragraph in the lower half of column 5, on page 6 of the patent.

Using DSP, a lookahead buffer can make the onset of the gain reduction more gentle and make the effect more transparent sonically. Because it is operating in the frequency domain, the problems associated with limiting should (based on my prior SPICE modeling) be mostly eliminated, and adding a lookahead should make this even more so.

I don't recall seeing this kind of DSP processing tool anywhere before. If you know of one, especially firsthand, I would be interested to learn about how well it functions. In general, comments about my approach are very welcome!

Is there any interest in this kind of functionality for the DSP toolbox?
__________________
Visit my Audio Web Page <<--CLICK TO LEARN MORE-->> Get my LADSPA plugins

Last edited by CharlieLaub; 10th April 2016 at 04:01 PM. Reason: fixed error with patent reference
  Reply With Quote
Old 10th April 2016, 01:22 AM   #2
jplesset is offline jplesset  United States
diyAudio Member
 
Join Date: Jan 2013
Location: Oregon City, Oregon
Hi, Charlie...

Sounds like a worthwhile project, though not on my wish list (plenty of headroom). My wishlist includes a volume-based "loudness" compensation. Amount user-configurable. I often listen a low-levels, and some compensation would be wonderful....
  Reply With Quote
Old 10th April 2016, 05:04 AM   #3
CharlieLaub is online now CharlieLaub  United States
diyAudio Member
 
Join Date: Mar 2007
Location: Michigan
Quote:
Originally Posted by jplesset View Post
Hi, Charlie...

Sounds like a worthwhile project, though not on my wish list (plenty of headroom). My wishlist includes a volume-based "loudness" compensation. Amount user-configurable. I often listen a low-levels, and some compensation would be wonderful....
In general, time-varying of an IIR filter can have some serious pitfalls. Because a filter has a phase response as well as amplitude response, varying one of the filter parameters (like corner frequency) too quickly can cause audible intermodulation distortion because the phase behavior of the filter (and therefore it's delay curve) is also being modulated. This is one problem that I need to keep in mind for the plugin I describe above. It isn't such a huge problem if the signal is strongly bandlimited like we have for a subwoofer application, especially if followed by fixed lowpass filters. But if you wanted to do dynamic IIR filtering on the full audio spectrum you have to do some "tricks" like multiband processing in order to keep the artifacts sufficiently suppressed.

So, with that in mind... if you envisioned a plugin that was varying the amount of "loudness control" automatically as a function of signal level with a time response on the order of 100msec or less, then you are probably out of luck. If, on the other hand, you want something with a fixed amount of contour for each "loudness" setting then this is feasible. You could study the curves in this Yamaha manual excerpt:
An externally hosted image should be here but it no longer works. Please upload images instead of linking to them to prevent this.

and come up with several sets of LADSPA filters that approximate each curve and then manually implement them (all together in an ecp file, in the input signal path) and switch between sets of filters when you want to change your master volume level.


.
__________________
Visit my Audio Web Page <<--CLICK TO LEARN MORE-->> Get my LADSPA plugins
  Reply With Quote
Old 10th April 2016, 04:33 PM   #4
jplesset is offline jplesset  United States
diyAudio Member
 
Join Date: Jan 2013
Location: Oregon City, Oregon
Actually, I was thinking more of a longer time constant filter, something on the order of seconds. I don't really want it adjusting from program dynamic range, but more for my listening level. I suspect that would be much more complex.

That's the one thing I miss from having a knob to turn.... back when I had a pre-amp in circuit.
  Reply With Quote
Old 10th April 2016, 04:43 PM   #5
CharlieLaub is online now CharlieLaub  United States
diyAudio Member
 
Join Date: Mar 2007
Location: Michigan
Quote:
Originally Posted by jplesset View Post
Actually, I was thinking more of a longer time constant filter, something on the order of seconds. I don't really want it adjusting from program dynamic range, but more for my listening level. I suspect that would be much more complex.

That's the one thing I miss from having a knob to turn.... back when I had a pre-amp in circuit.
If you want to drive an automatic adjustment of the state of the filter(s) that make up the "loudness" curve, you can do it slowly (e.g. over seconds). So, yes, that's possible.

Not sure if you are aware of it, but you can use MIDI control to change LADSPA filter parameters in ecasound. You might be able to do it that way instead of in code. It's not clear to me how this works internally, in the filter, however...
__________________
Visit my Audio Web Page <<--CLICK TO LEARN MORE-->> Get my LADSPA plugins
  Reply With Quote
Old 10th April 2016, 05:00 PM   #6
CharlieLaub is online now CharlieLaub  United States
diyAudio Member
 
Join Date: Mar 2007
Location: Michigan
I've done a little reading and a brief lit search (via whatever I could find online). There are several ways that one can try to implement a time-varying filter, but some of these can lead to instability problems (or can't guarantee that there won't be instability). There is some good background reading on this topic here in section 3.5.4: "Transient Elimination Methods for Time-Varying Recursive Filters":
http://users.spa.aalto.fi/vpv/public...transients.pdf

It looks like the safest approach is to calculate multiple LTI filters in parallel and then cross-fade between them. I know that the LT changes both magnitude AND phase. Perhaps I could simply calculate the output of the fully LT'd signal, and another signal that has no amplitude change but has the phase change of the full LT (via an allpass). I might then be able to crossfade between them (e.g. like an analog mixer would) without artifacts or distortion. I will think about this approach a little more and do some modeling of the signals to see if I think this can really work.

Another similar approach is to crossfade between LT outputs from LT filters that have only slightly different amounts of boost, however, I would need to continually calculate quite a number of these at the same time and then crossfade between them. Because the phase of each would be slightly different this approach may not work that well. Again, modeling will help me figure out if this could work.

As far as how to modulate the boost reduction, I will come up with some kind of modulation curve based on where and when the signal level is too high. This curve will smoothly vary in time, meaning that the boost adjustments will be continuous on a sample-to-sample basis. This is why crossfading will be used, since I can continuously mix filter outputs without a problem.
__________________
Visit my Audio Web Page <<--CLICK TO LEARN MORE-->> Get my LADSPA plugins
  Reply With Quote
Old 12th April 2016, 09:54 PM   #7
DarpMalone is offline DarpMalone  Canada
diyAudio Member
 
DarpMalone's Avatar
 
Join Date: Sep 2008
Location: Toronto
IDEA: Linkwitz-Transform LADSPA plugin with lookahead boost control
Sounds very cool. Any idea how this would impact overall latency?
  Reply With Quote
Old 12th April 2016, 11:00 PM   #8
CharlieLaub is online now CharlieLaub  United States
diyAudio Member
 
Join Date: Mar 2007
Location: Michigan
Quote:
Originally Posted by DarpMalone View Post
Sounds very cool. Any idea how this would impact overall latency?
Let me answer by describing how I will (at least at first) try to create this thing. If this is TL/DR for you, just skip to the end of the next to last paragraph. Geeks like me are welcome to read on for the gory details...

The LT can be thought of as a special form of a second order shelf filter. When you use it to extend the response of a woofer/subwoofer, the LT is boosting the signal by 12dB per octave of bass extension. The amount of extension, and therefore boost, is chosen by the user during the design process. Usually you want to only use as much boost as you have excursion capability when using the amp's power capability. Much more than that and you can cause the driver cone to be pushed too far, possibly causing the voice coil former to hit the top or bottom plate of the motor and at least increasing distortion a lot.

If the playback level is lower, however, there is some potential untapped low frequency output capability in the amp and driver that you are not using. How about increasing the boost when the playback level is low (increasing the bass extension) and then when the playback level is high, reducing the amount of bass extension as needed to prevent the over-excursion problems that would otherwise occur.

The same idea can be used to prevent the bass boost from causing the digital level to exceed 0dB. Above this, digital clipping will occur and this sounds very bad indeed. So with a DSP system there is both the limit of the digital to analog conversion process and the driver's mechanical limits to think about.

So how to do this boost limiting?
It turns out that tweaking the filter parameters in the digital domain can lead to audible problems. Digital IIR filters don't like it when you suddenly change the filter transfer function parameters. Although I don't have practical experience with this, most every literature reference to it seems to point to bad things, and its even possible to put the filter output into permanent instability.

Instead what I plan to do it calculate multiple instances of the LT - one with the user desired bass extension level and then another each X Hz lower in bass extension and Y dB less in boost until the "no extension / no boost" level is reached. The output will be mixed between these various levels of bass extension depending on the signal level so that the output from the plugin never exceeds the 0dB digital level.

It would be possible to look at the signal sample by sample and whichever is the highest amount of boost that still does not exceed the 0dB level to choose it as the output. This might work OK, but there might be audible noises of some kind from the switching between the possible outputs. This is because the phase at the lowest frequencies is slightly different for each output, so at each changeover the position in time at which the low frequency signal is being passed through is abruptly changes. Also, there will be an instantaneous change in gain, which may generate new high frequency signals via modulation. I feel that it would be better to cross over between the possible output a little more gently and smoothly. This is where the latency comes in.

Varying the boost reduction, but not too quickly:
So, the lookahead buffer will be used to look at the signal and determine some kind of envelope with which the boost level will be modulated. This might be done by using something like a moving average and/or some kind of smooth interpolation method within the lookahead window. The amount of "smoothness" can be controlled by the buffer length, longer buffers allowing a longer ramp up to more boost reduction and a slower crossover between outputs. This should preserve the quality of the audio as much as possible. How long should this buffer be? Well, there is likely a heuristic that is something like "half of the period of the lowest frequency of the system". Let's say the lowest frequency will be 10Hz. The period of 10Hz is 100 milliseconds and half of that is 50 milliseconds. Using the heuristic, this is a ballpark minimum amount of latency that one might require.

It's useful to note that the other channels must be delayed by this amount of latency so that everything is played back in time. I already published a LADSPA delay plugin (called mTAP) which can be used for that purpose.
__________________
Visit my Audio Web Page <<--CLICK TO LEARN MORE-->> Get my LADSPA plugins

Last edited by CharlieLaub; 12th April 2016 at 11:03 PM.
  Reply With Quote
Old 13th April 2016, 12:22 AM   #9
DarpMalone is offline DarpMalone  Canada
diyAudio Member
 
DarpMalone's Avatar
 
Join Date: Sep 2008
Location: Toronto
IDEA: Linkwitz-Transform LADSPA plugin with lookahead boost control
This could be a nice solution for a small format, sealed high excursion subwoofer... I was planning to use EQ and high-threshold compression on the subwoofer outputs to keep the driver under control but it would be cool to see how Linkwitz-Transform plug-in would compare.

I'm patiently waiting for this 7.1 HDMI audio extractor that I recently ordered on eBay so that I can experiment with Pi as a multi-channel DSP/Crossover using LADSPA plug-ins. (Hoping the HDMI boards sound alright).
  Reply With Quote
Old 13th April 2016, 02:24 AM   #10
CharlieLaub is online now CharlieLaub  United States
diyAudio Member
 
Join Date: Mar 2007
Location: Michigan
One interesting and potentially new use for a plugin designed along the lines of what I described in post #8 is this:
  • The apparent Thiele-Small parameters are excursion dependent, sometimes strongly so.
  • This means that the response shape, and therefore the LT boost curve, should really be different as a function of excursion.
  • Although excursion is not directly measured, it could be inferred from the signal or at least an approximation
  • Instead of using the same Thiele Small parameters for correcting the low frequency behavior, a set of different LT boost curves can take the changing TS parameters into account to more accurately achieve the desired "extended response"

This would be a little more difficult to code. Somehow the changing nature of the boost curve would need to be passed as parameters. Alternately this info could be put directly into the code before compiling the plugin. This would mean that the plugin would be matched to a particular driver and box combo, however, it could easily be recompiled to change it to work with a different system.

The fact that the TS parameters change and the LT is not all that accurave when lots of boost is applied is known and has been mentioned by SL himself. So this solution could be interesting, but I am getting a little ahead of myself at this point.
__________________
Visit my Audio Web Page <<--CLICK TO LEARN MORE-->> Get my LADSPA plugins

Last edited by CharlieLaub; 13th April 2016 at 02:26 AM.
  Reply With Quote

Reply


IDEA: Linkwitz-Transform LADSPA plugin with lookahead boost controlHide this!Advertise here!
Thread Tools Search this Thread
Search this Thread:

Advanced Search

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is On
HTML code is Off

Forum Jump

Similar Threads
Thread Thread Starter Forum Replies Last Post
LADSPA plugin programming for Linux audio crossovers CharlieLaub PC Based 476 14th June 2018 08:38 AM
Linkwitz Transform? rich31td Subwoofers 6 25th June 2012 04:47 PM
Will a Linkwitz transform...transform the driver? AllenB Subwoofers 20 17th May 2010 11:24 PM
linkwitz transform peace brainerd Subwoofers 4 31st January 2006 02:13 AM
Linkwitz Transform ding Multi-Way 10 11th July 2004 10:55 PM


New To Site? Need Help?

All times are GMT. The time now is 01:23 AM.


Search Engine Optimisation provided by DragonByte SEO (Pro) - vBulletin Mods & Addons Copyright © 2019 DragonByte Technologies Ltd.
Resources saved on this page: MySQL 15.00%
vBulletin Optimisation provided by vB Optimise (Pro) - vBulletin Mods & Addons Copyright © 2019 DragonByte Technologies Ltd.
Copyright ©1999-2019 diyAudio
Wiki