When you take a pot value and multiply it directly against the audio signal, what you're getting is a linear taper. So most of the action happens in the lower half of rotation. I know I can use the LOG instruction to scale the pot value so that when it's multiplied against the audio it's more like a log taper pot.
I know I should know this already, but supposing I want a "log" taper that goes from 0.001 (-60 dB) to 1.0 (0 dB) logartihmically, of course, with an input of 0.0 to 1.0... how do I do that? How about -30 dB to -6 dB?
Suppose that I want to control a filter frequency parameter logarithmically over a range of 0.35 to 0.62 when the input goes from 0.0 to 1.0... same question. I understand this is simply a matter of converting those values to dB 20 log10(v1/v2) and using the previous equation.
Thanks and happy new year!
DL
Log taper for audio
Moderator: frank
-
- Posts: 338
- Joined: Mon Nov 12, 2012 1:12 pm
- Contact:
DL,
A simple/easy way to bend the pot response is to square it before use.
0*0= 0
0.2*0.2= 0.04
0.5*0.5= 0.25
0.7*0.7= 0.49
0.9*0.9= 0.81
1.0*1.0= 1.0
As you see, 25% of the value change takes place in the first half of the pot rotation, and 75% value change takes place in the second half.
You can even cube the pot value to bend it even more.
It is more elaborate to set the filter frequency as you asked at the end of your post since it has an offset from 0. One quick-and-dirty way is:
PotValue * PotValue (warp the pot response over the 0 to 1.0 range)
PotValue * 0.27 (we now have 0 to 0.27v with a log-ish response)
Add 0.35 (add offset, now it is 0.35 to 0.62)
Since you bent the pot values in the first instruction, it will be closer to the response you need. It is all a matter of warping the pot response then scaling and adding the offset. Should only require 2 instructions.
The anti-log response is done the same way but with the sqrt of the pot value. With the root, the first 50% rotation gives 0.707 and the top 50% rotation gives the remaining 0.293 (assuming 0 to 1v pot values over the full rotation).
regards, Jack
A simple/easy way to bend the pot response is to square it before use.
0*0= 0
0.2*0.2= 0.04
0.5*0.5= 0.25
0.7*0.7= 0.49
0.9*0.9= 0.81
1.0*1.0= 1.0
As you see, 25% of the value change takes place in the first half of the pot rotation, and 75% value change takes place in the second half.
You can even cube the pot value to bend it even more.
It is more elaborate to set the filter frequency as you asked at the end of your post since it has an offset from 0. One quick-and-dirty way is:
PotValue * PotValue (warp the pot response over the 0 to 1.0 range)
PotValue * 0.27 (we now have 0 to 0.27v with a log-ish response)
Add 0.35 (add offset, now it is 0.35 to 0.62)
Since you bent the pot values in the first instruction, it will be closer to the response you need. It is all a matter of warping the pot response then scaling and adding the offset. Should only require 2 instructions.
The anti-log response is done the same way but with the sqrt of the pot value. With the root, the first 50% rotation gives 0.707 and the top 50% rotation gives the remaining 0.293 (assuming 0 to 1v pot values over the full rotation).
regards, Jack
-
- Posts: 338
- Joined: Mon Nov 12, 2012 1:12 pm
- Contact:
Hey Jack,
Thanks for the response. I already do have a power block (1/5 - 1 - 5) in SpinCAD and I use it as you mention frequently. What I am really after though, just to offer the option, is having a real log taper. And some examples demonstrating getting a specific result with the LOG instruction.
DL
Thanks for the response. I already do have a power block (1/5 - 1 - 5) in SpinCAD and I use it as you mention frequently. What I am really after though, just to offer the option, is having a real log taper. And some examples demonstrating getting a specific result with the LOG instruction.
DL
DL,
In most real hardware log-taper potentiometers, there is no log to the taper! In fact, if you put a VOM on the lugs of the pot, it can be seen that the resistance is composed of two linear tracks. The first goes from 0 to mid-point (or so) and the second track from mid to the other end. Or almost to the other end... full resistance is achieved before the wiper completes rotation.
Here is a graph of the resistance response of Alpha potentiometers and you can see the two (mostly) linear sections. Certainly not a smooth log response.
![Image](http://gaussmarkov.net/parts/resistors/taiwanalpha%20-%20audiotaper.png)
Also, here is an interesting calculator that has lots of useful info in it. Many log taper pots have 50% rotation equal to 20% of the resistance. The calculator defaults to p=0.15 but you can change it to p=0.20 with the first slider.
https://www.desmos.com/calculator/9plru2sovy
Best regards, Jack
In most real hardware log-taper potentiometers, there is no log to the taper! In fact, if you put a VOM on the lugs of the pot, it can be seen that the resistance is composed of two linear tracks. The first goes from 0 to mid-point (or so) and the second track from mid to the other end. Or almost to the other end... full resistance is achieved before the wiper completes rotation.
Here is a graph of the resistance response of Alpha potentiometers and you can see the two (mostly) linear sections. Certainly not a smooth log response.
![Image](http://gaussmarkov.net/parts/resistors/taiwanalpha%20-%20audiotaper.png)
Also, here is an interesting calculator that has lots of useful info in it. Many log taper pots have 50% rotation equal to 20% of the resistance. The calculator defaults to p=0.15 but you can change it to p=0.20 with the first slider.
https://www.desmos.com/calculator/9plru2sovy
Best regards, Jack
-
- Posts: 71
- Joined: Fri Dec 12, 2014 10:45 pm
- Location: Detroit,MI
- Contact:
I LOVE DESMOS!! I discovered it a few weeks ago and have been making prolific number of graphs. Im stoked to see another DSP lover using it to great effect! good work! Got any other useful DSP graphs? Id be happy share mine, in fact right now I might make one to test out this quantized transpose math for a pitch shifter.amz-fx wrote: https://www.desmos.com/calculator/9plru2sovy
-
- Posts: 338
- Joined: Mon Nov 12, 2012 1:12 pm
- Contact:
Here's a real world example of why I want to understand the log/exp functions better.
I have a control curve that uses the pot value run through a square. Oh but I've cubed it too and that gives a different interesting result. (It could happen). Now I want to have a way to vary it continuously between 2.0 and 3.0 and for that I think I will need to use log or exp.
DL
I have a control curve that uses the pot value run through a square. Oh but I've cubed it too and that gives a different interesting result. (It could happen). Now I want to have a way to vary it continuously between 2.0 and 3.0 and for that I think I will need to use log or exp.
DL