This is my first question and I do my best to be clear. I have browsed the site without finding any former question that could help me out.
I am trying to get the onset detection script in praat to loop for an entire directory. I have nested the onset detection script as an inner loop to an outer loop going through each file in a specific library. However, I can't seem to make it work. I only get the onset for the first file in my directory. The onset detection script works well on its own, and the outer loop works fine with other commands such as "get intensity" for example. Can anybody see what I am doing wrong?
Here is what I have done:
form Get Intensity
sentence Directory .\
comment If you want to analyze all the files, leave this blank
word Base_file_name
comment The name of result file
text textfile intensity_VOT_list.txt
endform
#Print one set of headers
fileappend "'textfile$'" File name'tab$'
fileappend "'textfile$'" 'newline$'
Create Strings as file list... wavlist 'directory$'/'base_file_name$'*.wav
n = Get number of strings
for i from 1 to n
select Strings wavlist
filename$ = Get string... i
Read from file... 'directory$'/'filename$'
soundname$ = selected$ ("Sound")
To Intensity... 100 0
labelline$ = "'soundname$''tab$'"
fileappend "'textfile$'" 'labelline$'
select Intensity 'soundname$'
numberOfFrames = Get number of frames
fileappend "'textfile$'" 'numberOfFrames'
fileappend "'textfile$'" 'newline$'
for i from 1 to numberOfFrames
intensity = Get value in frame: i
if intensity > 40
time = Get time from frame: i
onsetresultline$ = "voice onset time for 'soundname$' is 'tab$''time''tab$'"
fileappend "'textfile$'" 'onsetresultline$'
fileappend "'textfile$'" 'newline$'
exit
endif
endfor
endfor
I would be happy for any help. If you read my question and feel it is badly formulated, please give me feedback on that so that I can try to get better. Kindly