# This script is adapted from Catherine Crosswhite's webpage and slightly modified by Taehong Cho. ## This script sections a file into individual segment, segments having been marked in some tier using some uniform label such as "a". ## Each vowel is saved as an individual Praat Sound file with the name of the original file plus a number indicating which vowel 'a' (for example) is being saved. ## 50 milliseconds is included to either side of the vowel, but you can always change it below: # start = start'j' - 0.050 # end = end'j' + 0.050 ## Specify the label you've used to mark your here: label$ = "a" ## Specify the tier where the segments are labeled here: tier_number = 1 ## Specify the directory where your sound files and accompanying textgrids are located: directory$ = "\\Nt01\MAC1\Annelie\r sentences\" ## Specify the directory where you want the segmented vowel sound files to be stored: outdir$ = "D:\temp\" ## Specify what file extension your sound files end in (.wav, .aiff...) extension$ = ".wav" clearinfo Create Strings as file list... list 'directory$'*'extension$' number_of_files = Get number of strings for a from 1 to number_of_files select Strings list current_sound$ = Get string... 'a' Read from file... 'directory$''current_sound$' current_sound$ = selected$("Sound") Read from file... 'directory$''current_sound$'.TextGrid number_vowels = Count labels... 1 'label$' Extract tier... 'tier_number' current_tier = selected ("IntervalTier") Get starting points... 'label$' starting_points = selected ("PointProcess") select 'current_tier' Get end points... 'label$' end_points = selected ("PointProcess") for i from 1 to number_vowels select 'starting_points' start'i' = Get time from index... 'i' select 'end_points' end'i' = Get time from index... 'i' endfor select Sound 'current_sound$' Edit for j from 1 to number_vowels editor Sound 'current_sound$' start = start'j' - 0.050 end = end'j' + 0.050 Select... 'start' 'end' Extract selection endeditor Write to WAV file... 'outdir$''current_sound$'-'label$''j'.wav endfor select all minus Strings list Remove endfor select all Remove print All files have been segmented! Have a nice day!