logoalt Hacker News

Retr0idyesterday at 7:11 PM2 repliesview on HN

There are two types of volume slider I've encountered thus far, "too logarithmic", and "not logarithmic enough".


Replies

embedding-shapeyesterday at 7:38 PM

That's because one ear is logarithmic-based and the other is exponential-based. Which one differs per person.

show 1 reply
ErroneousBoshyesterday at 10:25 PM

It's actually possible to turn a linear pot into an approximation of a log pot by wiring a resistor in parallel with the wiper and one end. The volume pot is a voltage divider so the amount it "scales" by is given by Scale = Rbottom / (Rtop + Rbottom).

But, if you put a resistor in parallel, you need to work out that:

R = 1 / ((1 / R1) + (1 / R2)) or Rbottom = 1 / ((1 / Rbottom) + (1 / Rfixed)) where Rfixed is the amount you're "bending" it by.

So you could make the amount of "logness" be adjustable by having another (linear) control to vary Rfixed.

You'd work out, for a pot rotation Vol from 0 to 1:

Rbottom = 1 / ((1 / Vol) + (1 / Rfixed)) Rtop = 1 - Vol Scale = Rbottom / (Rbottom + Rtop)

Now for those better at arithmetic than me, how can you reverse this? Imagine you've got a pot in a piece of equipment with a resistor between the wiper and ground giving a log curve, and you've got to read that with an ADC and turn it back into the linear position of the wiper.

It ought to be possible but I've always sucked at arithmetic.