Adding attenuations in dB I am writing a synthesizer. One part of the synthesizer specification says that different sources can specify an attenuation to be applied to a signal, and that these attenuations should be summed.
The attenuations are specified in cB and are given as positive values. An attenuation of 0cB means no attenuation.
The naive approach, which I've tried, would be:
$$
x_{total} = 20 \log_{10}\left( \sum 10^{\frac{x}{20}}\right)
$$
for each $x$ as the attenuation (converted to dB) being summed.
This has problems, since if I add two 0cB attenuations (i.e. no attenuation, twice), I get a total attenuation of 60.2cB. This is obviously not what I want.
How can I add my attenuations to get a sensible result out the other side? Thank you.
Part of the advantages of using dB to express gain or attenuation is that they're inherently logarithmic.
So if you're speaking in dB, when you add a 10dB attenuation to another 10dB of attenuation, what you're saying is that you're multiplying the signal by $\sqrt{0.1}$, and then by $\sqrt{0.1}$ again.  The result is 20dB of attenuation -- or multiplying the signal by $\sqrt{0.01} = 0.1$.
So if your ultimate gain is $A$, as a normal number, and you have attenuations $a_1, a_2, \cdots$ in dB, then the actual $A$ by which you multiply your signal is $$A = 10^{-\frac{1}{20}\sum a_n}$$