You can do that via the Nyquist Prompt effect Nyquist Prompt - Audacity Manual
Nyquist is a scripting (programming) language for audio that is built into Audacity.
Nyquist “scripts” are written as plain text, and can be run via the Nyquist Prompt, or made into “plug-in” effects. Several Nyquist plug-in effects are included with Audacity (Adjustable Fade, High Pass Filter, Low Pass Filter, Notch Filter, Vocal Reduction and Isolation, and others), and many optional Nyquist plug-ins are available from the Audacity wiki (Missing features - Audacity Support) and from this forum (Nyquist - Audacity Forum).
Here’s a script for the Nyquist Prompt that will apply a sweeping 6 dB per octave (first order) low-pass filter from 20 kHz (assuming that the sample rate is at least 40 kHz) down to 300 Hz:
;version 4
(lp *track* (pwlv (min 20000 (/ *sound-srate* 2)) 1 300))
For a steeper filter, the effect can be repeated, or the filter code can be “nested” like this:
;version 4
(lp
(lp
(lp *track* (pwlv (min 20000 (/ *sound-srate* 2)) 1 300))
(pwlv (min 20000 (/ *sound-srate* 2)) 1 300))
(pwlv (min 20000 (/ *sound-srate* 2)) 1 300))
A slight variation that sweeps logarithmically:
;version 4
(lp
(lp
(lp *track* (pwev (min 20000 (/ *sound-srate* 2)) 1 300))
(pwev (min 20000 (/ *sound-srate* 2)) 1 300))
(pwev (min 20000 (/ *sound-srate* 2)) 1 300))
and a version that has controls and “loops” through the filter:
;version 4
;control start-hz "Initial frequency (kHz)" float "" 20 1 20
;control end-hz "Final frequency (Hz)" float "" 300 0 1000
;control iter "Number of times to repeat the filter" int "" 2 1 10
(let* ((start-hz (min (* 1000 start-hz) (/ *sound-srate* 2)))
(slide (pwev start-hz 1 end-hz)))
(dotimes (i iter *track*)
(setf *track* (lp *track* slide))))