How to get a clean center value [0.5] from a floating point slider? Easy (sort of).

Chris Rolfe's icon

Hopefully, this post will save some future Max user from scratching their head. I realized the position of a slider in a patcher affects its floating point output values. A float slider (0…1) pan control might or might not hit 0.5 but rather .49 .. 0.51 depending upon its patcher position.

It seems a float slider output differs when it's on a fractional pixel boundary (ie, when the slider position is x=50 y=100 vs x=50 y=100.5).

It's possible to get a 0…1 slider to hit 0.5 in the middle though. Don't use odd-numbered box sizes and don't place your float sliders on a fractional pixel. Use snap to grid or manually set the position to a whole number.

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

Valery_Kondakoff's icon

Thanks for the info! Do you know, that you can press Shift while dragging UI controls for more precision? This does not solves the issue, but (at least) allows to set third slider from your example to a values .499 and .501.

Roman Thilenius's icon

what a weird idea to allow sub pixel positioning.

Chris Rolfe's icon

@Roman
Something to do with scaling, I would guess.

Chris Rolfe's icon

I've reported this as a bug .

The issue occurs in Max 6 as well as Max 8.