명령 줄에서 음성 녹음을 청소 하시겠습니까? 하기 위해 Audacity를 사용 했지만

전에는 녹음에서 노이즈를 제거 하기 위해 Audacity를 사용 했지만 명령 줄 사용은 매우 제한적입니다. 앞으로 몇 달 동안 시청할 약 100 개의 짧은 강의 동영상이 있으며 한 번에 또는 필요한 경우 시청하기 전에 쉽게 정리할 수있는 방법을 원합니다.

이 작업을 수행하는 데 사용할 수있는 명령 줄 도구 나 널리 사용되는 언어 라이브러리가 있습니까?



답변

보세요 sox

인용 man sox:

SoX - Sound eXchange, the Swiss Army knife of audio manipulation

[…]

SoX is a command-line audio processing  tool,  particularly  suited  to
making  quick,  simple  edits  and to batch processing.  If you need an
interactive, graphical audio editor, use audacity(1).

따라서 대담을 대신 할 수있는 컴패니언 커맨드 라인으로 적합합니다!


녹음을 청소하는 실제 작업에 대해서는 노이즈 감소 필터 Audacitynoisered 와 동일한 필터 를 살펴보십시오 .

man sox | less -p 'noisered \['

           [...]
   noisered [profile-file [amount]]
           Reduce noise in the audio signal by profiling and filtering.
           This effect is moderately effective at  removing  consistent
           background  noise such as hiss or hum.  To use it, first run
           SoX with the noiseprof effect on a  section  of  audio  that
           ideally  would  contain silence but in fact contains noise -
           such sections are typically found at the  beginning  or  the
           end  of  a recording.  noiseprof will write out a noise pro‐
           file to profile-file, or to stdout if no profile-file or  if
           `-' is given.  E.g.
              sox speech.wav -n trim 0 1.5 noiseprof speech.noise-profil
           To  actually remove the noise, run SoX again, this time with
           the noisered effect; noisered will reduce noise according to
           a  noise  profile  (which  was generated by noiseprof), from
           profile-file, or from stdin if no profile-file or if `-'  is
           given.  E.g.
              sox speech.wav cleaned.wav noisered speech.noise-profile 0
           How  much  noise  should be removed is specified by amount-a
           number between 0 and 1 with a default of 0.5.   Higher  num‐
           bers will remove more noise but present a greater likelihood
           of removing wanted components of the audio  signal.   Before
           replacing  an  original  recording with a noise-reduced ver‐
           sion, experiment with different amount values  to  find  the
           optimal one for your audio; use headphones to check that you
           are happy with the results, paying particular  attention  to
           quieter sections of the audio.

           On  most systems, the two stages - profiling and reduction -
           can be combined using a pipe, e.g.
              sox noisy.wav -n trim 0 1 noiseprof | play noisy.wav noise
           [...]

답변

허용 된 답변은 실용적인 예를 제시하지는 않지만 (첫 번째 의견 참조) 여기에 하나를 제공하려고합니다. apt가있는 Ubuntu에서는 설치 sox및 오디오 형식 지원이 필요합니다

sox

첫 번째 설치 sox및 형식 지원 (mp3 포함) :

sudo apt install sox libsox-fmt-*

그런 다음 파일 / 파일에서 명령을 실행하기 전에 먼저 프로파일을 작성하고 노이즈 샘플을 작성해야합니다. 노이즈가 발생할 때 가장 좋은 시간을 선택해야하는 가장 중요한 부분입니다. 이 샘플에 음성 (또는 보관하려는 음악 / 신호)이 있어야합니다.

ffmpeg -i source.mp3 -ss 00:00:18 -t 00:00:20 noisesample.wav

이제 해당 소스에서 프로파일을 작성하십시오.

sox noisesample.wav -n noiseprof noise_profile_file

마지막으로 파일에서 노이즈 감소를 실행하십시오.

sox source.mp3 output.mp3 noisered noise_profile_file 0.31

noise_profile_file프로파일은 어디에 0.30있고 값입니다. 값은 0.20 ~ 0.30 사이에서 가장 좋으며 0.3 이상은 매우 공격적이며 0.20 미만은 부드럽고 시끄러운 오디오에 적합합니다.

시도해보고 다른 설정 트릭을 찾은 경우 결과 및 조정 설정에 의견을주십시오.

배치 처리 방법

소음이 비슷한 경우 모든 mp3에 대해 동일한 프로파일을 사용할 수 있습니다

ls -r -1 *.mp3 | xargs -L1 -I{} sox {}  {}_noise_reduced.mp3  noisered noise_profile_file 0.31

또는 폴더 구조가있는 경우 :

tree -fai . | grep -P ".mp3$" | xargs -L1 -I{} sox {}  {}_noise_reduced.mp3  noisered noise_profile_file 0.31

답변