Forums > MaxMSP

Smoothing out MIDI value jumps

March 14, 2013 | 4:55 pm

Hi everybody,

I’m trying to assign a midi slider to a gain~ object with a catch behaviour, meaning that I have to match the gain~ slider value with the MIDI slider before taking control of it so as to avoid any unexpected jumps in gain.

Now the way I did it was with a == object comparing both gain~ slider value with midi value, connected to a gate letting the MIDI signal through to the gain~ object only when the two signals matched. It works perfectly except for one thing, my slider doesn’t output perfectly continuous data and jumps steps when moved fast, which means loosing control of the slider whenever moving it too quickly. Now I’ve been trying to find a way to interpolate numbers between the gaps in midi data, and have not been able so far to find a good solution. I’m sure it’s quite simple though. Any idea ? Any help would be much appreciated, thanks !

Here’s a simplified version of my patch :

– Pasted Max Patch, click to expand. –

March 14, 2013 | 7:10 pm

See this thread: http://cycling74.com/forums/topic.php?id=15180


March 15, 2013 | 5:32 pm

Hi Chris, thanks for the link, I checked it out but there’s seems a bit of a difference in what Yuni was trying to achieve and what I need.

He was trying to smooth out jitter in a number stream, and I’m trying to interpolate values between jumps in incrementing or decrementing number streams in the MIDI range. For example this is the data value received by max when moving my MIDI Slider up and down really fast :

midiSliderValue: 2
midiSliderValue: 49
midiSliderValue: 111
midiSliderValue: 127
midiSliderValue: 61
midiSliderValue: 0
midiSliderValue: 2
midiSliderValue: 13
midiSliderValue: 23
midiSliderValue: 36
midiSliderValue: 47
midiSliderValue: 68
midiSliderValue: 92
midiSliderValue: 114
midiSliderValue: 127
midiSliderValue: 105
midiSliderValue: 25
midiSliderValue: 0

Now what I need is to find a way to interpolate all the numbers in between the jumps in value to have a continuous flow of numbers going trough every integer value before reaching the final value as sent by the MIDI slider. And it would then look more like this :

midiSliderValue: 1
midiSliderValue: 2
midiSliderValue: 3
midiSliderValue: 4
midiSliderValue: 5
midiSliderValue: 6
midiSliderValue: 7
midiSliderValue: 8
midiSliderValue: 9
midiSliderValue: 10

midiSliderValue: 32
midiSliderValue: 33
midiSliderValue: 34
midiSliderValue: 35

I need it to go through every integer values in between the first value and the last value, because otherwise I loose unity of gain~ slider value and Midi slider value.

I tried using the method you provided in your topic, but it unfortunately didn’t achieve this.

Would you have any ideas on how to achieve this ?

Thanks for the help!


March 15, 2013 | 7:10 pm

Here’s an old abstraction of mine called EveryNumber:

– Pasted Max Patch, click to expand. –

March 15, 2013 | 7:23 pm

But if you’re controlling gain~ you may prefer an approach like this:

– Pasted Max Patch, click to expand. –

This doesn’t hit every number, but you may not need it to.


May 14, 2013 | 12:28 pm

Thanks for the EveryNum abstraction. Very useful with MIDI crossfaders.


May 15, 2013 | 7:54 am

f0.smooth
is a brilliant object for this kind of thing.


May 15, 2013 | 9:45 am

erhm… live.gain~ … it has an interp parameter, so you don’t have to fiddle with smoothing at all.


May 15, 2013 | 10:14 am

@WETTERBERG : In this case the interp paramater of the live.gain~ object is of no use to me, as the slew only affects the audio output of the object not the Slider Value output. The idea was to keep unity between a MIDI slider that jumps between values and a Gain~ slider, it wasn’t about smoothing out gain changes.


April 9, 2014 | 12:53 am

I need it too… any discoverie ?


April 9, 2014 | 2:31 am

What I m looking for is a regular interpolation, something like a Counter but with a live.dial

A big live.dial moove (6->120) with a line object makes numbers increase faster than a little moove (6->24).

I would like the increment/decr sending every values (6 7 8 9 10 11.. 100) and be regular in time
(1 [5ms]> 2 [5ms]> 3 [5ms]> 4 [5ms]> 5 [5ms]> 6 [5ms] …> 100)

I m not sure it’s easy as hell or complicated

Hope someone can help


Viewing 11 posts - 1 through 11 (of 11 total)