I know I can multiply samples, then clip but perceived volume is non-linear for humans.

Can you please help with a formula.

  • $\begingroup$ Why was this question downvoted? It is clearly relevant for this board. $\endgroup$
    – Jim Clay
    Jul 30, 2012 at 16:12
  • 3
    $\begingroup$ The question is not very clearly formulated, not even grammatically. Besides that, what kind of non-linearity do you want to compensate for: amplitude only, or frequency-dependent amplitude? $\endgroup$ Jul 30, 2012 at 16:18
  • $\begingroup$ I read this mini tutorial: ypass.net/blog/2010/01/… And this guy used tan function to make volume not linear but he said thi is not perfect way. So I thought at that DSP forum You will understand what I mean even its not gramaticaly posted. $\endgroup$
    – apocalypse
    Jul 30, 2012 at 18:13
  • $\begingroup$ I think that question is very concise and very clear. When you work with audio you instantly understand what @zgnilec means. This is a psychoaccoustics issue : the perception of audio volume in humans is non-linear. So the question is : "how you do you make an audio gain change that is perceived as linear?" $\endgroup$
    – sebpiq
    Dec 23, 2015 at 11:06
  • $\begingroup$ A range of -48dB to +6dB makes 54dB in amplitude. $\endgroup$
    – be999
    Oct 4, 2017 at 18:20

1 Answer 1


Changing the volume of an audio signal must be done by applying a gain (multiplication) - and optionally clipping if your system has a limited dynamic range. This is as simple as that. Applying a non-linear function to an audio signal will cause distortion and add harmonics, and you don't want this to happen - you want to modify the loudness of the signal, not its timbre. [To be fair, there are non-linear processings designed to change the perceived loudness of the signal without affecting the timbre, within a given dynamic range constraint (eg. multiband compression), but it doesn't look like this is what you need.]

Where non-linearity and fancy response curves come to play is when designing a user interface - when deciding on the relationship between the position of the control (knob or slider, whether on a GUI or as physical hardware) and the gain applied to the signal. This is where perception matters, because the users will expect a mapping between the position of the slider and their perception of loudness. Please note that even if the relationship between the position of the volume control and the gain applied to the signal is non-linear, the process of applying the gain to the signal is linear, and non-linearity would be unwanted there!

When it comes to physical volume controls, eg in hifi systems or personal audio players, the relationship between the knob position and the attenuation is closer to an exponential curve, though its shape has been tweaked and is constrained by the manufacturing process - sometimes it's just two or three linear segments. You can find those curves in the datasheets from manufacturers ("A" taper). Mixing console faders usually have their response compressed so that the upper half of their travel covers the useful range of -20 dB..+6dB.

In the software world - at least for music production - it is most common to have volume/gain knobs calibrated in dB. For example, if you have a 100 pixels long volume slider graduated from -48dB to +6dB, the gain applied to the signal would be $10^{\frac{-48 + 54 \frac{x}{100}}{20}}$.

  • $\begingroup$ when x is 0 = 24, x=100 gives 3. Is this correct? I need more time to understand this :< $\endgroup$
    – apocalypse
    Jul 31, 2012 at 6:35
  • $\begingroup$ 10 ** ((-48 + 54 * 0 / 100.0) / 20.0) = 0.004 ; 10 ** ((-48 + 54 * 100 / 100.0) / 20.0) = 1.995 $\endgroup$ Jul 31, 2012 at 8:02
  • $\begingroup$ This is an exponent, not a multiplication. 10 ^, not 10 * $\endgroup$ Jul 31, 2012 at 11:17
  • $\begingroup$ Where does the 54 come from? $\endgroup$ Aug 28, 2017 at 12:54

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge that you have read and understand our privacy policy and code of conduct.

Not the answer you're looking for? Browse other questions tagged or ask your own question.