SynthMaker

Envelope filtering

Archive · 2012 4 old posts

From the original SynthMaker forum (2004–2014), with its members’ names and dates.

nmakinen ·

Hello,

I tried searching for a nice (moving average?) filter for smoothing an envelope, but couldn't find any. Since I can't code, I made a solution in SM which basically calculates the average of 9 consecutive samples at a time. It worked out pretty well when using the right values, because it turns a square wave into a near-perfect sine wave. But if you do it this way, it's probably quite CPU-costly, and if you want to do the same calculation with 200 samples, there's a lot of dirty work to do.

Is there a (coded) solution for this?

I found this code here on the forum, but it only makes the beginning of the envelope smooth and leaves the end sharp (why does this happen?). Look at the picture below to see what I mean. Doesn't look like a sine wave to me..

streamin in; streamin f; streamout out; out=out*(1-f)+in*f;

martinvicanek ·

Your code example is a first order lowpass, sometimes referred to as leaky integrator. It will provide some basic smoothening. You may play with the f parameter (which is related to the cutoff frequency or amount of smoothening), however you will always get those kinks where there were discontinuities in the original signal. If you want it smoother try biquad lowpass filters or simply use two or more first order lowpasses in series. There is also a running average module in SM however it will not turn a square wave into a sinus (triangle at best).

nmakinen ·

Thanks. I've tried some biquad lowpass filters (like the ones that come with SM), but when using low cutoff frequency, they haven't kept the volume right. I'm using an AHR envelope follower and have set the hold time long enough, so the filter has plenty of time to make the output signal reach the maximum volume, but it still doesn't match the maximum volume of the original signal. This problem doesn't occur with higher cutoff frequencies.

This would be essential for my purpose, because I'm making a brickwall limiter. The maximum peak level of the filtered envelope signal should be equal to the max level of the non-filtered one. If you know a solution for this, please let me know!

- nmakinen

nmakinen ·

The running average module seems very useful for similar purposes, but when the interval time is changed, the overall volume of the module gets louder than it should be. I want the interval time to be linked to a knob, so this shouldn't happen. Any ideas?

Wrote something here? To have a post removed or your name hidden, write to [email protected].

Before your first post

A few rules keep this a friendly place. You agree to them once.

Shown next to what you post, here and in the app. It doesn’t have to be your real name: 3–24 lower-case letters, digits or _ (capitals become lower case, spaces become _).

    Then your post goes up straight away.

    Delete this reply?

    Open it in SynthMaker?

    It goes on the track you’re editing there, in place of that track’s sound, and into My sounds. Your other tracks stay as they are.

    Want to keep that track’s sound? Start a new song in SynthMaker first (Song › New song), then open this.

    Report this reply?

    Only the developer reads reports. The person isn’t told who reported them.

    What’s wrong with it?

    Block this person?

    You won’t see their posts and replies here any more. They aren’t told, and you can unblock them at any time.

    People you’ve blocked

    Their posts and replies are hidden from you. Unblock someone to see them again.

    The community rules

    A few rules keep this a friendly place. Everyone agrees to them once, before their first post.