]> git.sesse.net Git - nageru/blobdiff - mixer.cpp
Add a 150 Hz lo-cut filter in front of the compressor.
[nageru] / mixer.cpp
index d90359265b9cec2b722cbc5b141d9ffb1f943e8c..03cf99d3435969891ccc1961d7f71c1b479861a5 100644 (file)
--- a/mixer.cpp
+++ b/mixer.cpp
@@ -149,6 +149,8 @@ Mixer::Mixer(const QSurfaceFormat &format, unsigned num_cards)
 
        r128.init(2, OUTPUT_FREQUENCY);
        r128.integr_start();
+
+       locut.init(FILTER_HPF, 2);
 }
 
 Mixer::~Mixer()
@@ -538,6 +540,11 @@ void Mixer::process_audio_one_frame()
                }
        }
 
+       // Cut away everything under 150 Hz; we don't need it for voice,
+       // and it will reduce headroom and confuse the compressor.
+       // (In particular, any hums at 50 or 60 Hz should be dampened.)
+       locut.render(samples_out.data(), samples_out.size() / 2, 150.0 * 2.0 * M_PI / OUTPUT_FREQUENCY, 0.5f);
+
        // Apply a level compressor to get the general level right.
        // Basically, if it's over about -40 dBFS, we squeeze it down to that level
        // (or more precisely, near it, since we don't use infinite ratio),