From e2e4d34f30e0742ce4bf31ba708fb8761c2554b3 Mon Sep 17 00:00:00 2001 From: Stan Grams Date: Tue, 3 Mar 2026 01:55:30 +0100 Subject: [PATCH] [fix](trx-backend-soapysdr): reduce AM demod distortion Remove half-wave clipping from the AM coherent detector output and slow the carrier-reference tracking to reduce audible distortion. Co-authored-by: Stan Grams Signed-off-by: Stan Grams --- .../trx-backend/trx-backend-soapysdr/src/demod/am.rs | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/src/trx-server/trx-backend/trx-backend-soapysdr/src/demod/am.rs b/src/trx-server/trx-backend/trx-backend-soapysdr/src/demod/am.rs index 8c31e36..10293f0 100644 --- a/src/trx-server/trx-backend/trx-backend-soapysdr/src/demod/am.rs +++ b/src/trx-server/trx-backend/trx-backend-soapysdr/src/demod/am.rs @@ -12,7 +12,7 @@ use num_complex::Complex; /// the conjugate reference and take the in-phase projection. pub(super) fn demod_am(samples: &[Complex]) -> Vec { const EPSILON: f32 = 1.0e-12; - const REF_BLEND: f32 = 0.08; + const REF_BLEND: f32 = 0.02; let mut out = Vec::with_capacity(samples.len()); let mut carrier_ref = Complex::new(1.0_f32, 0.0); @@ -36,7 +36,7 @@ pub(super) fn demod_am(samples: &[Complex]) -> Vec { // Project the original signal onto the limiter-derived carrier phase. let mixed = sample * carrier_ref.conj(); - out.push(mixed.re.max(0.0)); + out.push(mixed.re); } out