resolving clipping audio issues
Subtracting a constant value from all of your samples will just cause all the clipping to happen at -1, and will give you some nasty distortion. The proper way to remove clipping is to normalize the samples.

Keep track of the max value of s1 in your loop, then in a second loop divide all of of your points by the max value, i.e.

a = 0.5;
s1[0] = s[0];
max_s1 = 0;
mean = 0;

for (n = 1; n &lt; N; n++) {
    s1[n] = (s[n-1] * a) + s[n]
    if (abs(s1[n]) &gt; max_s1) {
        max_s1 = abs(s1[n]);
    }
    mean += s1[n];
}
mean /= N;
max_s1 -= mean;
for (n = 0; n &lt; N; n++) {
    s1[n] = (s1[n] - mean) / max_s1;
}


EDIT: For bonus points your can also subtract the mean from your filtered signal prior to doing the normalization. This will ensure you get maximum level without distortion from clipping.