Audio 如何在Audacity中删除.wav文件中间的静默而不是边缘?
我正在尝试使用Audacity从音频文件中删除静音。有一个名为Nyquist的插件,它删除文件开头和结尾的静默,但不删除中间的静默。我想把这一点颠倒过来,删除所有地方的沉默,除了开始和结束 我认为下面的功能是插件的相关部分。我应该如何更改它以获得截断内部沉默函数?(我不知道任何Nyquist或Lisp,所以我很难理解它目前的功能,更不用说改变它了。) 完全不同的方法也受欢迎-这只是我目前对如何编辑我的许多音频文件的最佳猜测Audio 如何在Audacity中删除.wav文件中间的静默而不是边缘?,audio,lisp,audacity,nyquist,Audio,Lisp,Audacity,Nyquist,我正在尝试使用Audacity从音频文件中删除静音。有一个名为Nyquist的插件,它删除文件开头和结尾的静默,但不删除中间的静默。我想把这一点颠倒过来,删除所有地方的沉默,除了开始和结束 我认为下面的功能是插件的相关部分。我应该如何更改它以获得截断内部沉默函数?(我不知道任何Nyquist或Lisp,所以我很难理解它目前的功能,更不用说改变它了。) 完全不同的方法也受欢迎-这只是我目前对如何编辑我的许多音频文件的最佳猜测 (defun trim-silence () ;; Nyquist
(defun trim-silence ()
;; Nyquist plug-ins cannot return 'no audio', so trap as error.
(if (< (get '*selection* 'peak-level) threshold)
(throw 'error (format nil "Error.~%All selected audio in the ~a selected track~%~
is below the silence threshold.~%~%~
Try setting the threshold to a~%~
lower (more negative) dB level."
(add-num-suffix (get '*track* 'index)))))
(if (> len (* limit *sound-srate*)) ;max length in samples
(throw 'error (format nil "Error.\nMax RAM usage by Trim Silence is set to ~a GB.~%This allows a maximum duration ~
for a ~a~%track at ~a Hz of ~a.~%Selected track is ~a.~%"
RAM-limit
(if (arrayp *track*) "stereo" "mono")
(round *sound-srate*)
(to-hhmmss limit)
(to-hhmmss (get-duration 1)))))
(let* (;; ratio provides tighter trimming for short selections
;; while maintaining reasonable speed for long selections
(ratio (max 10 (min 200 (round (/ len 100000.0)))))
(my-srate (/ *sound-srate* ratio))
(mysound (convert *track* ratio))
(limits (get-clip-limits)) ; (list start, end) times of audio clips
(clip-start (if (first limits)
(abs-to-relative-time (nth 0 limits)))) ; nil id invalid
(clip-end (if (second limits)
(abs-to-relative-time (nth 1 limits))))) ; nil if invalid
;loop through samples and mark start and end
(setf result (find-sil mysound clip-start clip-end))
(let ((start (if clip-start
(max clip-start
(- (/ (first result) my-srate) min-start-silence))
0))
(end (if clip-end
(min (+ (- (get-duration 1) (/ (second result) my-srate))
min-end-silence)
clip-end)
(get '*selection* 'end))))
;; ensure at least 1 sample remains
;; This should never happen.
(if (>= start end)
(setq start (- end (/ *sound-srate*))))
; trim
(multichan-expand #'extract-abs start end (cue *track*)))))
(取消修剪静音()
;Nyquist插件无法返回“无音频”,因此陷阱为错误。
(如果(<(获取“*选择*”峰值电平)阈值)
(抛出'error(format nil'错误。~%a selected track中的所有选定音频~%~
低于静默阈值。~%%~
尝试将阈值设置为~%~
更低(更负)dB电平。”
(添加num后缀(获取“*track*”索引(()()))”
(如果(>len(*limit*sound srate*);样本中的最大长度
(throw'error(format nil)错误。\n修剪静音的最大RAM使用量设置为~a GB。~%这允许最大持续时间~
对于~a~%的~a Hz的~a~%磁道,所选磁道为~a~%。”
RAM限制
(如果(阵列*音轨*)“立体声”“单声道”)
(圆形*声音等级*)
(至HHMMS限制)
(至HHMMS(获取持续时间1(()())))
(let*)(;;比率为短选择提供更紧密的修剪
;同时为长时间选择保持合理的速度
(比率(最大值为10(最小值为200)(圆形(/len 100000.0)()))))
(我的srate(/*声音srate*比率))
(mysound(转换*音轨*比率))
(限制(获取剪辑限制));(列出音频剪辑的开始、结束)时间
(剪辑开始(如果(第一个限制)
(相对于相对时间的绝对值(第n个0个限制));无id无效
(卡夹端(如果(第二个限制)
(绝对值与相对时间之比(第n个1限值);(如果无效,则为零)
;循环检查样本并标记开始和结束
(setf结果(查找sil mysound剪辑开始剪辑结束))
(让((开始)(如果剪辑开始
(最大剪辑开始)
((/(第一个结果)我的srate)最小开始静音)
0))
(结束(如果为夹子结束
(最小值(+(获取持续时间1)(/(第二个结果)我的srate))
最小结束沉默)
夹(端部)
(获取“*选择*”结束)))
;确保至少有一个样本剩余
这永远不应该发生。
(如果(>=开始-结束)
(setq开始(-end(/*sound srate*))
;修剪
(多声道扩展#“extract-abs开始-结束(cue*track*)”)))