I have several speech files. In each file a vowel is annotated. I want to cut the half portion of this vowel and save it in another file. In order to do this, I am cutting the vowel in 4 parts. Then I am adding 1/4 to the starting time and then 3/4 to the starting time to get the middle portion. I came up with the following script based on other scripts I found online. However, I don't get anything in my output folder, so I am obviously doing something wrong. Any comments are welcome.
form Files comment Insert the directory sentence InputDir ./ endform createDirectory ("output") Create Strings as file list... fileList 'path$'*.wav n_of_files = Get number of strings for file to n_of_files select Strings fileList # Gets the name of the sound file to be worked out file$ = Get string... 'file' # Reads the sound file to the Objects list Read from file... 'path$''file$' # Appends the ".TextGrid" extension to the string file$ and reads # the matching TextGrid Read from file... 'path$''file$'.TextGrid select all minus Strings fileList # Labelled intervals are extracted from the original sound file and are # then listed in the Objects list Extract non-empty intervals... 'tier' yes # Remembers how many pieces of sound where extracted selected = numberOfSelected ("Sound") # Cleaning up the unnecessary clutter select Sound 'file$' plus TextGrid 'file$' Remove for i to selected select all #gets the duration dur = Get total duration #gets one quarter of the vowel quart = dur/4 #gets starting point of the vowel start = Get starting point... tier interval #gets the the starting point of the second quarter of the vowel cut = start + quart #gets the ending point of the third quarter of the vowel cut2 = start + 3 * quart endfor sound_name$ = selected$ ("Sound") select Sound 'sound_name$' Edit editor Sound 'sound_name$' Select... cut cut2 Move start of selection to nearest zero crossing Move end of selection to nearest zero crossing Cut selected sound Write to WAV file... ./output/'file$'.wav endeditor select all minus Strings fileList # Cleans up unnecessary clutter Remove endfor select all Remove