Probably Newbie Question (logarithmic sliders)

MuShoo's icon

So I've got a slider controlling the center frequency of a filtergraph object, only the slider isn't logarthmic, and the filtergraph display is. How do I get the slider to output logarthmically, ideally without using an MSP slider?

IE, what equation do I put between the filter's output and the filtergraph input to make it function correctly? (lower values should be more precise than higher values, 0-200 should take up almost half the graph, and 200-22000 should take up the other half, but with a smooth curve).

I'm sure this is easy, I just haven't figured it out. :/

Jean-Francois Charles's icon

Posted by Luke a few days ago (look for logarithmic in title of message...)

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

Chris Muir's icon

On Aug 4, 2008, at 12:05 AM, mushoo wrote:

> IE, what equation do I put between the filter's output and the
> filtergraph input to make it function correctly? (lower values
> should be more precise than higher values, 0-200 should take up
> almost half the graph, and 200-22000 should take up the other half,
> but with a smooth curve).

mtof would work.

-C

Chris Muir
cbm@well.com    
http://www.xfade.com

MuShoo's icon

Ah! Thanks for all the replies, guys.

Also, thanks for making me finally figure out what to do with the new max5 text chunks! I like that you can just copy/paste now. (Is that ever explained anywhere?)

MuShoo's icon

Ooookay, got a slightly harder problem for you all this time.

I need to do it in reverse.

the included patch is something you've probably seen before, I'm using it to allow the user to set a number box, or the slider, without a feedback loop. (I also take the [float] output and use it for a settings-save system).

The problem is that I need a second scale object for getting the numbers from the float back into the slider's 1-128 range, but scaling with the right curve. As it is right now, the slider is functioning... oddly. The 'set $1' command is slamming the slider around to the edges.

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

Luke Hall's icon

I can't open your Max 5 patch but I'm guessing you want the equation in reverse. You can use a combination of [mtof] or [ftom] with [scale] or you can use these [expr] equations.

I hope this is helpful. I've explained most of workings in the thread linked to above.

lh

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

Luke Hall's icon

I knew there was a reason I did a maths A-level. It wasn't a completely useless waste of time after all!

lh

Stefan Tiedje's icon

raja schrieb:
> without delving into all the advanced math required for the "expr"
> object or similar stuff, this is the quickest, easiest thing I could
> come up with:

The problem is your 0 HZ point, can't really work with a logarithmic
curve if you think about it...
(I know why I never touch that fifth argument to scale, nobody knows
what it does exactly anyway... ;-)

My version:

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

--
Stefan Tiedje------------x-------
--_____-----------|--------------
--(_|_ ----|-----|-----()-------
-- _|_)----|-----()--------------
----------()--------www.ccmix.com