Difference between revisions of "THD Sweep Measurement"

From OROS Wiki
Jump to navigation Jump to search
Line 266: Line 266:
| style="font-size: 1.1em; margin-top: 10px; opacity: 0.95;" | Go measure some THD and make your speakers proud 🎵
| style="font-size: 1.1em; margin-top: 10px; opacity: 0.95;" | Go measure some THD and make your speakers proud 🎵
|}
|}
== THD: Mathematical Formulas and Theory ==
=== Standard THD Definition ===
==== THD as Percentage ====
The most common definition of THD is the ratio of RMS harmonic content to RMS fundamental:
<math>
\text{THD\%} = \frac{\sqrt{\sum_{n=2}^{N} V_n^2}}{V_1} \times 100
</math>
Where:
* <math>V_1</math> = RMS amplitude of fundamental (1st harmonic)
* <math>V_n</math> = RMS amplitude of nth harmonic (n = 2, 3, 4, ...)
* <math>N</math> = total number of harmonics analyzed
This represents the percentage of harmonic content relative to the fundamental.
==== Alternative Form (Total Distortion) ====
Some standards define THD as:
<math>
\text{THD} = \frac{\sqrt{\sum_{n=2}^{N} V_n^2}}{\sqrt{V_1^2 + \sum_{n=2}^{N} V_n^2}}
</math>
This normalizes to total RMS content (including fundamental). This is sometimes called '''THD+N''' (Total Harmonic Distortion + Noise).
===== Relationship: THD% vs THD =====
<math>
\text{THD\%} = \frac{\text{THD}}{\sqrt{1 - \text{THD}^2}} \times 100
</math>
For small distortions (THD < 0.1): <math>\text{THD\%} \approx 100 \times \text{THD}</math>
---
=== THD in Decibels ===
==== From Ratio ====
<math>
\text{THD}_{\text{dB}} = 20 \log_{10}\left(\frac{\sqrt{\sum_{n=2}^{N} V_n^2}}{V_1}\right)
</math>
==== From Percentage ====
<math>
\text{THD}_{\text{dB}} = 20 \log_{10}\left(\frac{\text{THD\%}}{100}\right)
</math>
===== Interpretation =====
* <math>\text{THD}_{\text{dB}} = -20 \text{ dB}</math> → <math>\text{THD\%} \approx 10\%</math>
* <math>\text{THD}_{\text{dB}} = -40 \text{ dB}</math> → <math>\text{THD\%} \approx 1\%</math>
* <math>\text{THD}_{\text{dB}} = -60 \text{ dB}</math> → <math>\text{THD\%} \approx 0.1\%</math>
Every -20 dB represents a factor of 10 reduction in THD%.
---
=== Implementation in THD Sweep Measurement ===
==== Calculation Functions ====
The application uses the following approach:
===== Python Implementation =====
<source lang="python">
import math
def compute_thd_percent(fundamental_v, harmonics_v):
    """
    Calculate THD as percentage.
    Args:
        fundamental_v: Fundamental amplitude (H1)
        harmonics_v: List of harmonic amplitudes [H2, H3, H4, ...]
    Returns:
        THD percentage (0-100+)
    """
    if not harmonics_v or not fundamental_v or fundamental_v == 0:
        return None
    rms_harmonics = math.sqrt(sum(h * h for h in harmonics_v))
    return (rms_harmonics / abs(fundamental_v)) * 100.0
def compute_thd_db(fundamental_v, harmonics_v):
    """
    Calculate THD in decibels.
    Args:
        fundamental_v: Fundamental amplitude (H1)
        harmonics_v: List of harmonic amplitudes [H2, H3, H4, ...]
    Returns:
        THD in dB (-200 to 0 dB)
    """
    if not harmonics_v or not fundamental_v or fundamental_v == 0:
        return None
    rms_harmonics = math.sqrt(sum(h * h for h in harmonics_v))
    ratio = rms_harmonics / abs(fundamental_v)
    return 20.0 * math.log10(ratio) if ratio > 0 else -200.0
</source>
===== Coherence Between DC1 and DC2 =====
The two DC inputs maintain mathematical coherence:
<math>
\text{THD}_{\text{dB}} = 20 \log_{10}\left(\frac{\text{THD\%}}{100}\right)
</math>
Example:
* If DC1 (%) = 5.5
* Then DC2 (dB) = 20 × log₁₀(5.5/100) = 20 × log₁₀(0.055) ≈ -25.18 dB
---
=== Measurement Configuration ===
==== Harmonic Analysis ====
The application measures up to '''N = 9 harmonics''' by default:
* '''H1''' (Fundamental): ~1 kHz to ~20 kHz (sweep dependent)
* '''H2-H9''' (Harmonics): 2× to 9× fundamental frequency
For a 1 kHz fundamental:
* H1 = 1.000 kHz
* H2 = 2.000 kHz
* H3 = 3.000 kHz
* H4 = 4.000 kHz
* ... up to
* H9 = 9.000 kHz
==== Display Zones ====
Both Max and Harmonic markers use:
* '''Interpolation Type 1''' (X-axis): Linear interpolation for frequency precision
* '''Display Zone Type 4''' (FFT magnitude): Standard magnitude spectrum
This ensures:
* Frequency accuracy to ~1 Hz (depending on FFT resolution)
* Amplitude accuracy to ~0.1 dB
---
=== Physical Quantities Configuration ===
The three DC Simulated inputs are configured with specific physical quantities:
{| class="wikitable"
|-
! DC Channel !! Physical Quantity !! Unit !! Formula !! Range
|-
| DC1 || Percentage || % || <math>\text{THD\%} = \frac{\sqrt{\sum V_n^2}}{V_1} \times 100</math> || 0 - 100%
|-
| DC2 || Ratio || dB || <math>20 \log_{10}(\text{ratio})</math> || -200 to 0 dB
|-
| DC3 || Frequency || Hz || <math>f_{\text{max}}</math> (from Max marker) || 0 - 40000 Hz
|}
The application queries '''GetSettingValues()''' to dynamically find the correct enum index for each physical quantity, ensuring compatibility across NVGate configurations.
---
=== THD Standards Reference ===
==== IEC 61000-3-2 (EMC - Harmonic Current) ====
For equipment <16A supply current, limits defined for harmonics up to 40th:
<math>
\text{Harmonic order } n: I_h \leq I_{\text{limit}}(n)
</math>
Common limits (Class A equipment):
* H3: 30% of I1
* H5: 10% of I1
* H7: 7% of I1
* H9: 3% of I1
==== Audio Industry Standards ====
* '''Professional Audio (AES)''': THD < 0.05% @ 1 kHz
* '''Hi-Fi''': THD < 0.1% @ 1 kHz, 20 Hz - 20 kHz
* '''Consumer Audio''': THD < 1% @ 1 kHz
* '''Basic Consumer''': THD < 5% @ 1 kHz
---
=== Measurement Uncertainty ===
The THD measurement uncertainty depends on:
* '''FFT Resolution''': <math>\Delta f = \frac{f_s}{N_{\text{FFT}}}</math>
* '''Windowing''': Choice of window function (Hann, Hamming, etc.)
* '''Interpolation''': Type 1 (X-axis) reduces frequency leakage
* '''Signal Stability''': Amplitude variation during sweep
For typical speaker measurements:
* Frequency uncertainty: ±2 Hz
* Amplitude uncertainty: ±0.5 dB
* THD uncertainty: ±2% (relative)
---
=== Examples ===
==== Example 1: Good Speaker (5% THD) ====
Given:
* H1 = 1.0 V (fundamental at 1 kHz)
* H2 = 0.05 V
* H3 = 0.02 V
* H4 = 0.01 V
* H5 = 0.005 V
Calculation:
<math>
\text{RMS}_{\text{harmonics}} = \sqrt{0.05^2 + 0.02^2 + 0.01^2 + 0.005^2}
= \sqrt{0.0025 + 0.0004 + 0.0001 + 0.000025}
= \sqrt{0.003025} \approx 0.055 \text{ V}
</math>
<math>
\text{THD\%} = \frac{0.055}{1.0} \times 100 = 5.5\%
</math>
<math>
\text{THD}_{\text{dB}} = 20 \log_{10}(0.055) \approx -25.18 \text{ dB}
</math>
'''Result:''' DC1 = 5.5% | DC2 = -25.18 dB
==== Example 2: Poor Speaker (20% THD) ====
Given:
* H1 = 1.0 V
* H2 = 0.15 V
* H3 = 0.08 V
* H4 = 0.05 V
* H5 = 0.03 V
<math>
\text{RMS}_{\text{harmonics}} = \sqrt{0.15^2 + 0.08^2 + 0.05^2 + 0.03^2}
\approx 0.18 \text{ V}
</math>
<math>
\text{THD\%} = 18\%
</math>
<math>
\text{THD}_{\text{dB}} = 20 \log_{10}(0.18) \approx -14.89 \text{ dB}
</math>
'''Result:''' DC1 = 18% | DC2 = -14.89 dB
---
=== References ===
* [https://en.wikipedia.org/wiki/Total_harmonic_distortion Wikipedia - THD]
* IEC 61000-3-2:2018 - Electromagnetic compatibility
* AES Recommended Practice for Measurements of Single-Channel and Stereo Analog Audio
* Typical Audio Specifications and Measurements - Analog Devices
---
'''Last Updated:''' 2026-04-15
'''Format:''' MediaWiki with LaTeX formulas

Revision as of 15:27, 15 April 2026

THD SWEEP MEASUREMENT - USER GUIDE

Master the art of measuring Total Harmonic Distortion with style

🎵 THD SWEEP MEASUREMENT
Professional Acoustic Testing Made Simple

---

Install

Dowload THD measurement :

THD sweep measurement April 2026

Install model

Put the model folder : "THD computation" on model database of NVgate. (By default : C:\OROS\NVGate data\Workbook Library\User\ )

⚡ QUICK START - 30 SECONDS

STEP ACTION
1️⃣ Launch Launch NVgate in connected mode and load the THD computation model Double-click THD_Sweep_Measurement.exe
2️⃣ Connect Put the sweep sine on channel 4️⃣ ; put the response on channel 1️⃣
3️⃣ Start Start the THD_Sweep_Measurement.exe and Click green ▶ START button
4️⃣ Monitor Watch 4 metrics update live , THD and frequency will also be injected on channels DC simulated of NVgate
5️⃣ Stop Click red ■ STOP button

That's it! Your first THD measurement is complete. You're now a certified acoustic engineer. (Not really, but it feels good.)

---


📊 Four Metric Cards

The heart of the interface. These four numbers tell the whole story:

📈
THD (dB)
📊
THD (%)
📡
Frequency

Fundamental
Harmonic distortion (log scale) Harmonic distortion (%) Current sweep point Signal strength
+5.42 dB 58.294 % 1234.56 Hz 5.0e-01 V

🎯 UNDERSTANDING YOUR RESULTS

THD (%) - The Easy Number

What is it? Percentage of unwanted harmonics in your signal.

Think of it this way:

  • THD 5% = 95% pure signal, 5% noise
  • THD 20% = 80% pure signal, 20% noise

The Quality Scale:

🌟 1% - 5% Excellent - Professional grade equipment
✅ 5% - 15% Good - Solid speaker performance
⚠️ 15% - 30% Acceptable - Consumer level equipment
❌ > 30% Poor - Time for an upgrade 🛠️

THD (dB) - The Technical Number

Same measurement as THD (%) but in decibels (logarithmic scale).

Quick Conversion Chart:

THD % THD dB Quality
1% -40 dB 🌟 Perfect
3% -30 dB ✅ Great
10% -20 dB ✅ Good
30% -10 dB ⚠️ Poor

---

⚙️ CONFIGURATION

When Do I Need to Change This?

Honest answer: Almost never.

The default settings work for 95% of users. Only change if your NVGate project has:

  • Different window names
  • Different marker numbers
  • Different DC input addresses

If you're not sure → Don't change anything. It works.

How to Access Configuration

Click on ▶ Configuration (section expands)

Important Settings

Setting Default When to Change
Window (sweep) Window2 Your sweep FFT has different name
Window (response) Window1 Your response FFT has different name
Number of harmonics 9 5 (faster), 15 (more detailed)

How to Apply Changes

  1. Modify field value
  2. Click Apply Configuration
  3. Log displays "Configuration applied" ✓
  4. Done!

---

💡 PRO TIPS

Tip 1: Start Simple

Always use default settings first. Change things later if needed.

Tip 2: Read the Log The log console tells you everything. It's your best friend.

Tip 3: Use Diagnostic When something's wrong, click "Run Diagnostic". It's like magic.

Tip 4: Multiple Measurements One measurement is interesting. Five measurements is scientific.

Tip 5: Document Results Take a screenshot or copy the final THD values. You'll forget otherwise.

---

❓ FREQUENTLY ASKED QUESTIONS

Q: I Have only one channels. Can i take the max marker on windows 1

A: Yes, on configuration, put windows 1 for window (sweep)

Q: Is THD 5% good?

A: For a speaker? Excellent! You can be proud of that equipment. 🎉

Q: Why does THD change with frequency?

A: Because speakers aren't perfect at all frequencies. Some frequencies cause more distortion than others. That's physics being weird.

Q: Can I use this on any speaker?

A: Yes! Desktop speakers, studio monitors, subwoofers, car speakers - if it's connected to NVGate, we can measure it.

Q: How many times should I measure?

A: Once for curiosity. Three times for reliability. Ten times if you're publishing a paper.

Q: Can I export the results?

A: Yes! Copy text from the log console and paste into Excel, Word, or wherever you need it.

Q: What if my project has different settings?

A: Use the Configuration panel to adjust. It's literally made for this.

Q: Does this work over WiFi?

A: No. It only works locally (same computer or local network). WiFi would add too much latency.

---

disclaimer

1) This program is delivered free of charge for NVGate V12. Support is not automatically provided on this tool.

2) For any other requests, please contact your local distributor or the OROS Customer Care department.

---

You're Ready!
Go measure some THD and make your speakers proud 🎵


THD: Mathematical Formulas and Theory

Standard THD Definition

THD as Percentage

The most common definition of THD is the ratio of RMS harmonic content to RMS fundamental:

Failed to parse (MathML with SVG or PNG fallback (recommended for modern browsers and accessibility tools): Invalid response ("Math extension cannot connect to Restbase.") from server "https://wikimedia.org/api/rest_v1/":): {\displaystyle \text{THD\%} = \frac{\sqrt{\sum_{n=2}^{N} V_n^2}}{V_1} \times 100 }

Where:

  • = RMS amplitude of fundamental (1st harmonic)
  • = RMS amplitude of nth harmonic (n = 2, 3, 4, ...)
  • = total number of harmonics analyzed

This represents the percentage of harmonic content relative to the fundamental.

Alternative Form (Total Distortion)

Some standards define THD as:

Failed to parse (MathML with SVG or PNG fallback (recommended for modern browsers and accessibility tools): Invalid response ("Math extension cannot connect to Restbase.") from server "https://wikimedia.org/api/rest_v1/":): {\displaystyle \text{THD} = \frac{\sqrt{\sum_{n=2}^{N} V_n^2}}{\sqrt{V_1^2 + \sum_{n=2}^{N} V_n^2}} }

This normalizes to total RMS content (including fundamental). This is sometimes called THD+N (Total Harmonic Distortion + Noise).

Relationship: THD% vs THD

Failed to parse (syntax error): {\displaystyle \text{THD\%} = \frac{\text{THD}}{\sqrt{1 - \text{THD}^2}} \times 100 }

For small distortions (THD < 0.1): Failed to parse (syntax error): {\displaystyle \text{THD\%} \approx 100 \times \text{THD}}

---

THD in Decibels

From Ratio

From Percentage

Failed to parse (syntax error): {\displaystyle \text{THD}_{\text{dB}} = 20 \log_{10}\left(\frac{\text{THD\%}}{100}\right) }

Interpretation
  • Failed to parse (syntax error): {\displaystyle \text{THD\%} \approx 10\%}
  • Failed to parse (syntax error): {\displaystyle \text{THD\%} \approx 1\%}
  • Failed to parse (syntax error): {\displaystyle \text{THD\%} \approx 0.1\%}

Every -20 dB represents a factor of 10 reduction in THD%.

---

Implementation in THD Sweep Measurement

Calculation Functions

The application uses the following approach:

Python Implementation

<source lang="python"> import math

def compute_thd_percent(fundamental_v, harmonics_v):

   """
   Calculate THD as percentage.
   Args:
       fundamental_v: Fundamental amplitude (H1)
       harmonics_v: List of harmonic amplitudes [H2, H3, H4, ...]
   Returns:
       THD percentage (0-100+)
   """
   if not harmonics_v or not fundamental_v or fundamental_v == 0:
       return None
   rms_harmonics = math.sqrt(sum(h * h for h in harmonics_v))
   return (rms_harmonics / abs(fundamental_v)) * 100.0


def compute_thd_db(fundamental_v, harmonics_v):

   """
   Calculate THD in decibels.
   Args:
       fundamental_v: Fundamental amplitude (H1)
       harmonics_v: List of harmonic amplitudes [H2, H3, H4, ...]
   Returns:
       THD in dB (-200 to 0 dB)
   """
   if not harmonics_v or not fundamental_v or fundamental_v == 0:
       return None
   rms_harmonics = math.sqrt(sum(h * h for h in harmonics_v))
   ratio = rms_harmonics / abs(fundamental_v)
   return 20.0 * math.log10(ratio) if ratio > 0 else -200.0

</source>

Coherence Between DC1 and DC2

The two DC inputs maintain mathematical coherence:

Failed to parse (syntax error): {\displaystyle \text{THD}_{\text{dB}} = 20 \log_{10}\left(\frac{\text{THD\%}}{100}\right) }

Example:

  • If DC1 (%) = 5.5
  • Then DC2 (dB) = 20 × log₁₀(5.5/100) = 20 × log₁₀(0.055) ≈ -25.18 dB

---

Measurement Configuration

Harmonic Analysis

The application measures up to N = 9 harmonics by default:

  • H1 (Fundamental): ~1 kHz to ~20 kHz (sweep dependent)
  • H2-H9 (Harmonics): 2× to 9× fundamental frequency

For a 1 kHz fundamental:

  • H1 = 1.000 kHz
  • H2 = 2.000 kHz
  • H3 = 3.000 kHz
  • H4 = 4.000 kHz
  • ... up to
  • H9 = 9.000 kHz

Display Zones

Both Max and Harmonic markers use:

  • Interpolation Type 1 (X-axis): Linear interpolation for frequency precision
  • Display Zone Type 4 (FFT magnitude): Standard magnitude spectrum

This ensures:

  • Frequency accuracy to ~1 Hz (depending on FFT resolution)
  • Amplitude accuracy to ~0.1 dB

---

Physical Quantities Configuration

The three DC Simulated inputs are configured with specific physical quantities:

DC Channel Physical Quantity Unit Formula Range
DC1 Percentage % Failed to parse (syntax error): {\displaystyle \text{THD\%} = \frac{\sqrt{\sum V_n^2}}{V_1} \times 100} 0 - 100%
DC2 Ratio dB -200 to 0 dB
DC3 Frequency Hz (from Max marker) 0 - 40000 Hz

The application queries GetSettingValues() to dynamically find the correct enum index for each physical quantity, ensuring compatibility across NVGate configurations.

---

THD Standards Reference

IEC 61000-3-2 (EMC - Harmonic Current)

For equipment <16A supply current, limits defined for harmonics up to 40th:

Common limits (Class A equipment):

  • H3: 30% of I1
  • H5: 10% of I1
  • H7: 7% of I1
  • H9: 3% of I1

Audio Industry Standards

  • Professional Audio (AES): THD < 0.05% @ 1 kHz
  • Hi-Fi: THD < 0.1% @ 1 kHz, 20 Hz - 20 kHz
  • Consumer Audio: THD < 1% @ 1 kHz
  • Basic Consumer: THD < 5% @ 1 kHz

---

Measurement Uncertainty

The THD measurement uncertainty depends on:

  • FFT Resolution:
  • Windowing: Choice of window function (Hann, Hamming, etc.)
  • Interpolation: Type 1 (X-axis) reduces frequency leakage
  • Signal Stability: Amplitude variation during sweep

For typical speaker measurements:

  • Frequency uncertainty: ±2 Hz
  • Amplitude uncertainty: ±0.5 dB
  • THD uncertainty: ±2% (relative)

---

Examples

Example 1: Good Speaker (5% THD)

Given:

  • H1 = 1.0 V (fundamental at 1 kHz)
  • H2 = 0.05 V
  • H3 = 0.02 V
  • H4 = 0.01 V
  • H5 = 0.005 V

Calculation:

Failed to parse (syntax error): {\displaystyle \text{THD\%} = \frac{0.055}{1.0} \times 100 = 5.5\% }

Failed to parse (MathML with SVG or PNG fallback (recommended for modern browsers and accessibility tools): Invalid response ("Math extension cannot connect to Restbase.") from server "https://wikimedia.org/api/rest_v1/":): {\displaystyle \text{THD}_{\text{dB}} = 20 \log_{10}(0.055) \approx -25.18 \text{ dB} }

Result: DC1 = 5.5% | DC2 = -25.18 dB

Example 2: Poor Speaker (20% THD)

Given:

  • H1 = 1.0 V
  • H2 = 0.15 V
  • H3 = 0.08 V
  • H4 = 0.05 V
  • H5 = 0.03 V

Failed to parse (MathML with SVG or PNG fallback (recommended for modern browsers and accessibility tools): Invalid response ("Math extension cannot connect to Restbase.") from server "https://wikimedia.org/api/rest_v1/":): {\displaystyle \text{THD\%} = 18\% }

Failed to parse (MathML with SVG or PNG fallback (recommended for modern browsers and accessibility tools): Invalid response ("Math extension cannot connect to Restbase.") from server "https://wikimedia.org/api/rest_v1/":): {\displaystyle \text{THD}_{\text{dB}} = 20 \log_{10}(0.18) \approx -14.89 \text{ dB} }

Result: DC1 = 18% | DC2 = -14.89 dB

---

References

  • Wikipedia - THD
  • IEC 61000-3-2:2018 - Electromagnetic compatibility
  • AES Recommended Practice for Measurements of Single-Channel and Stereo Analog Audio
  • Typical Audio Specifications and Measurements - Analog Devices

---

Last Updated: 2026-04-15

Format: MediaWiki with LaTeX formulas