Spin Semiconductor Forum Index Spin Semiconductor
Support forum
 
 FAQFAQ   SearchSearch   MemberlistMemberlist   UsergroupsUsergroups   RegisterRegister 
 ProfileProfile   Log in to check your private messagesLog in to check your private messages   Log inLog in 

Log taper for audio

 
Post new topic   Reply to topic    Spin Semiconductor Forum Index -> Algorithm development
View previous topic :: View next topic  
Author Message
Digital Larry



Joined: 12 Nov 2012
Posts: 266

PostPosted: Fri Jan 13, 2017 9:01 am    Post subject: Log taper for audio Reply with quote

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
Back to top
View user's profile Send private message Visit poster's website
amz-fx



Joined: 06 Sep 2006
Posts: 31
Location: Louisiana, USA

PostPosted: Sat Jan 14, 2017 2:40 am    Post subject: Reply with quote

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
Back to top
View user's profile Send private message Visit poster's website
Digital Larry



Joined: 12 Nov 2012
Posts: 266

PostPosted: Sat Jan 14, 2017 10:02 pm    Post subject: Reply with quote

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
Back to top
View user's profile Send private message Visit poster's website
amz-fx



Joined: 06 Sep 2006
Posts: 31
Location: Louisiana, USA

PostPosted: Sat Jan 14, 2017 10:29 pm    Post subject: Reply with quote

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.



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
Back to top
View user's profile Send private message Visit poster's website
MacroMachines



Joined: 12 Dec 2014
Posts: 70
Location: Detroit,MI

PostPosted: Wed Jan 18, 2017 11:39 pm    Post subject: Reply with quote

amz-fx wrote:

https://www.desmos.com/calculator/9plru2sovy


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.
_________________
http://MacroMachines.net
Digital Control for your Analog Soul.
Back to top
View user's profile Send private message Visit poster's website AIM Address
Digital Larry



Joined: 12 Nov 2012
Posts: 266

PostPosted: Fri Jan 20, 2017 12:54 pm    Post subject: Reply with quote

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
Back to top
View user's profile Send private message Visit poster's website
Display posts from previous:   
Post new topic   Reply to topic    Spin Semiconductor Forum Index -> Algorithm development All times are GMT - 8 Hours
Page 1 of 1

 
Jump to:  
You cannot post new topics in this forum
You cannot reply to topics in this forum
You cannot edit your posts in this forum
You cannot delete your posts in this forum
You cannot vote in polls in this forum


Powered by phpBB © 2001, 2005 phpBB Group