Powershell批量转换语音文件

2012-03-12

起因:

  最近工作需要,需要大批量转换语言格式,需要转换成8K 8Bit的Mu-law格式语音,由于文件数量众多,就用语句批量转换处理了

环境:

  Win7 专业版带自带powershell +sox语音转换工具

 

待转换语音文件放在e:\WAVE主目录下,在该目录下不同的项目有各自的子文件夹,改具体代码如下:

 1   
2
3 $filelist=Get-ChildItem e:\WAVE -recurse -include *.wav
4
5 Foreach($file in $filelist)
6
7 {
8
9 $tmpdir=$file.directory.ToString().Replace("WAVE","ConvertedWAVE")
10
11 $newfile= $tmpdir+"\"+$file.Name
12
13 if(!(test-path $tmpdir))
14
15 {
16
17 new-item -type directory $tmpdir
18
19 }
20
21 D:\sox\sox.exe $file -c 1 -r 8k -b 8 -e mu-law $newfile
22
23 }

 

posted @ 2012-03-13 00:03  firecat  阅读(345)  评论(0编辑  收藏  举报