SAM modes have DC offset from AM carrier [fixed in v1.559]

edited September 15 in Problems Now Fixed

SAM, SAL, SAU, SAS and QAM modes need DC blocking (highpass filtering) added to remove the DC offset from the demodulated AM carrier.

The DC offset produced by the carrier reduces the dynamic range available on the audio output, and it can cause other problems.

DC blocking is very simple, and can be added as a 1-pole highpass filter.

The required code for a single audio channel would look something like this:

------

//In = new input sample

//Out = new output sample

//Inp = previous input sample

//Outp = previous output sample

//0.995 = R factor

Out = In - Inp + (0.995 * Outp); //compute new output sample

Inp = In;  //save the input sample for next computation

Outp = Out; //save the output sample for next computation

------

This highpass filter needs to be added to the audio path for each (stereo) output audio channel when in the SAM modes. It should probably be placed in the SAM_demod.cpp file.

Since there are two audio outputs, this means the filter needs to be added in a way that makes it independent for the Left and Right channels.

One way to do this is to write two versions, with each of the memory variables marked as Left and Right.

Another way might be to write it as a function - as long as the compiler generates separate memory variables for each instance (for Left and Right).

It is unknown how this will interact with the FADE_LEVELER in the SAM_demod.cpp code.

The example code was from here:

https://www.dsprelated.com/freebooks/filters/DC_Blocker.html

Daz

Comments

  • Thanks Daz.

    This is quite possible. I pulled the wdsp stuff out of the source code from the Teensy-ConvolutionSDR project. Unfortunately that project consists of a single monolithic 19,000 line source file. So I may have missed that there is a DC block in the data path for the synchronous modes. The Kiwi AM demod certainly includes one.

    I'll add this for the next release.

  • jksjks
    edited September 6

    Yeah, so the Teensy-ConvolutionSDR data path definitely does not have a DC block for their wdsp-based SAM modes (but do for AM). So that explains the current situation.

  • There is a fix in the v1.559 release that just went out. It seems to work as shown by this audio capture. DC block engaged during the later half of the recording. See the new "SAM options" menu on the audio tab of the main control panel. Still to be checked against MWBC signals for interaction with the fade leveler code etc.



  • Thanks John,

    I'll try to run some tests on it...

    Looks good so far.

    Daz

  • Are the SAM options only supposed to change in SAM mode?

    In SAL, SAU, SAS and QAM modes the menu causes no change - it keeps using the setting from SAM mode.

    This was confusing at first...

    (Firefox 104.0.2 64-bit Win 7)

  • Yeah, looks like a bug. Fix in the next release which should be soon.

Sign In or Register to comment.