form output filename
sentence output result.txt
endform
sound$ = Read from file: "sound/dhl_part.wav"
textgrid$ = Read from file: "sound/dhl_part.TextGrid"
selectObject: "Sound dhl_part"
To Pitch: 0, 75, 600
selectObject: "TextGrid dhl_part"
num_intervals = Get number of intervals... 2
writeInfoLine: "phone",tab$,"word",tab$,"F0",tab$,"F0st"
writeFileLine: output$, "phone",tab$,"word",tab$,"F0",tab$,"F0st"
for i from 1 to num_intervals
phone$ = Get label of interval: 2, i
if phone$ == "ae" or phone$ == "ei"
... or phone$ == "eh" or phone$ == "iy"
startTime = Get start point: 2, i
endTime = Get end point: 2, i
midTime = startTime + (endTime - startTime)/2
phone_duration = (endTime - startTime)*1000
word_index = Get interval at time: 1, midTime
word$ = Get label of interval: 1, word_index
word_start = Get starting point: 1, word_index
word_end = Get end point: 1, word_index
word_duration = (word_end - word_start)*1000
appendInfo: phone$,tab$,word$,tab$
appendFile: output$, phone$,tab$,word$,tab$
selectObject: "Pitch dhl_part"
f0 = Get value at time: midTime, "Hertz", "Linear"
f0st = hertzToSemitones(f0)
appendInfoLine: fixed$(f0,2),tab$,fixed(f0st,2)
appendFileLine: output$, fixed$(f0,2),tab$,fixed(f0st,2)
selectObject: "TextGrid dhl_part"
endif
endfor