使用Perl或者Python加载Praat脚本在DOS命令窗口直接执行
下载地址: 5. The console Praat (for experienced Praat script writers only!)There is also a special program called Praatcon,which you run from a console window (the "command prompt"). Download the following zip folder:
This zip folder contains Praatcon(.exe),which is the Praat console application. You should not double-click it. To run it,write a Praat script and specify that script on the command line,optionally with arguments,e.g.:
? 可以根据自己的计算机操作系统位数选择相应的下载包。 ? 下载了之后放在计算机的某个位置,比如放在E:praatcon.exe ? 在这里给出一个测试脚本,脚本的目的是获取某个文件夹内某种文件的文件名列表,请注意如果这样的脚本是针对不同目录进行操作的,需要在脚本里使用form对话框给出参数,从而这样的参数也可以在调用这个脚本的时候给出。 form test sentence openPath E:TranWav sentence savePath E:dir.txt sentence extName .wav endform Create Strings as file list: "fileList",openPath$+extName$ fileNum=Get number of strings for ifile from 1 to fileNum selectObject: "Strings fileList" fileName$=Get string: ifile appendFileLine: savePath$,fileName$ endfor 脚本需要三个参数,第一个是原来的文件所在的目录,第二个参数是产生的列表所在的路径,第三个参数是指过滤什么类型的文件。 使用Perl调用这个脚本的方法是: $commandline=sprintf("E:praatcon.exe E:GetFileNames.Praat E:wav E:dir.txt .wav"); system($commandline); 第一个是Praatcon.exe所在的路径,第二个是脚本所在的路径,第三个是脚本里的第一个参数,后面两个同理。 ? 而使用Python也同样: import os os.system('E:praatcon.exe E:GetFileNames.Praat E:wav E:dir.txt .wav') (编辑:李大同) 【声明】本站内容均来自网络,其相关言论仅代表作者个人观点,不代表本站立场。若无意侵犯到您的权利,请及时与联系站长删除相关内容! |