This is a AI generated python script for presenting FFT and IMD-INTERMODULATION DISTORTION- using a test record LB202.
Test track has 315 Hz and 3150hz in 4:1 ration. no RIAA eq. Use at own risk, AI can help you modify it to other test frequecies, like 60Hz and 7000hz
Rename .txt to .py
DO NOT ask me to explain anything, it is all AI genereted on my request. I do not have test files to verify the results..use at own risk
This result is in the same order as a simple visual/manual sideband evaluation gives, but lower the REW calculation reports. I guess it can work to se relative changes ,but not absolute correct values
The first file is based in amplitude modulation effects , the second is based on spectrum FFT more like REW does
but the script dos this-using average funtamentals ,funny. I thought it should be relative to F2 the 3150hz
The IMD‐percentages are always computed from the
linear amplitude ratios, not directly from the dBFS values. Here’s the recipe:
- We measure four linear amplitudes from the FFT:
• A₁ = amp at f₁ (Hz)
• A₂ = amp at f₂ (Hz)
• A_diff = amp at |f₂–f₁| (Hz)
• A_sum = amp at f₁+f₂
- We pick a reference A_ref for dBFS (in our script that’s max(A₁,A₂)), and compute dBFS:
dBFS_x = 20·log₁₀(A_x / A_ref)
- We form the average fundamental amplitude:
fund_avg = (A₁ + A₂) / 2
- The 2nd-order IMD percentages are then
IMD_diff% = 100·(A_diff / fund_avg)
IMD_sum% = 100·(A_sum / fund_avg)
Because Aₓ/fund_avg is a pure linear ratio, the printed “0.995%” comes from:
- f₂ @ –17.7 dBFS ⇒ A₂ = 10^(–17.7/20) ≃ 0.1337
- f₁ is at 0 dBFS ⇒ A₁ = 1.0
- ⇒ fund_avg = (1.0 + 0.1337)/2 = 0.56685
- diff @ –45.0 dBFS ⇒ A_diff = 10^(–45.0/20) ≃ 0.00562
⇒ IMD_diff% = 100·(0.00562 / 0.56685) ≃ 0.992% → ≈ 0.995%
Likewise for the sum sideband:
- sum @ –36.4 dBFS ⇒ A_sum = 10^(–36.4/20) ≃ 0.0151
⇒ IMD_sum% = 100·(0.0151 / 0.56685) ≃ 2.66% → ≈ 2.684%
In short, dBFS just tells you how big each Aₓ is relative to the loudest fundamental. The IMD% is then the linear ratio of the sideband amplitude to the average fundamental amplitude, times 100%.
doing it relative to F2 increases % of course
── Left Channel ────relative to f2 3150hz─────────────────────────────────────
f1 @ 316.57 Hz : 0.0 dBFS
f2 @ 3140.34 Hz : -17.7 dBFS
diff @ 2827.59 Hz : -45.0 dBFS IMD_diff% = 4.299%
sum @ 3456.74 Hz : -36.4 dBFS IMD_sum% = 11.593%
Avg IMD% = 7.946%
── Right Channel ────relative to f2 3150hz─────────────────────────────────────
f1 @ 316.57 Hz : 0.0 dBFS
f2 @ 3140.34 Hz : -17.8 dBFS
diff @ 2827.83 Hz : -37.6 dBFS IMD_diff% = 10.200%
sum @ 3456.84 Hz : -31.8 dBFS IMD_sum% = 19.782%
Avg IMD% = 14.991%
f1 @ 316.57 Hz : 0.0 dBFS
f2 @ 3140.34 Hz : -17.7 dBFS
diff @ 2827.59 Hz : -45.0 dBFS IMD_diff% = 0.995%
sum @ 3456.74 Hz : -36.4 dBFS IMD_sum% = 2.684%
Avg IMD% = 1.840%
── Right Channel ────relative to average level of F1 and F2─────────
f1 @ 316.57 Hz : 0.0 dBFS
f2 @ 3140.34 Hz : -17.8 dBFS
diff @ 2827.83 Hz : -37.6 dBFS IMD_diff% = 2.338%
sum @ 3456.84 Hz : -31.8 dBFS IMD_sum% = 4.534%
Avg IMD% = 3.436%