首页
学习
活动
专区
圈层
工具
发布
首页
学习
活动
专区
圈层
工具
MCP广场
社区首页 >问答首页 >清除命令行的语音记录?

清除命令行的语音记录?
EN

Unix & Linux用户
提问于 2014-07-02 16:18:50
回答 2查看 21.7K关注 0票数 37

我以前使用过去噪胆量录音,但是它的命令行使用非常有限。我有100个简短的讲座录像,我将在接下来的几个月里观看,并希望有一个简单的方法,一次或根据需要清洗他们,然后再看。

我是否可以使用命令行工具或流行的语言库来完成此操作?

EN

回答 2

Unix & Linux用户

回答已采纳

发布于 2014-07-02 16:48:08

看看sox

引用man sox

代码语言:javascript
复制
SoX - Sound eXchange, the Swiss Army knife of audio manipulation

...

代码语言:javascript
复制
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).

因此,它应该是一个很好的适合作为一个伙伴命令行替代audaciy!

关于清理记录的实际任务,请看一下过滤器noisered,它等于降噪滤波器稳健性

man sox | less -p 'noisered \['

代码语言:javascript
复制
           [...]
   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
           [...]
票数 19
EN

Unix & Linux用户

发布于 2018-03-01 00:17:03

被接受的答案并没有给出一个实际的例子(见第一个注释),所以我在这里尝试给出一个例子。在使用apt的Ubuntu上,您应该安装sox和音频格式支持

sox

首先安装sox并支持格式(包括mp3):

代码语言:javascript
复制
sudo apt install sox libsox-fmt-*

然后,在对文件/文件运行命令之前,首先需要构建一个配置文件,制作一个噪声样本,这是最重要的部分,您必须选择噪音发生的最佳时间,确保在此示例中没有声音(或您试图保留的音乐/信号):

代码语言:javascript
复制
ffmpeg -i source.mp3 -ss 00:00:18 -t 00:00:20 noisesample.wav

现在,利用该源创建一个概要文件:

代码语言:javascript
复制
sox noisesample.wav -n noiseprof noise_profile_file

最后,在文件上运行降噪:

代码语言:javascript
复制
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文件使用相同的配置文件。

代码语言:javascript
复制
ls -r -1 *.mp3 | xargs -L1 -I{} sox {}  {}_noise_reduced.mp3  noisered noise_profile_file 0.31

或者如果有文件夹结构:

代码语言:javascript
复制
tree -fai . | grep -P ".mp3$" | xargs -L1 -I{} sox {}  {}_noise_reduced.mp3  noisered noise_profile_file 0.31
票数 29
EN
页面原文内容由Unix & Linux提供。腾讯云小微IT领域专用引擎提供翻译支持
原文链接:

https://unix.stackexchange.com/questions/140398

复制
相关文章

相似问题

领券
问题归档专栏文章快讯文章归档关键词归档开发者手册归档开发者手册 Section 归档