dial problem, please help

Tim Canfer's icon

I am trying to get a dial to control volume rather than the gain slider. I am using a basic float linear dial + smoothing ramp + *~ and it is giving HF crackling.

Here's the gist of the problem - I can't find anything of it's like in the forum. Not the end of the world but hope you can help.

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

Tim Lloyd's icon

If you change [line 0.] to [line~] i will get rid of the crackling.

Also, if you want the dial to have the same smoothing as a default gain object, you would use [$1 10] in the message box, although that still leaves some irregularities if you move the dial quickly.

If you check out the help file on gain~ it states that a value of 128 is equal to multiplying by 1. using [*~].

Tim Canfer's icon

Ahhh, yes of course! thanks a lot

- I have found with using the scale object as well I can get what I'm after.

BTW - could you, or anyone else please recommend any good books/sources about maths for MAX? Specifically signal manipulation, as I could really do with a better understanding of exponentials and parabolas etc.

Thanks Tim,
Tim

(Here's the useful little badger if anyone wants it.)

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

Luke Hall's icon

If you're after the exact same scaling as the [gain~] object then try replacing your [scale] object with this:

[expr pow(10.,((($i1-128)*0.6)/20.))]

The maths is all shown in the [gain~] help file. The only thing you want to be careful with is that this method never reaches zero so you might want to put a [sel 0] to trigger absolute silence.

lh

Tim Canfer's icon

Thanks, this is useful - I'll try a/b testing them.

How is the sel connected to trigger 0 when it never gets to 0?

Luke Hall's icon

Trigger it from the [dial] output rather than the [expr] output, remember to send it through the [line] object too. Here's a patch to demonstrate. Also remember that sending the [gain~] object a value of 128 will output a gain of 1, to show this I've made the [slider] range 0 to 128 rather than 0 - 127.

lh

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

Tim Canfer's icon

that's superb, it's always really useful to see patching examples of best practice - thanks again.

Tim