LMMS / lmms

Cross-platform music production software
https://lmms.io
GNU General Public License v2.0
7.81k stars 986 forks source link

Incorrect LADSPA_HINT_DEFAULT_LOW/HIGH values for Glame Plugins #334

Closed tresf closed 10 years ago

tresf commented 10 years ago

Most LMMS lowpass filters default to 441Hz, which I find to be an appropriate starting value, except Glame.

image

After investigating further it seems both Glame and Glame Butterworth filters default to a value of 4.41 Hz, which is an inaudible frequency. The effect of this is Glame LPFs mute the track by default, which is rarely desired. (In contrast, the HPFs simply do virtually nothing which is also rarely desired.).

This is either a bug in ladspa_manager.cpp's calculation of HIGH and LOW for these plugins or it is a bug in how the Glame LADSPA filters interpret the "HIGH" and "LOW" values. I'm not sure. The math is fairly easy to follow in ladspa_manager.cpp: image

From the code, it seems HIGH and LOW should pick values close to the thresholds, but this obviously isn't working for these plugins and possibly others.

Plugin Files Affected

/plugins/ladspa_effect/swh/butterworth_1902.c
/plugins/ladspa_effect/swh/highpass_iir_1890.c
/plugins/ladspa_effect/swh/lowpass_iir_1891.c

Example: (lowpass_ir_1891.c shown) image

A temporary patch is to handle this with LADSPA_HINT_DEFAULT_440 which is force a frequency close to 440Hz, which is orchestral A and arguable better than nothing, but unfortunately there does not exist a constant frequency for the higher spectrum (i.e. 4,000Hz/4Khz) so to use this 440 default to filter higher frequencies is not necessarily practical and arguably less functional then allowing ladspa_manager to do the calculation (once fixed of course).

-Tres

tobydox commented 10 years ago

Thanks for investigating this tricky issue!

tresf commented 10 years ago

Thanks for the patch. Wow that was quick. :)