Help with Plugin to normalize a highly abnormal track

I have an audio track that is an aggregate of multiple tracks, and the amplitude on the combined track is all over the place, even on the individual tracks themselves.

I came up with the idea, right/wrong/indifferent, to normalize the track in chunks of time, instead of running normal normalization that processes the track as a whole so that way it will increase and decrease the amplitude where it needs to.

using the following script as a roadmap is someone able to get me home by adding the pieces to normalize the chunk at start-time though end-time.

$nyquist plug-in
$version 4
$type process
$preview enabled
$name (_ "Chunk Normalize Track")
$debugbutton false
$author (_ "Squirre1")
$release 2024.12.27.22
$copyright (_ "GNU General Public License v2.0")

;; License: GPL v2
;; http://www.gnu.org/licenses/old-licenses/gpl-2.0.html
;;
;; For information about writing and modifying Nyquist plug-ins:
;; https://wiki.audacityteam.org/wiki/Nyquist_Plug-ins_Reference

;; User Inputs
$control LOGFILE (_ "Log File") file (_ "Select a file") "C:/Users/Squirre1/Desktop/SampleTrack.log" (((_ "Log file") (log LOG)) ((_ "All files") (""))) "save,overwrite"
$control CHUNKDURATION (_ "Chunk Duration (seconds)") float "" 60 1 3600

;; Initialize Log File
(setq fp (open LOGFILE :direction :output))
(defun log-message (message)
  (print "Called: log-message")
  (when fp
    (format fp "~a~%" message)))

;;; ##### Log Formating Examples
;(log-message "Line 1: Script started")
;(log-message (format nil "Line 2: x = ~a" x))
;;; ##### Screen Formating Examples
;(print "Line 1: Script started")
;(print (format nil "Line 2: x = ~a" x))

;;; ##### Sample code with output
;(print "Line 1: Script started")
;(setf x 2)
;(print (format nil "Line 2: x = ~a" x))

;;; ##### Initializing Functions
;;;; Function to process a slice of audio
(defun process-slice (slice)
  (print "process chunk normalization here"))

;;;; Process track in chunks
(defun process-chunks (track chunk-duration)
  (if (= track_totalchunks (truncate track_totalchunks))
      (progn
		(print "track_totalchunks is whole")
		(setq chunks_toproc track_totalchunks))
	  (progn
		(print (format nil "Total Chunks + 1: ~a" (+ 1 (truncate track_totalchunks)) ))
		(setq chunks_toproc (+ 1 (truncate track_totalchunks))))
  )
  (dotimes (i chunks_toproc)
    (+ i 1)
    (print (format nil "I: ~a" i ))
    (setq start-time (* i chunk-duration))
    (setq end-time (min (* (1+ i) chunk-duration) track_totalseconds))
;;    (setq start-sample (truncate (* start-time track_samplerate)))
;;    (setq end-sample (truncate (* end-time track_samplerate)))
;;    (setq slice (extract-abs start-sample end-sample track))
    (print (format nil "Processing Chunk ~a: start-time: ~a, end-time: ~a" i start-time end-time))
;;    (log-message (format nil "Processing Chunk ~a: Start: ~a samples, End: ~a samples" i start-sample end-sample))
;;    (process-slice slice)
  )
)


;;; ##### Initializing Variable
(setq track_totalsamples len)
  (print (format nil "track_totalsamples: ~a" track_totalsamples ))
(setq track_samplerate (truncate *sound-srate*))
  (print (format nil "track_samplerate: ~a" track_samplerate ))
(setq track_totalseconds (/ len (truncate *sound-srate*)))
  (print (format nil "track_totalseconds: ~a" track_totalseconds ))
(setq track_totalchunks (/ (/ len (truncate *sound-srate*)) CHUNKDURATION))
  (print (format nil "track_totalchunks: ~a" track_totalchunks ))


(if (arrayp *track*)
    (progn
      (print "Processing Left Track")
      (process-chunks (aref *track* 0) CHUNKDURATION)
      (print "Processing Right Track")
      (process-chunks (aref *track* 1) CHUNKDURATION))
    (process-chunks *track* CHUNKDURATION))


;; Close the log file
(close fp)

TIA

Squirre1

Try (legacy?) limiter : threshold -2dB, 10ms, no make-up gain.