# This Praat script will get average intensity, minimal intensity, and maximal intensity (in dB) of all labeled intervals of all (or a specified set of) files in a folder. # To use, you specifiy a folder with wav.files, and base names if you want to analyze only a subset of files. # The script assumes that you already have labeled intervals. The textgrid files and sound files should have the same name. # Written by Shigeto Kawahara. # version 2/10/2010 # 19/01/2015 gedeeltelijk vertaald door Frits van Brenk form Get Intensity sentence Directory C:\ comment Laat dit leeg wanneer je alle bestanden wilt analyseren word Base_file_name comment De naam van het resultaatbestand text textfile ddk_intensiteit.txt endform #Read all files in a folder Create Strings as file list... wavlist 'directory$'\'base_file_name$'*.wav Create Strings as file list... gridlist 'directory$'\'base_file_name$'*.TextGrid n = Get number of strings for i to n clearinfo #We first extract intensity tiers select Strings wavlist filename$ = Get string... i Read from file... 'directory$'\'filename$' soundname$ = selected$ ("Sound") To Intensity... 100 0 # We now read grid files and extract all intervals in them select Strings gridlist gridname$ = Get string... i name$ = gridname$ - ".TextGrid" Read from file... 'directory$'\'gridname$' select TextGrid 'name$' fileappend "'textfile$'" 'name$''tab$' int=Get number of intervals... 1 # We calculate intensity for all labeled intervals for k from 1 to 'int' select TextGrid 'soundname$' label$ = Get label of interval... 1 'k' if label$ <> "" # calculates the onset and offset onset = Get starting point... 1 'k' offset = Get end point... 1 'k' #calculates the intensity values select Intensity 'soundname$' max_int = Get maximum... onset offset Parabolic resultline$ = "'max_int''tab$'" fileappend "'textfile$'" 'resultline$' endif endfor fileappend "'textfile$'" 'newline$' endfor # clean up select all Remove