Reputation: 153
I am using PRAAT, and I need to extract pitch ranges. My audio files are all less than 2 seconds and I have dozen of them. I only know to obtain the information when I click on For now, I manually extract the pitch range (Query > Pitch Info) from the Pitch object I obtained after I clicked on Extract Visible Pitch Contour on the original audio file.
Upvotes: 1
Views: 1256
Reputation: 77
This script will log pitch range of all .wav files in a directory into a csv file for you. Make sure you put a slash at the end of your path.
form Enter Full Path + \
sentence path C:\
endform
filedelete 'path$''name$'pitch_range.csv
header_row$ = "Filename" + tab$ + "Mean F0" + tab$ + "mean SD" + tab$ + "min pitch" + tab$ + "max pitch" + newline$
header_row$ > 'path$'pitch_range.csv
Create Strings as file list... list 'path$'*.wav
number_files = Get number of strings
for j from 1 to number_files
select Strings list
current_token$ = Get string... 'j'
Read from file... 'path$''current_token$'
To Pitch (ac)... 0.01 75 15 no 0.03 0.45 0.01 0.35 0.14 600
minpitch = Get minimum... 0 0 Hertz Parabolic
maxpitch = Get maximum... 0 0 Hertz Parabolic
range = maxpitch - minpitch
fileappend "'path$'pitch_range.csv" 'current_token$' 'tab$' 'range:4' 'newline$'
Remove
endfor
Upvotes: 1