form Input files word MatchList testlijst word UnMatchList testlijst word filename choice sex: 1 button M button F natural age 20 word nativelanguage DUT word identification A natural repeatcount 1 word contenttype BS word date 2006-11-25 word time 01:00 positive spacing 1 endform newfilename$ = "'sex$''age''nativelanguage$''identification$''repeatcount''contenttype$'" if not fileReadable("'MatchList$'") exit 'MatchList$' not readable endif if not fileReadable("'UnMatchList$'") exit 'UnMatchList$' not readable endif if not fileReadable("'filename$'") exit 'filename$' not readable endif Read Strings from raw text file... 'MatchList$' numberofStringsML = Get number of strings Rename... MatchList Read Strings from raw text file... 'UnMatchList$' numberofStringsUML = Get number of strings Rename... UnMatchList if (numberofStringsML != numberofStringsUML) exit We have a different amount of good / bad words endif Read from file... 'filename$' Rename... inputsound #soundlength = Get total duration soundlength = Get duration To IntervalTier (silence)... 0.3 0.4 0.1 # Rename... inputsound Into TextGrid Rename... inputsound select TextGrid inputsound numberofIntervals = Get number of intervals... 1 numberofWords = 0 for i from 1 to numberofIntervals select TextGrid inputsound value$ = Get label of interval... 1 'i' if value$ != "#" numberofWords = numberofWords + 1 endif endfor if (numberofWords != numberofStringsML) exit We have a different amount of recognized words ('numberofWords') and the wordlists ('numberofStringsML') endif counter = 1 for i from 1 to numberofIntervals select TextGrid inputsound value$ = Get label of interval... 1 'i' begintime = Get starting point... 1 'i' endtime = Get end point... 1 'i' if value$ != "#" if begintime > spacing / 2 begintime = begintime - (spacing / 2) else begintime = 0 endif if endtime + (spacing / 2) < soundlength endtime = endtime + (spacing / 2) else endtime = soundlength endif select Strings MatchList good$ = Get string... counter select Strings UnMatchList error$ = Get string... counter if (counter < 10) padding$ = "0" else padding$ = "" endif file$ = "'good$'_'error$'_'newfilename$''padding$''counter'_'date$'T'time$'" select Sound inputsound Extract part... 'begintime' 'endtime' Rectangular 1.0 no Write to WAV file... ./'file$'.wav Remove counter = counter + 1 endif endfor select Sound inputsound plus IntervalTier inputsound plus TextGrid inputsound plus Strings MatchList plus Strings UnMatchList Remove