Today I tried implementing my own simple low-pass filter using the pseudocode from Wikipedia as a starting point. Specifically, this code:
for i from 1 to n y[i] := y[i-1] + α * (x[i] - y[i-1])
Which can also be written as:
for each sample: filtered_sample = previous_filtered_sample + α * (input_sample - previous_filtered_sample)
I've implemented a quick and dirty version here, using Floatbeat.
When decreasing α (the smoothing factor of the filter, in other words: we are decreasing the cutoff frequency of the filter), the resulting signal gets softer and softer. This is of course not strange since we are losing energy when removing frequencies.
However, when applying a filter and doing a filter sweep in my DAW, the amplitude keeps constant: It seems that the amplitude gets re-scaled to offset this problem.
So, my question: How do I know with what value to multiply my filtered signal to give it the same amplitude it had before the filter?