Logarithmic scale for dials and sliders.

Learn about building and using Max for Live devices.
Post Reply
Crubier
Posts: 51
Joined: Thu Nov 05, 2009 8:37 am
Location: Toulouse, France

Logarithmic scale for dials and sliders.

Post by Crubier » Thu May 13, 2010 10:17 am

Hi all, I would like to control many EQ eight frequency parameters (which scale is logarithmic) with only one knob in a M4L device.
The matter is I am unable to fit the scale of a live.dial with the logarithmic scale of the frequency dial in EQ eight. It just doesn't fit.

I have tried changing the "exponent" parameter in the live.dial inspector, but of course, no value can fit, because what I need is not a polynomial scale but a logarithmic scale.

Does anyone have a solution to that ?

Tone Deft
Posts: 24152
Joined: Mon Oct 02, 2006 5:19 pm

Re: Logarithmic scale for dials and sliders.

Post by Tone Deft » Fri May 14, 2010 2:40 am

try [scale], [atodb] and [dbtoa].

in the live.dial (for example) inspector you can change the style to decibel as well as set the max and min values.
In my life
Why do I smile
At people who I'd much rather kick in the eye?
-Moz

Gregory Taylor
Posts: 268
Joined: Tue Sep 01, 2009 3:11 pm

Re: Logarithmic scale for dials and sliders.

Post by Gregory Taylor » Sat May 15, 2010 10:06 pm

<pre><code>
----------begin_max5_patcher----------
788.3ocwW1schBCD.9Z7ofCW65gDEkt2sOG61SOQXzltPBGH3ZaOsO6ax.XC
U.Qs+bCHSBYl4a9gwmm33sVtGJ7b+o6uccbddhiCJxHvo9YGuT19nDVAtMuH
YZJHTdSqVSA6Un7bVZlqhmBMqjvEPjrTfKSqElwTQ2yEauKGhTUpktHbl+T2
P75hUlqyWLy2815WYiTnDL84Zzxux4rjFMviQYx0O7CxxFgY4Pg19XJtTXqk
U9lSN.0he8kC5PTlxEIfBcQhkhK3OgJlP0uxg8JKUMa12H7kISLWldkHrfuU
vRb+iHmo.8MsZ5Dly6Gljv.iuQIyQZhOX36YRy.uuEvnOg0Pt2P4JX9Agh2B
v3H0NPVY.pGyfpWvia3rq2ZlXq2YBg4WODnW.DfmhYQuN.DtYI51AqrBwAVL
v1GHc5CzOrH1lDo9PFvXI9KvHVk0FRNcDSejrKNl4+8DypRbGJnQBqxbCwfW
vxi3PpLFriMGwkptCFvTQnyiLgClHzCXzpDSL9.I0ISXnTLggFhE22D74lvr
5aJeA9mV6G8A.SW9W03VW03OXtzRqZpUyOMhdK24BXTvkj57ownTkbyHXCcd
yfDmhMmIMnWeFC4BnQBeGLK1xj1wxOXqGsX+fYIE+dwhlgsFfKG2oIiomxCT
P9cffsNAr8b6tvChn2kYzzpgsChuioT470kJ3seUTCkZpXb7jRPmCTKtQts0
UjAPbBOEadMsi0UPVQeKB6yjBnZRKxrt1QofqJTO1x+asgTcnqJCXUmGPpFK
sZr1Z0lXPWqw0pVGms3em928xbUuYGu6.2wK3CbV5uKcBugIDx54sOnytTkt
y+1wYTFcNDgz8I+q4jJFxnq+dZ2TbirWyTlGqmAsm2DC8UuZ0hXYbys5ZZrd
Aal+t+YEVVZj2tPuPVlG0T1U2iw8sJyXnPwEHfs1SPq8bOONFDVVsWJONSpm
9s1DbusylNi0hBFgEE9kZQlwyGEjHeYlzXBalITOGJQzS.EnchE2f2z+utlm
tRiMrEZ51XW80FQGA9nWgEoe3kI+GHuRCbO
-----------end_max5_patcher-----------
</code></pre>

Crubier
Posts: 51
Joined: Thu Nov 05, 2009 8:37 am
Location: Toulouse, France

Re: Logarithmic scale for dials and sliders.

Post by Crubier » Wed May 19, 2010 5:51 pm

Gregory, your solution is Ok but I was searching a solution allowing to print the value in Hz in the "Parameter Value" of the live.dial.

The only solution I found was disabling the "display parameter value" attribute and using a label instead to display the correct value in Hz, which is calculated using a "mtof" block.
This solution is almost perfect, the only problems are :
- I can't type the desired frequency, I can only set it by using the knob
- The value display is not centered as it shoud be, be left aligned as every textbox in Max.

Here's my solution :

Code: Select all

{
	"boxes" : [ 		{
			"box" : 			{
				"maxclass" : "newobj",
				"text" : "/ 1000.",
				"numinlets" : 2,
				"numoutlets" : 1,
				"patching_rect" : [ 619.0, 478.0, 41.0, 18.0 ],
				"id" : "obj-23",
				"fontname" : "Arial Bold",
				"outlettype" : [ "float" ],
				"fontsize" : 10.0
			}

		}
, 		{
			"box" : 			{
				"maxclass" : "message",
				"text" : "set $1 kHz",
				"numinlets" : 2,
				"numoutlets" : 1,
				"patching_rect" : [ 597.0, 522.0, 59.0, 16.0 ],
				"id" : "obj-21",
				"fontname" : "Arial Bold",
				"outlettype" : [ "" ],
				"fontsize" : 10.0
			}

		}
, 		{
			"box" : 			{
				"maxclass" : "newobj",
				"text" : "if $f1>= 1000 then $i1",
				"numinlets" : 1,
				"numoutlets" : 1,
				"patching_rect" : [ 618.0, 426.0, 111.0, 18.0 ],
				"id" : "obj-20",
				"fontname" : "Arial Bold",
				"outlettype" : [ "" ],
				"fontsize" : 10.0
			}

		}
, 		{
			"box" : 			{
				"maxclass" : "newobj",
				"text" : "if $f1<1000 then $i1",
				"numinlets" : 1,
				"numoutlets" : 1,
				"patching_rect" : [ 472.0, 464.0, 102.0, 18.0 ],
				"id" : "obj-19",
				"fontname" : "Arial Bold",
				"outlettype" : [ "" ],
				"fontsize" : 10.0
			}

		}
, 		{
			"box" : 			{
				"maxclass" : "message",
				"text" : "set $1 Hz",
				"numinlets" : 2,
				"numoutlets" : 1,
				"patching_rect" : [ 504.0, 531.0, 54.0, 16.0 ],
				"id" : "obj-17",
				"fontname" : "Arial Bold",
				"outlettype" : [ "" ],
				"fontsize" : 10.0
			}

		}
, 		{
			"box" : 			{
				"maxclass" : "comment",
				"text" : "98.00 Hz",
				"presentation_rect" : [ 569.0, 359.0, 79.0, 18.0 ],
				"numinlets" : 1,
				"numoutlets" : 0,
				"patching_rect" : [ 557.0, 617.0, 91.0, 18.0 ],
				"presentation" : 1,
				"id" : "obj-15",
				"fontname" : "Arial Bold",
				"fontsize" : 10.0
			}

		}
, 		{
			"box" : 			{
				"maxclass" : "newobj",
				"text" : "mtof",
				"numinlets" : 1,
				"numoutlets" : 1,
				"patching_rect" : [ 564.0, 390.0, 34.0, 20.0 ],
				"id" : "obj-12",
				"fontname" : "Arial",
				"outlettype" : [ "" ],
				"fontsize" : 12.0
			}

		}
, 		{
			"box" : 			{
				"maxclass" : "live.dial",
				"varname" : "live.dial",
				"presentation_rect" : [ 563.0, 317.0, 44.0, 38.0 ],
				"numinlets" : 1,
				"shownumber" : 0,
				"numoutlets" : 2,
				"patching_rect" : [ 563.0, 317.0, 44.0, 38.0 ],
				"presentation" : 1,
				"id" : "obj-14",
				"parameter_enable" : 1,
				"outlettype" : [ "", "float" ],
				"saved_attribute_attributes" : 				{
					"valueof" : 					{
						"parameter_mmax" : 127.0,
						"parameter_mmin" : 0.0,
						"parameter_type" : 0,
						"parameter_initial_enable" : 0,
						"parameter_shortname" : "live.dial",
						"parameter_invisible" : 0,
						"parameter_modmax" : 127.0,
						"parameter_annotation_name" : "",
						"parameter_longname" : "live.dial",
						"parameter_modmin" : 0.0,
						"parameter_linknames" : 0,
						"parameter_modmode" : 0,
						"parameter_info" : "",
						"parameter_order" : 0,
						"parameter_units" : "",
						"parameter_speedlim" : 0,
						"parameter_steps" : 0,
						"parameter_exponent" : 1.0,
						"parameter_unitstyle" : 1
					}

				}

			}

		}
 ],
	"lines" : [ 		{
			"patchline" : 			{
				"source" : [ "obj-12", 0 ],
				"destination" : [ "obj-20", 0 ],
				"hidden" : 0,
				"midpoints" : [  ]
			}

		}
, 		{
			"patchline" : 			{
				"source" : [ "obj-20", 0 ],
				"destination" : [ "obj-23", 0 ],
				"hidden" : 0,
				"midpoints" : [  ]
			}

		}
, 		{
			"patchline" : 			{
				"source" : [ "obj-12", 0 ],
				"destination" : [ "obj-19", 0 ],
				"hidden" : 0,
				"midpoints" : [  ]
			}

		}
, 		{
			"patchline" : 			{
				"source" : [ "obj-19", 0 ],
				"destination" : [ "obj-17", 0 ],
				"hidden" : 0,
				"midpoints" : [  ]
			}

		}
, 		{
			"patchline" : 			{
				"source" : [ "obj-23", 0 ],
				"destination" : [ "obj-21", 0 ],
				"hidden" : 0,
				"midpoints" : [  ]
			}

		}
, 		{
			"patchline" : 			{
				"source" : [ "obj-21", 0 ],
				"destination" : [ "obj-15", 0 ],
				"hidden" : 0,
				"midpoints" : [  ]
			}

		}
, 		{
			"patchline" : 			{
				"source" : [ "obj-17", 0 ],
				"destination" : [ "obj-15", 0 ],
				"hidden" : 0,
				"midpoints" : [  ]
			}

		}
, 		{
			"patchline" : 			{
				"source" : [ "obj-14", 0 ],
				"destination" : [ "obj-12", 0 ],
				"hidden" : 0,
				"midpoints" : [  ]
			}

		}
 ]
}

Post Reply