Slew limiter

Cle09's icon

How can I write a slew limiter in Max/Msp? I have read the tutorials for Max and they don't seem to help.

Hope that's OK to ask, thanks.

Randy Jones's icon

The answer depends on whether your want to operate on signals or messages.

Signals are easier-- you can just use a lowpass filter. Onepole~ is very useful here.

With messages (probably floating point numbers), you have a bunch of different options. The easiest one to explain, and possibly the most useful conceptually is, turn your number into a signal. Because if you are thinking about concepts like slew it is one anyway, really. So: number in -> sig~ -> onepole~ -> snapshot~ -> number out.

You could also make some combination of Max (as opposed to MSP) objects that will limit the rate of change of a number using the scheduler. The line object may help here. There are probably a hundred ways to do this and, out of those, about five good ones.

-Randy

Cle09's icon

Thanks but my patch doesn't seem to work yet I cannot see why, may I ask you to explain??

Thanks, I'm very new to programming / music and am a little thick anyway.

Edit hangon I've just seen that I've used line completely wrong, let me change that...

Edit that's done now...

Hans Höglund's icon

A combination of speedlim and line should be work very well for messages.

The nice thing with speedlim is that unused messages are discarded rather than being queued, improving performance.

Max Patch
Copy patch and select New From Clipboard in Max.

Randy Jones's icon

You need either the line object or signals but not both. Your connection from line to the onepole~ object doesn't do anything useful.

The line object help file shows you how do use line to do what you want.

If you are using signals, you need to turn signal processing on. I recommend that you start by reading everything in the MSP tutorials (Help menu / MSP Tutorials) up to and including Tutorial 1.

Cle09's icon

Randy Jones wrote on Sat, 21 November 2009 13:55You need either the line object or signals but not both. Your connection from line to the onepole~ object doesn't do anything useful.

The line object help file shows you how do use line to do what you want.

OK sure, I misunderstood what a slew was: it's limits changes in frequency not frequency lol!