I'm trying to run a Praat script provided by: http://phonetics.linguistics.ucla.edu/facilities/acoustic/Segmenter.txt However, when I run the script with the correct directories, setting my label$ = 他, the tier = 2, and the extension = .wav. (What the Penn Phonetics Lab Chinese Aligner provided)

I get the end statement saying "All files have been segmented! Have a nice day!" but there's nothing in my designated output folder.

What's going wrong?

## This script sections a file into individual vowels, vowels having been marked  in some tier using some uniform label such as "v".
##  Each vowel is saved as an individual Praat Sound file with the name of the original file plus a number indicating which vowel is being saved.
## 25 milliseconds is included to either side of the vowel, to make sure that a formant object includes the entire vowel (25 ms. frames).

##  Specify the label you've used to mark your vowels here:
label$ = "他"

##  Specify the tier where the vowels are labeled here:
tier_number = 2

##  Specify the directory where your sound files and accompanying textgrids are located:
directory$ = "[user pathing]"

##  Specify the directory where you want the segmented vowel sound files to be stored:
outdir$ = "[user pathing]"

##  Specify what file extension your sound files end in (.wav, .aiff...)
extension$ = ".wav"

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'
     select Sound 'current_sound$'
      for j from 1 to number_vowels
      editor Sound 'current_sound$'
               start = start'j'
               end = end'j'
               Select... 'start' 'end'
               Extract selection
        Write to binary file... 'outdir$''current_sound$'-'j'.Sound
     select all
     minus Strings list
select all
print All files have been segmented!  Have a nice day!
  • My pathing begins and ends with backslashes, within the quotation marks.
    – Jonathan
    May 3, 2020 at 14:20


Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Browse other questions tagged or ask your own question.