######################### # This script implements an heuristic algorithm to detect syllable boundaries. # Since the results are far from reliable, the purpose of the script is to support # manual syllable annotations, not to replace them! # First, the built in Praat silence detection is applied (To TextGrid (silences)...). # Next, syllable boundaries are detected in the sounding parts (phrases). # Following both steps, the user is given the opportunity to adjust the outcome manually. # # Results: # - TextGrid with silences tier and syllables tier # - Info window output (duration, number of syllables, and syllable rate per phrase + mean and sd) # - Table object (start, end, duration, number of syllables, and syllable rate per phrase) # # Usage: # - Select one sound object # - Run the script # - After silence detection the TextGrid editor pops up # - adjust the interval boundaries and click Continue # - After syllable detection the TextGrid editor pops up # - adjust the interval boundaries in the first phrase and click Continue # - proceed likewise with the other phrases # # jm 2012-03-06 ######################### # minimum pause duration min_pause_dur = 0.2 # minimum duration of sounding parts (phrases) min_sound_dur = 0.1 # minimum syllable duration min_syl_dur = 0.08 n = numberOfSelected() if n = 1 soundID = selected("Sound") soundName$ = selected$("Sound") select soundID # pause detection gridID = To TextGrid (silences)... 60 0 -25 'min_pause_dur' 'min_sound_dur'

plus soundID # open textgrid editor for manual adjustments Edit editor TextGrid 'soundName$' Zoom... 0 4 Move cursor to... 0 Select next interval Select previous interval pause Adjust pause detection (

= pause). Close # if you happen to have a suitable (!!!) textgrid you can skip pause detection elsif n = 2 soundID = selected("Sound") soundName$ = selected$("Sound") gridID = selected("TextGrid") else exit Select only one sound object. endif # preparations and initializations for syllable detection select soundID intensID = To Intensity... 50 0 yes lowquant = Get quantile... 0 0 0.25 select gridID Insert interval tier... 1 syllables noi = Get number of intervals... 2 tableID = Create Table with column names... 'soundName$' 0 Phrase Start End Dur NumOfSyl Rate phrase_no = 0 # the syllable detection loop for i to noi select gridID label$ = Get label of interval... 2 'i' start = Get start point... 2 'i' end = Get end point... 2 'i' # consider only sounding parts if label$ = "" phrase_no = phrase_no+1 Set interval text... 2 'i' Phrase 'phrase_no' select tableID Append row Set numeric value... 'phrase_no' Phrase 'phrase_no' Set numeric value... 'phrase_no' Start 'start' Set numeric value... 'phrase_no' End 'end' lasttime = start select gridID Insert boundary... 1 'start' Insert boundary... 1 'end' interv = Get interval at time... 1 'start' Set interval text... 1 'interv' s # heuristic ist based on intensity select intensID sframe = Get frame number from time... 'start' sframe = round(sframe)+2 eframe = Get frame number from time... 'end' eframe = round(eframe)-2 for j from 'sframe' to 'eframe' select intensID val_1 = Get value in frame... 'j'-2 val_2 = Get value in frame... 'j'-1 val_3 = Get value in frame... 'j' val_4 = Get value in frame... 'j'+1 val_5 = Get value in frame... 'j'+2 time = Get time from frame number... 'j' syl_dur = time-lasttime # the rule: if ((val_1 > val_2 && val_2 > val_3 && val_3 < val_4 && val_4 < val_5) || (val_2 > val_3 && val_3 < val_4 && val_3 < lowquant)) && syl_dur > min_syl_dur lasttime = time select gridID Insert boundary... 1 'time' time = time+0.0000001 interv = Get interval at time... 1 'time' Set interval text... 1 'interv' s endif endfor elsif label$ = "

" interv = Get interval at time... 1 'start' Set interval text... 1 'interv'

endif endfor select intensID Remove select tableID nor = Get number of rows select gridID plus soundID # open textgrid editor for manual adjustments Edit endeditor echo 'soundName$' # loop through the phrases for r to nor select tableID pstart = Get value... 'r' Start pend = Get value... 'r' End phrase_dur = pend-pstart zoomstart = pstart-0.1 zoomend = pend+0.1 editor TextGrid 'soundName$' Zoom... 'zoomstart' 'zoomend' Play window pause Adjust syllable detection in phrase 'r' (of 'nor'). endeditor select gridID firstint = Get interval at time... 1 'pstart' lastint = Get interval at time... 1 'pend' numsyl = lastint-firstint # calculation of syllable rate rate = numsyl/phrase_dur select tableID Set numeric value... 'r' Dur 'phrase_dur:2' Set numeric value... 'r' NumOfSyl 'numsyl' Set numeric value... 'r' Rate 'rate:2' printline Phrase 'r' 'tab$' Duration: 'phrase_dur:2' 'tab$' Number of syllables: 'numsyl' 'tab$' Syllable rate: 'rate:2' syl/sec endfor editor TextGrid 'soundName$' Close select tableID mean = Get mean... Rate sd = Get standard deviation... Rate printline mean syllable rate: 'mean:2' syl/sec (sd: 'sd:2') printline