简体   繁体   中英

How to automatically extract pitch range from .wav files in PRAAT and put them all in a .csv file?

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.

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

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM