1
0
mirror of https://github.com/cookiengineer/audacity synced 2025-12-05 08:10:17 +01:00

Bug 2336. Work around issue in Noise Gate.

This commit is contained in:
SteveDaulton
2020-02-24 11:21:49 +00:00
parent d748c0816a
commit b651984b87

View File

@@ -24,10 +24,11 @@ $control low-cut (_ "Apply Low-Cut filter") choice ((_ "No")
("10Hz" (_ "10Hz 6dB/octave")) ("10Hz" (_ "10Hz 6dB/octave"))
("20Hz" (_ "20Hz 6dB/octave"))) ("20Hz" (_ "20Hz 6dB/octave")))
0 0
$control gate-freq (_ "Gate frequencies above") float (_ "kHz") 0 0 10 ;; Work around bug 2336.
$control level-reduction (_ "Level reduction") float (_ "dB") -12 -100 0 $control gate-freq (_ "Gate frequencies above (kHz)") float "" 0 0 10
$control threshold (_ "Gate threshold") float (_ "dB") -48 -96 -6 $control level-reduction (_ "Level reduction (dB)") float "" -12 -100 0
$control attack (_ "Attack/Decay") float (_ "milliseconds") 250 10 1000 $control threshold (_ "Gate threshold (dB)") float "" -48 -96 -6
$control attack (_ "Attack/Decay (ms)") float "" 250 10 1000
; Global variables ; Global variables
@@ -42,15 +43,17 @@ $control attack (_ "Attack/Decay") float (_ "milliseconds") 250 10 1000
(defun error-check () (defun error-check ()
(when (>= freq (* *sound-srate* 0.45)) ;10% below Nyquist should be safe maximum. (when (>= freq (* *sound-srate* 0.45)) ;10% below Nyquist should be safe maximum.
(throw 'err (format nil (_ "Error.~%~ ;; Work around bug 2012.
\"Gate frequencies above: ~s kHz\"~%~ (throw 'err (format nil (_ "Error.
is too high for selected track.~%~ \"Gate frequencies above: ~s kHz\"
is too high for selected track.
Set the control below ~a kHz.") Set the control below ~a kHz.")
gate-freq gate-freq
(roundn (* 0.00045 *sound-srate*) 1)))) (roundn (* 0.00045 *sound-srate*) 1))))
(when (< len 100) ;100 samples required (when (< len 100) ;100 samples required
(throw 'err (format nil (_ "~%Insufficient audio selected.~%~ ;; Work around bug 2012.
Make the selection longer than ~a ms.~%") (throw 'err (format nil (_ "~%Insufficient audio selected.
Make the selection longer than ~a ms.")
(round-up (/ 100000 *sound-srate*)))))) (round-up (/ 100000 *sound-srate*))))))
@@ -61,8 +64,9 @@ $control attack (_ "Attack/Decay") float (_ "milliseconds") 250 10 1000
(let* ((test-length (truncate (min len (/ *sound-srate* 2.0)))) (let* ((test-length (truncate (min len (/ *sound-srate* 2.0))))
(levm (peak-avg-db sig test-length)) (levm (peak-avg-db sig test-length))
(target (* 0.925 levm))) ;suggest 7.5% above noise level (target (* 0.925 levm))) ;suggest 7.5% above noise level
(format nil "Peak based on first ~a seconds ~a dB~%~%~ ;; Work around bug 2012.
Suggested Threshold Setting ~a dB." (format nil (_ "Peak based on first ~a seconds ~a dB~%
Suggested Threshold Setting ~a dB.")
(roundn (/ test-length *sound-srate*) 2) (roundn (/ test-length *sound-srate*) 2)
(roundn levm 2) (roundn levm 2)
(roundn target 0)))) (roundn target 0))))