Date
1 - 3 of 3
Combining Duration and Pitch Script
nyarkoafia2910@...
Hi all,
Kindly help me with this.
I have tried to run it several times but i keep getting this message (a picture attached).
Is there something i am not doing?
I would appreciate if you could assist me with this.
# This script goes through a textgrid with 2 interval tier: word tier (1) and vowel tier (2).
# It measures the duration and pitch of each vowel, collects its label, startpoint, the interval number
# and the label of the corresponding word. It also records the name of the textgrid (fileID).
form Calculate duration and pitch for labeled segments in files
comment Path to log file:
text resultfile "C:\Users\vani\Documents\Acoustics of sounds\DurationPitchLog.txt
endform
# Set up log file:
if fileReadable (resultfile$)
pause The result file 'resultfile$' already exists! Do you want to overwrite it?
filedelete 'resultfile$'
endif
header_row$ = "fileID" + tab$ + "word_intvl" + tab$ + "word_label" + tab$ + "label" + tab$ + "duration" + tab$ + "pitch" + tab$ + "startpoint" + newline$
fileappend "'resultfile$'" 'header_row$'
# Name the praat objects
tg = selected("TextGrid")
select 'tg'
tg_name$ = selected$("TextGrid")
select Sound 'tg_name$'
# Make a pitch contour object
To Pitch... 0 75 600
Rename... currentPitch
select 'tg'
number_intervals = Get number of intervals... 2
# Go through all intervals in the second tier of the textgrid
for k from 1 to number_intervals
select 'tg'
label$ = Get label of interval... 2 'k'
if label$ <> ""
start = Get starting point... 2 'k'
end = Get end point... 2 'k'
intvlmidpoint = ((end - start) / 2.0) + start
wordintvlnum = Get interval at time... 1 'intvlmidpoint'
word_label$ = Get label of interval... 1 'wordintvlnum'
duration = (end - start) * 1000
select Pitch currentPitch
mean_pitch = Get mean... 'start' 'end' Hertz
result_row$ = "'tg_name$'" + tab$ + "'wordintvlnum'" + tab$ + "'word_label$'" + tab$ + "'label$'" + tab$ + "'duration'" + tab$ + "'mean_pitch'" + tab$ + "'start'" + newline$
fileappend "'resultfile$'" 'result_row$'
endif
endfor |
|
I looked at the code quickly and it seems to work fine. select Sound 'tg_name$' # Make a pitch contour object To Pitch... 0 75 600 Rename... currentPitch The error message pops up because Praat is trying to execute `To Pitch... 0 75 600` to something that is not a Sound. Maybe, you could click on Ok in the Message and verify if the selected object is a Sound. On Sun, Mar 19, 2023 at 12:22 PM <nyarkoafia2910@...> wrote:
-- Rolando Muñoz A. |
|
nyarkoafia2910@...
Thanks a lot for the feedback Rolando. I just clicked on ‘ok’ but the script did not run. I am new to praat and so confused On Sun, Mar 19, 2023 at 13:57 Rolando Muñoz Aramburú <rolando.muar@...> wrote:
|
|