It is disappointing to see many people using envelope detection to receive AM broadcasts on SDR shortwave receivers, as it is a low quality AM demodulation method.
Sometimes SDRs lack good AM demodulators - while in other cases users ignore the more advanced options available to them.
Envelope Detection
Using envelope detectors for AM demodulation results in:
- Higher noise and distortion levels
- Reduced speech intelligibility
- Degraded music quality
- More noise bars on image modes like MFSK and SSTV (on AM transmissions)
- More errors in data communications like digital modes (on AM transmissions)
Envelope detection is a very old and very low performance method of detecting AM signals. It is not suitable for fading shortwave signals because carrier fade causes severe distortion on these types of detectors. Envelope detectors also have poor noise and distortion performance even on good signals.
An envelope detector works by rectifying the AM signal. This frequency mixes the AM signal with itself - causing the carrier to mix with the sideband frequencies, thus recovering the audio.
But this envelope based mixing creates a variety of products:
- The carrier mixes with the sidebands, producing the original modulation frequencies [OK]
- The carrier mixes with the carrier, producing a DC offset [OK]
- The carrier mixes with the noise, producing noise [unavoidable]
- The sidebands mix with the sidebands, producing harmonic and IM distortion [BAD]
- The sidebands mix with the noise, producing extra noise [BAD]
- The noise mixes with the noise, producing extra noise [BAD]
Synchronous Detection
Any AM receivers used to receive fading shortwave signals should be using more modern methods that are not severely degraded by carrier fade. AM Synchronous detection solves this problem.
An AM-Sync detector produces these products:
- The carrier mixes with the sidebands, producing the original modulation frequencies
- The carrier mixes with the carrier, producing a DC offset
- The carrier mixes with the noise, producing noise
AM Synchronous demodulation is done by regenerating the carrier wave, then mixing the incoming AM signal with this clean carrier wave.
The PLL
A common way to do carrier regeneration is to phase lock an oscillator to the AM carrier using a PLL. But a PLL can lose carrier lock during signal fades - right when it's most important for it to work!
The Squaring Detector
A better way to recover the carrier is to use a squaring detector. The squaring detector multiplies the AM signal with itself to recover a frequency doubled carrier (2F).
This works because:
- 1F carrier + 1F carrier = 2F carrier
- LSB + USB = 2F carrier (plus other distortion products)
The double-frequency carrier is the strongest product of this process, so it is easy to use filtering and limiting to make a good carrier signal from it.
The double-frequency carrier is then halved in frequency to recover the original carrier frequency. In an analog circuit this is done by a digital frequency divider, but to avoid aliasing in DSP it must be done by a linear process such as frequency mixing. The frequency mixing is done in a regenerative feedback loop, where the wanted mixing product 1F is filtered, Hilbert clipped, and mixed with the 2F carrier to create the wanted 1F difference product.
A regenerative mixer is a bootstrapped process. Initially there is zero output, so there is no output from the 2F to 1F mixer. Much like an oscillator, the process must be kickstarted. This is easiest to do by adding extremely low level white noise. The white noise causes an improvised 1F signal to pass through the 1F output filter, thus causing a 2F to 1F mixer output to be generated. This poor quality, noisy 1F signal is rapidly improved by the Q-multiplier effect of the feedback via the filter and limiter. The 1F carrier suddenly grows to a clean, full amplitude signal.
This good 1F carrier signal is then multiplied with the AM signal to produce the recovered audio. Since this is a synchronous process, it is also useful to split the signal into separate I and Q or LSB and USB audio channels for later processing. This can be used to further reduce fading and noise on the signal.
Carrier Phase Recovery
Since the squaring process doubles the carrier frequency, it's original phase becomes ambiguous. This means the demodulator could lock in either 0 or 180 degree (inverted) phase. The recovered audio phase can be corrected by using the lowpass filtered demodulated IQ output to rotate the phase of the mixing carrier to always produce the correct phase. This is done by inserting another pair of IQ mixers - one to rotate the mixing carrier, and one to mix the AM with the phase corrected carrier to produce the corrected output signal.
Sideband Phase Correction
The final demodulated IQ (amplitude and phase), or LSB and USB audio signals can then be phase-aligned. This is done by splitting the input signals into bands using a filterbank, and measuring the phase angle of each band on each channel using the "atan2" function. The phase is unwrapped and the relative phase difference is found. This phase difference signal is then scaled by 0.5 (because both channels are being corrected), is lowpass filtered, and converted to an IQ mixing signal by cos and sin. This IQ mixing signal is then used to rotate each IQ pair of each filtered band in opposite directions so they are brought into phase alignment. On good quality AM signals using IQ (instead of LSB/USB), the Q channel will be only noise. In this case, the noise should be suppressed by a noisegate to avoid SNR degradation. If there is significant multipath on the signal, the Q channel will contain the sideband difference.
The two signal paths into the phase corrector can be either demodulated IQ (amplitude/phase) or ISB (LSB/USB) audio. Using ISB increases the phase shifts because a Hilbert transform is then needed. ISB is useful if there is interference on one sideband, because that sideband can be filtered to remove it. The extra phase shift needs to be cancelled by the audio phase compensation stage.
After phase alignment, the two channels can be combined into a single channel. Since the phase is aligned, there is no cancellation of any signal content when the two channels are added together - so the recovered SNR is the best it can be. This improves speech, music and data modes.
The rate-of-change of the phase correction is limited by the lowpass filter in the phase difference measuring path. This avoids generating distortion products from any high frequency noise or distortion that may be present on the phase measurement signal. The bandwidth of this filter needs to be wide enough to follow the phase change from fading. Ideally, lookahead should be used on the phase corrector stage to allow the smoothest correction of propagation phase shifts. Lookahead adds a fixed delay to the signal to match the delay of the lowpass filter, but it increases latency and memory requirements.
For speech and music modes, the phase correction bandwidth needs to be carefully chosen for the least audible side effects (perhaps 1Hz).
For data modes, performance is probably best with a faster phase corrector action (perhaps 5Hz).
Audio Phase Compensation
For data decoding, an important part of phase alignment is to phase compensate the demodulated audio. Phase compensation needs to remove the frequency-dependent delays introduced by any filters in the signal path, such as the demodulator and phase corrector filters, and the Hilbert transform used for phase measurement and ISB matrixing. It should also remove the known phase shift caused by the transmission equipment, unless this was already done in program production. The phase compensation can be done last, after phase alignment and summing to a single channel.
Some tests using these techniques have been done on weak, distant IQ recordings of EasyDRF data signals from the RNEI program. The improved SNR often makes the difference between a good decode and no decode.
It is planned to release a high performance AM demodulator using these methods, as soon as it is possible to compile a working version into an audio plugin format - such as VST.
YouTube AM-Sync Demonstration Videos:
Envelope Detector and AM-Sync comparison
ISB Squaring Demodulator video 1
ISB Squaring Demodulator video 2
Sideband Phase Correction
When AM-Sync might not work well...
- Transmitters with high carrier phase noise can sound "rumbly" on AM-Sync.
- Transmitters with poor frequency stability can make it hard for an AM-Sync detector to acquire or stay locked.
- Transmitters that have a phase modulated carrier (like BBC 198kHz) might need a specially modified detector.
- Fast Doppler shift from Geomagnetic storms can make it hard for an AM-Sync detector to stay locked.