#Extract and save all non-empty intervals #directory for the sounds to be saved in form Give the output directory word: "source directory", "D:\experimentFiles\" word: "output directory", "C:\temp\" endform @getDirSep sDir$ = source_directory$ if right$(sDir$,1) <> dirSep$ sDir$ = sDir$ + dirSep$ endif #correct directory name if necessary outDir$ = output_directory$ if right$(outDir$,1) <> dirSep$ outDir$ = outDir$ + dirSep$ endif if numberOfSelected("Sound") <> 1 exitScript: "select a sound" endif if numberOfSelected("TextGrid") <> 1 exitScript: "select the textgrid as well" endif Extract non-empty intervals: 1, "no" n = numberOfSelected("Sound") #GET THE OBJECT NUMBERS AND NAMES OF ALL SOUNDS for i from 1 to n s[i] = selected("Sound",i) s$[i] = selected$("Sound",i) endfor for i from 1 to n n$ = s$[i] select s[i] Write to WAV file: dir$ + n$ + ".wav" appendInfoLine: "wrote " + n$ endfor procedure getDirSep if windows == 0 dirSep$ = "/" else dirSep$ = "\" endif endproc