This file is indexed.

/usr/share/audacity/plug-ins/limiter.ny is in audacity-data 2.2.1-1.

This file is owned by root:root, with mode 0o644.

The actual contents of the file can be viewed below.

  1
  2
  3
  4
  5
  6
  7
  8
  9
 10
 11
 12
 13
 14
 15
 16
 17
 18
 19
 20
 21
 22
 23
 24
 25
 26
 27
 28
 29
 30
 31
 32
 33
 34
 35
 36
 37
 38
 39
 40
 41
 42
 43
 44
 45
 46
 47
 48
 49
 50
 51
 52
 53
 54
 55
 56
 57
 58
 59
 60
 61
 62
 63
 64
 65
 66
 67
 68
 69
 70
 71
 72
 73
 74
 75
 76
 77
 78
 79
 80
 81
 82
 83
 84
 85
 86
 87
 88
 89
 90
 91
 92
 93
 94
 95
 96
 97
 98
 99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
;nyquist plug-in
;version 4
;type process
;categories "http://lv2plug.in/ns/lv2core/#DynamicsPlugin"
;name "Limiter..."
;manpage "Limiter"
;debugbutton false
;action "Limiting..."
;preview enabled
;author "Steve Daulton"
;copyright "Released under terms of the GNU General Public License version 2"

;; limiter.ny by Steve Daulton November 2011, updated May 2015.
;; Released under terms of the GNU General Public License version 2:
;; http://www.gnu.org/licenses/old-licenses/gpl-2.0.html 
;;
;; For information about writing and modifying Nyquist plug-ins:
;; http://wiki.audacityteam.org/wiki/Nyquist_Plug-ins_Reference

;control type "Type" choice "Soft Limit,Hard Limit,Soft Clip,Hard Clip" 0
;control gain-L "Input Gain (dB)\nmono/Left" real "" 0 0 10
;control gain-R "Input Gain (dB)\nRight channel" real "" 0 0 10
;control thresh "Limit to (dB)" real "" -3 -10 0
;control hold "Hold (ms)" real "" 10 1 50
;control makeup "Apply Make-up Gain" choice "No,Yes" 0

(if (not (boundp 'type))
    (setf type 0))

(if (boundp 'gain-L)
    (setf gain-L (db-to-linear gain-L))
    (setf gain-L 1))

(if (boundp 'gain-R)
    (setf gain-R (db-to-linear gain-R))
    (setf gain-R 1))

(if (boundp 'thresh)
    (setf thresh (db-to-linear thresh))
    (setf thresh (db-to-linear -3.0)))

(if (not (boundp 'hold))
    (setf hold 10.0))

(if (boundp 'makeup)
    (if (= makeup 1) (setf makeup T) (setf makeup nil))
    (setf makeup nil))

;;; brick wall limiter
(defun hardlimit (sig limit hld)   
  (let* ((time (/ hld 3000.0))  ; lookahead time (seconds)
         (samples (round (* time *sound-srate*)))  ; lookahead in samples
         (peak-env (get-env sig samples time limit)))
    (mult sig
      (snd-exp 
        (mult -1 (snd-log peak-env))))))

;;; Envelope follower for brick wall limiter
(defun get-env (sig step lookahead limit)
  (let* ((sig (mult (/ limit) sig))
         (pad-time (* 3 lookahead))       ; padding required at start (seconds)
         (pad-s (* 3 step))               ; padding smaples
         (padding (snd-const (peak sig pad-s) 0 *sound-srate* pad-time))
         (peak-env (snd-avg sig (* 4 step) step OP-PEAK)))
    (extract 0 1
      (s-max 1 
        (sim padding
          (at-abs pad-time (cue peak-env)))))))

(defun softlimit (sig thresh hld)
  (let* ((sig (hardlimit sig 1 hold))
         (step (truncate (* (/ hld 3000.0) *sound-srate*)))
         (waveshape (snd-avg sig (* 4 step) step op-peak))
         (env (sum thresh (mult thresh (diff 1 waveshape))))
         (env (clip env 1))
         (offset (/ (* 3 step) *sound-srate*))
         (initial (peak sig (* 2 step)))
         (pause-lev (sum thresh (mult thresh (diff 1 initial))))
         (pause-lev (clip pause-lev 0.9))
         (pause (snd-const pause-lev 0 *sound-srate* offset)))
    (setf env 
      (sim
         pause
         (at-abs offset (cue env))))
    (mult sig env)))


(defun soft-clip-table ()
"Lookup table for soft clipping wave-shaper"
  (abs-env
    (sound-srate-abs 44100
      (Control-srate-abs 44100
        (let* ((knee (- 1 (/ 1.0 pi)))
               (kcurve (mult knee (osc (hz-to-step (/ (* 4 knee))) knee)))
               (ikcurve (mult knee (osc (hz-to-step (/ (* 4 knee))) knee *sine-table* -90)))
               (lin (pwlv -0.5 knee -0.5
                               (+ knee (/ 2.0 pi)) 0.5 
                               2.0 0.5
                               2.0 (+ 0.5 knee)
                               2.1 (+ 0.5 knee))))
          (mult (/ 2.0 pi)
            (sim
              (at-abs 0 (cue ikcurve))
              (at-abs 0 (cue lin))
              (at-abs (+ knee (/ 2.0 pi)) (cue kcurve)))))))))

(defun soft-clip (sig)
  (let* ((knee (- 1 (/ 1.0 pi)))
         (clip-level (* (+ 0.5 knee)(/ 2.0 pi)))
         (sig (mult clip-level (/ thresh) sig)))
    (if makeup
        (mult 0.999
              (/ clip-level)
              (shape sig (soft-clip-table) 1.0))
        (mult thresh
              (/ clip-level)
              (shape sig (soft-clip-table) 1.0)))))


(defun makupgain (sig)
  (if makeup
      (mult (/ 0.999 thresh) sig) ;keep below 0dB
      sig))

;; Pre-gain
(setf *track*
  (if (arrayp *track*)
      (vector (mult (aref *track* 0) gain-L)
              (mult (aref *track* 1) gain-R))
      (mult *track* gain-L)))


(case type
  (0 (makupgain (multichan-expand #'softlimit *track* thresh hold)))
  (1 (makupgain (multichan-expand #'hardlimit *track* thresh hold)))
  (2 (soft-clip *track*))
  (T (makupgain (clip *track* thresh))))