# Audio-Programming: Directshow Logarithmic Volume Control

Warning: preg_replace(): The /e modifier is no longer supported, use preg_replace_callback instead in /home/.sites/132/site8248620/web/wp-content/plugins/latex/latex.php on line 47 Warning: preg_replace(): The /e modifier is no longer supported, use preg_replace_callback instead in /home/.sites/132/site8248620/web/wp-content/plugins/latex/latex.php on line 49 Warning: preg_replace(): The /e modifier is no longer supported, use preg_replace_callback instead in /home/.sites/132/site8248620/web/wp-content/plugins/latex/latex.php on line 47 Warning: preg_replace(): The /e modifier is no longer supported, use preg_replace_callback instead in /home/.sites/132/site8248620/web/wp-content/plugins/latex/latex.php on line 49 Warning: preg_replace(): The /e modifier is no longer supported, use preg_replace_callback instead in /home/.sites/132/site8248620/web/wp-content/plugins/latex/latex.php on line 47 Warning: preg_replace(): The /e modifier is no longer supported, use preg_replace_callback instead in /home/.sites/132/site8248620/web/wp-content/plugins/latex/latex.php on line 49 Warning: preg_replace(): The /e modifier is no longer supported, use preg_replace_callback instead in /home/.sites/132/site8248620/web/wp-content/plugins/latex/latex.php on line 47 Warning: preg_replace(): The /e modifier is no longer supported, use preg_replace_callback instead in /home/.sites/132/site8248620/web/wp-content/plugins/latex/latex.php on line 49
[Latexpage]When programming audio user-interfaces, volume is usually calculated in form of logarithmic scales. In Windows, specifically DirectX, volume ranges from -10000 (=silence) up to 0 (=maximum volume). However, a volume slide is moved linearly between e.g. 0 (=silence) up to 1.0 (maximum volume) - so we need to convert linear values to logarithmic and vice versa.

The basic function, that takes a linear value in the range of [0;1] and converts to a exponential value can be denoted as:

Note, that this function ranges from 0 up to 10 on the vertical axis. The inverse function can be denoted as the logarithmic function with base 10:

In order to apply the correct ranges, we need to shift the values of x in both functions. Thus, we can rewrite $f(x)$ as:

For the logarithmic function, we write:

Using these formulae, we can convert volumes within the linear ranges from 0.0 to 1.0 to logarithmic values between -10000 and 0 and vice versa.

This site uses Akismet to reduce spam. Learn how your comment data is processed.