Data AcQuisition And Real-Time Analysis
Scope - Spectrum - Spectrogram - Signal Generator
Software for Windows
Science with your Sound Card!
The following is from the Daqarta Help system:



Spectrum Analyzer

Signal Generator

(Absolutely FREE!)


Pitch Tracker


DaqMusiq Generator
(Free Music... Forever!)

Engine Simulator

LCR Meter

Remote Operation

DC Measurements

True RMS Voltmeter

Sound Level Meter

Frequency Counter
    Spectral Event

    MHz Frequencies

Data Logger

Waveform Averager


Post-Stimulus Time
Histogram (PSTH)

THD Meter

IMD Meter

Precision Phase Meter

Pulse Meter

Macro System

Multi-Trace Arrays

Trigger Controls


Spectral Peak Track

Spectrum Limit Testing

Direct-to-Disk Recording



Frequency response

Distortion measurement

Speech and music

Microphone calibration

Loudspeaker test

Auditory phenomena

Musical instrument tuning

Animal sound

Evoked potentials

Rotating machinery


Product test

Contact us about
your application!

RMS "Sum" of dB Values


A common task with dB values is combining them to get their total energy. This is almost always done in a Root Mean Square (RMS) manner, which assumes that the values are different waveforms or frequencies. A typical application is where you have measured several discrete harmonic distortion peaks in a spectrum, and want to know the total harmonic distortion of these components.

The THD Meter Mini-App can do this automatically if the values are the first several harmonics, just by setting its Max Harmonic control. Here we will assume that the values are either not the first several, or that you obtained them from some other source.

To combine dB values is not a matter of simple summation. You basically have to convert each value back to an equivalent RMS voltage and square it before summing, then take the square root of the sum to get an RMS value (see Root-Square Summation under the Root Mean Square topic), and finally convert back to dB.

Recall (from the main dB topic) that:

dB = 10 * log10(V1^2 / V0^2)

Here we assume that the V0 reference is unity (1.00), so we can ignore it and find the raw V1^2 value from:

V1^2 = 10^dB / 10

We repeat this with each dB value and add all the squared voltages together to get an overall V^2, then find dB in the usual way:

dB = 10 * log10((V^2)

dB_Sum Macro Use:

Rather that do all those calculations manually, you can let the dB_Sum macro "mini-app" (included with Daqarta) do the work.

To use it, enter all the dB values into the normal Daqarta Notes area. You can separate values with commas or spaces, or put one value on each line. You can use Windows standard Copy (CTRL+C) and Paste (CTRL+V) to import values from elsewhere. If there is one value per line, it may be followed by any amount of white space and a semicolon (;), and the rest of that line will be treated as a comment and ignored.

Then hit CTRL+F8 to open the Macro Dialog and double-click on dB_Sum in the Macro List. A Custom Macro Message box will pop up showing combined dB value, as well as a percentage that assumes the initial values were distortion products relative to the fundamental.

If the fundamental was at 0 dB and the harmonic values are simple dB readings of each component peak, the reported values will be correct.

If you are going to obtain the harmonic values from the Daqarta Spectrum readouts, you should set Peak mode for the cursor readouts, and use the Delta readout mode to get the difference of each component relative to the peak. (Copy and Paste each into Notes.) The values reported by dB_Sum will still be correct.

If the fundamental was something other than 0 dB, but you have obtained raw dB values that are relative to 0 dB, you need to subtract the fundamental value from the reported dB value to get distortion. For example, if the fundamental was -10 dB, and the reported value is -90 dB, then the actual distortion is -80 dB relative to the fundamental. (The reported percentage will be wrong.)

dB_Sum Macro Listing:

Buf0="<Notes"                   ;Read dB values from Notes to Buf0
UL=Buf0?L                       ;Number of values read to Buf0
UI=0                            ;Buf0 index
V=0                             ;Cumulative volts^2
WHILE.UI=<UL                    ;Do all UL values
    V=V + 10^(Buf0[UI] / 10)        ;Convert dB to volts^2, add to total
    UI=UI+1                         ;Next Buf0 index
WEND.                           ;Next value
T=10*log10(V)                   ;dB from total volts^2
P=sqrt(V) * 100                 ;Volts RMS as percent of unity
Msg=T + " dB" +n +P + " %"      ;Show results

Alternatively, if you want to read values from an external text file instead of from Notes, change the first line to Buf0="<LoadTXT": When the macro runs you'll be prompted for the file name via a standard Windows Open dialog.

Note: The Buf0 array can hold up to 1024 values, but the Notes area can hold only 2048 characters (counting commas, spaces, and carriage returns). At 8 characters per value (say -72.25, -81.52, etc) you can fit up to 256 values into Notes.

See also dB, dB From Voltages, Typical dB Applications, Working With dB, Formulas For Working With Sound


Questions? Comments? Contact us!

We respond to ALL inquiries, typically within 24 hrs.
Over 30 Years of Innovative Instrumentation
© Copyright 2007 - 2017 by Interstellar Research
All rights reserved