min_freq = 75其中file_name$是一个存放文件名的字符串变量。
max_freq =600
sound =do("Read fromfile...", file_name$)
pp =do("ToPointProcess (periodic, cc)...", min_freq,max_freq)
praat script.praat[arguments_to_script]其中arguments_to_script是传递给脚本的参数,在脚本中加上form,Praat会按顺序把参数赋值到form中的变量里。于是上述Praat脚本改成:
form Audio File to PointProcess注意form内的变量名首字母可以大写,尽管实际被声明的变量名还是小写开头的。
sentence File_name
positive Min_freq 75
positive Max_freq 600
endform
sound =do("Readfrom file...", file_name$)
pp =do("ToPointProcess (periodic, cc)...", min_freq,max_freq)
n = do("Get number of points")至此Praat脚本部分已经完成。使用如下Octave程序调用Praat并获得输出:
for ifrom 1 ton
t = do("Get time fromindex...", i)
appendInfoLine: t
endfor
[status output] = system(sprintf("praatbuild_corpus/praat_psola.praat %s\严谨起见,应当检查status以确保Praat是否执行成功,这里省略。
%f %f", filename, min_freqmax_freq));
praatcell = strsplit(output)';然后逐个转换成数值:
praatmat = zeros(rows(praatcell) - 1,1);(似乎没有直接支持Cell Array操作的字符串转数值函数,若有更好的方法请告知我,谢谢。)
for i= 1:rows(praatcell)- 1
praatmat(i) = str2num(praatcell{i, 1});
end
欢迎光临 iVocaloid论坛 (http://bbs.ivocaloid.com/) | Powered by Discuz! X2 |