+
+ // filter forwards, then backwards (perfect phase filtering)
+ vector<float> filtered_samples, refiltered_samples;
+ filtered_samples.resize(len_samples);
+ refiltered_samples.resize(len_samples);
+
+ filter_init(M_PI * HPFILTER_FREQ / WAVE_FREQ);
+ for (int i = 0; i < len_samples; ++i) {
+ filtered_samples[i] = filter_update(samples[i]);
+ }
+ filter_init(M_PI * HPFILTER_FREQ / WAVE_FREQ);
+ for (int i = len_samples; i --> 0; ) {
+ refiltered_samples[i] = filter_update(filtered_samples[i]);
+ }
+
+ return refiltered_samples;