# # Praat Script to get per-digit formant info from read digit strings. # Command line: praat NumPitchScript basename # where audio is basename.wav # and segmentation in in tier 1 of basename.TextGrid # # Tier labels are expected to be single digits 0-9 # with string labels of the form #001 # # Per-string output will be string label # Per-digit output will be # time1 time2 time0 F1P20 F1P50 F1P80 F2P20 F2P50 F2P80 F3P20 F3P50 F3P80 MF1 Mf2 digit # ################################################################### # # ########################################## # Get base of filename # (from command line or interactively) ########################################## form Filename base word base foo endform outfile$ = "'base$'.fout" ############################ # Read in audio and TextGrid ############################ audio$ = "'base$'.wav" grid$ = "'base$'.TextGrid" Read from file... 'audio$' Read from file... 'grid$' ################ # track formants ################ select Sound 'base$' sound = selected ("Sound") To Formant (burg)... 0.0 5 5000 0.025 50 formant = selected ("Formant") select sound To Intensity... 70 0.01 intensity = selected ("Intensity") # # Iterate over TextGrid intervals # select TextGrid 'base$' textgrid = selected ("TextGrid") n = Get number of intervals... 1 filedelete 'outfile$' for i to n select textgrid label$ = Get label of interval... 1 i if length(label$) > 1 printline 'label$' fileappend 'outfile$' 'label$' 'newline$' elsif length(label$) == 1 t1 = Get starting point... 1 i t2 = Get end point... 1 i select intensity t0 = Get time of maximum... t1 t2 Parabolic select formant f1p20 = Get quantile... 1 t0-0.04 t0+0.04 Hertz 0.20 f2p20 = Get quantile... 2 t0-0.04 t0+0.04 Hertz 0.20 f3p20 = Get quantile... 3 t0-0.04 t0+0.04 Hertz 0.20 f1p50 = Get quantile... 1 t0-0.04 t0+0.04 Hertz 0.50 f2p50 = Get quantile... 2 t0-0.04 t0+0.04 Hertz 0.50 f3p50 = Get quantile... 3 t0-0.04 t0+0.04 Hertz 0.50 f1p80 = Get quantile... 1 t0-0.04 t0+0.04 Hertz 0.80 f2p80 = Get quantile... 2 t0-0.04 t0+0.04 Hertz 0.80 f3p80 = Get quantile... 3 t0-0.04 t0+0.04 Hertz 0.80 mf1 = Get mean... 1 t0-0.03 t0+0.03 Hertz mf2 = Get mean... 2 t0-0.03 t0+0.03 Hertz printline 't1:3' 't2:3' 't0:3' 'f1p20:0' 'f1p50:0' 'f1p80:0' 'f2p20:0' 'f2p50:0' 'f2p80:0' 'f3p20:0' 'f3p50:0' 'f3p80:0' 'mf1:0' 'mf2:0' 'label$' fileappend 'outfile$' 't1:3' 't2:3' 't0:3' 'f1p20:0' 'f1p50:0' 'f1p80:0' 'f2p20:0' 'f2p50:0' 'f2p80:0' 'f3p20:0' 'f3p50:0' 'f3p80:0' 'mf1:0' 'mf2:0' 'label$' 'newline$' endif endfor