Scale exponential mode. Reversible?
I’m pretty new to max.
I’m working with the scale object. I have it set to the exact "flow" that I want now. However, I need to be able to take what is coming out of my scale object and convert it back to the original input. Since I’m using an exponent, this is proving to be incredibly difficult to figure out. I’ve attached a patch to better describe what the situation is. I’m not yet hip to the majority of the max lingo.
The [scale] object fifth argument is probably not the way you want to go. I would recommend not using it at all. Ever. Instead you could write your own expression with [expr] or [pow] or you could use Zachary Seldess’ [z.scale] abstraction or one of Peter Castine’s [lp.scampi] or [lp.scampf] externals. Here’s an example using [z.scale] which you can find on the thread linked below. Set your desired last argument and then to flip it back use the inverse as I have done.
----------begin_max5_patcher---------- 405.3ocyU0saBBCF8Z3onoWyHsPEo6t8brXVpP00En0H0LmFe2G8CPYFc59w e3h1vWKmuy4zCvZeO7XyRYEF8H5Yjm2ZeOOnjqfW68d3RwxrBQErM7jBidQI NnYoYBa1qJ8zWlKyrMvjDERBPCgwz3PNOgvYAnHRHAMp8wlXzVsnTBH9zbkn nCvZrU5BoEZFcWQyBaW0ndfToVAfPcsqorJGP0L9sGFLrC1lG29wLYCIcxPX wAH7XgdJFMxssM99tgf+WmflPtCrBF+RZEZ460MoqCV4RvAvqBqxDERDoVx0 W0yT2XHmEmNjcZmKNEl3ItoeiqkbPWid9t1oBPWzfCM4NH3DwtoAGHvzFeng jAbVR7IcNNC7uznaUtgdQxM48n6Q0dL70F11wsR+fohsxfP+VI2Wa+DoAcGW nz6+SFf+t5eUuUlEyy5vqsancZHWVYUZgUYz81i6y781zqp7bIrd2ISoJelQ ossb3Hl+4Ro8Z2g4D85xI54vI2qxWQNwNGN49uzUjS6YAGgS+kyt5a13+IPG bRBy -----------end_max5_patcher-----------
Thanks so much for your help. I only have time right now to quickly glance at the information you’ve given me so I’m not fully making sense of it all right now. It looks like I’m really going to have to spend some time with this to understand it a little better. Like I said, I’m really new to max and programming in general. I’ve always been on the front end of stuff until recently.
Based on the research I already did (searching the forum), I assumed I was going to get a response telling me not to use the 5th [scale] argument. Which is what sucks because like I said, I really like how I had it set up using [scale] and it was working perfectly for me up til now. Here is some more detail of what I’m trying to accomplish. Hopefully someone will read this and respond with "hey idiot, you’re trying to hard, all you need to do is…"
I’m using an external controller (my iPhone) to control a filtergraph. It’s a 4 band EQ.
I’m using the third page of the "simple" setup of the app Touch OSC on my iPhone to do this (if that helps).
I have it set up to set the frequency and gain of the selected filter with the "xy thing" and then there are 4 toggles that I am using to select which filter (or "band") I am adjusting. I’m currently using the [scale] before the frequency input of the filtergraph with a 5th argument of 1.06 and it’s giving me a really good response for adjusting the frequency of the filtergraph (which I have set as linear as opposed to logarithmic in the inspector). The reason I’m using this 5th argument is because of how frequencygraphs work (and audio in general). When EQing, there is a much bigger difference between 20Hz and 30Hz than there is between 20000Hz and 20020Hz…
When I switch to a different filter (or band) I need to have the location of the "xy thing" on my phone reset to the xy location of that specific filter that I just selected. This is where I need to take the output of the X location and "unscale" it to get something that I can send back to my iPhone.
My phone is sending a value between 0 and 1 that I need to then convert to the frequencies that I will be using (between 10 and 20000).
Hopefully that made some sense to someone. I will follow this up as soon as possible with an example patch.
Thanks again thereishope.
I guessed you might be dealing with frequency from your first post. For this task I would recommend using [mtof] and [ftom] which use the correct exponential scaling to convert between midi notes and frequency. You can then use [scale] to map it to the range you want. This is done in the first example.
It is possible to do all this with one [expr] object as illustrated in the second example but you do need to delve into the maths behind it all fairly deeply. If you want me to explain what’s going on in this equation then just ask and I’ll give it a shot.
On a more general note; as a beginner if you get stuck you should open the help files of the objects you are using and have a look at the examples they provide. There will also be a link to the reference page which will explain in detail what the object can do. Another good idea is to look at the help files for all the related objects that appear in the drop down menu. And finally you should definitely work your way through the max and msp tutorials as they are pretty much the best way to learn the basics of the programming language.
----------begin_max5_patcher---------- 714.3ocyX9sbhBCEF+Z7ofgoWnVKlbRH.6c6yw1N6fH1lc.hiFm5tc569l+H sZm1Rlp.8BiCGHgu7Kmuji9zHufEh8EaC7+g+u787dZjmmIjNf2gq8Bpx1mW ls07XA0EOJV7mfY1aIK1KMgWIEUMAWmIyefWe+u2TjKsiMDyBQy7YDcKgpaA THx+tCcYknVVmUUXFqetgmU1LX06p30kERyaG+ZPwN4aipGjs7+YFDLndG1v 7klQUo5an3lg01c4eWWXEXPf+c5677nQ5lYmGMpjhUeBMnoZ.fQICLMP8CM1 lmUV3iTSX0mnPZBKA7wjnPTLCPPqfhYIjFQeMPwNSPQXeHnVUJxjeQZsqZQw l1MMXvPgHzkMOAbe5+w4I7ZYvL+fEY022AoLuSxhMMxAnghMekRFrjFbWjzn 5pRPsO+ShzsorAKmAZY1eVYMtRAJdfo.YPovgyYHnAlBQeCnPBafgPbWBgSO KQIadkhIp6fZiKT3xb3hRNMuS0FzmKrR5vSbZ6XWKWHH1vdpKD0cLvQOCv.6 YojACB3N0079EeTre8F+wiKE2iQiuZEdNkhBmL2dMDNYxTkXulkFdSSAJSli wogQIoTb7TU5eX6nMwTTKINYnp9GHW3p+cMoBRG5jJz2yshw1h19lsWLNo2q 92Z.WKdT41t81YiGO9JNdt1WM8Ue10uX9tQYEUNPsybxTsWs8bP6uNfDACk6 CG6n6yHrfRd8a+aZLSNc7S46VwtM4MCUyuCw+042xhsRdcljKpO9gPm7POvW trn93j1J9x0B058AQ7Aq1NqIvEMg6UMQchSP+xIhCZh1ubRWaV6bh0uZh4hl h627IjKZJpe4TrK4S87dAQtvIRKZJWTJ1X6f43yia.JASheoyWV4CtXQg9cY FbYqLfzuZxE6.fOmk4njDf1QKyXWbNP+5bvtrSL9b10Scwyi9OPNYm+v -----------end_max5_patcher-----------
Got it! Thanks so much for your help. I just used the z.scale and it fixed the problem perfectly. The z.scale apparently works exactly the way that I thought the [scale] should be working. I was getting into so much ridiculous math trying to convert that back. I was starting to get scared that the only way to get what I wanted was to spend days trying to figure something out like that second example you sent me. I didn’t pay enough attention in math class to be able to bust that out though.
As far as help files and tutorials go, since I picked this up about 2 months ago I’ve been spending every free second I have studying up on them. They are incredibly helpful.
Related to this, I just updated z.scale and z.zmap so that they now have an exponential AND a logarithmic mode. In logarithmic mode (which behaves in much the same way as the actual 5th arg of scale) the 5th arg controls the exponential base value of the curve. In exponential mode, the 5th arg controls the exponenent of the curve. Both modes are potentially useful, depending on what you’re scaling for.
The new abstractions are attached, or you can get them here: