AM Demodulation

I’ve searched the forum looking for the answer to this one and found similar topics but nothing exactly the same.

I have a WAV file with audio up to about 8 kHz and also what looks to be AM modulated audio - with both sidebands present and a carrier frequency of 20 kHZ (Project rate is 96 kHz).

The currently audible sub 8 kHz stuff can be discarded but I would like to recover - and listen to - the AM modulated audio.

I have done the easy bit and high pass filtered the track but do not know how to use Audacity/Nyquist for the demodulation (is it as simple as multiplying by the carrier frequency?)

Can anybody help with the Nyquist code required to produce an audible signal within Audacity?

(Audacity 2.1.2 on Windows 10)

Thanks.

Pretty much so. You would probably also want to use a low pass filter to remove the carrier after demodulating.

Long hand (version 4 syntax)

;version 4
(setf cf 8000) ; the carrier frequency
(let ((demod (mult *track* (hzosc cf))))
  (lowpass8 demod cf))

Short version (also version 4 syntax. Ensure that “legacy syntax” is NOT selected in the Nyquist Prompt):

(lowpass8 (mult *track* (hzosc 8000)) 8000)

Thank you Steve - that worked a treat!