我正在使用命令行创建(x)秒的静音/空mp3.相当简单的任务我想!
似乎跛脚能够像这样做某事,但我无法找到导致实现这一点的任何东西.
有没有人能够做这样的事情?
免责声明:这是一个面向Unix的方法(尽管sox是跨平台的,应该只在
windows上完成).
>您将需要sox – “瑞士军刀”(跨平台)声音处理程序.
>这个包装Perl脚本,可以帮助你生成任何一秒钟的沉默:http://www.boutell.com/scripts/silence.html
$perl silence.pl 3 silence.wav
silence.pl是相当短的,所以我把它包括在这里,因为它是公共领域:
#!/usr/bin/perl $seconds = $ARGV[0]; $file = $ARGV[1]; if ((!$seconds) || ($file eq "")) { die "Usage: silence seconds newfilename.wav\n"; } open(OUT,">/tmp/$$.dat"); print OUT "; SampleRate 8000\n"; $samples = $seconds * 8000; for ($i = 0; ($i < $samples); $i++) { print OUT $i / 8000,"\t0\n"; } close(OUT); # Note: I threw away some arguments,which appear in the original # script,and which did not worked (on OS X at least) system("sox /tmp/$$.dat -c 2 -r 44100 -e signed-integer $file"); unlink("/tmp/$$.dat");
然后只是跛脚:
$lame silence.wav silence.mp3