Dear all, I am working on feature extraction of speech signals in batch-processing by Praat script. So far, I completed the script for time, pitch, intensity, and formant 1, 2 and 3 frequencies and their bandwidths. Now, what I need to add is to extract spectral power value at formant1, formant2 and formant3 in batch-processing. Could you give me some advice how to do it?
Thank you for your time in advance. Here is my Praat script. ---------------------------- # This script measures pitch, intensity, formants and bandwidths every 10ms # assume that u have two txt files. # (1) list of '*.raw' files including directory: all_raw.txt # (2) list of '*.feats' files including directory: all_feats.txt # Script file was originally written by Setsuko Shirai # And it was modified by Jangwon Kim # Contact [email protected] # parameter type_file$ = "raw" prediction_order = 11 minimum_pitch = 75 maximum_pitch = 500 win_length = 0.025 win_shift = 0.01 new_sample_rate = 11000 allfile_dir$ = "C:\Users\jangwon\Documents\TIMIT" input_listfilename$ = "all_raw_trainDR1_prac" output_listdirname$ = "all_feats_trainDR1_prac" clearinfo # printline 'allfile_dir$'\'input_listfilename$'.txt Read Strings from raw text file... 'allfile_dir$'\'input_listfilename$'.txt numFiles = Get number of strings # print 'numFiles' for iFile from 1 to numFiles select Strings 'input_listfilename$' # print 'iFile' fileName$ = Get string... iFile # printline 'fileName$' Read Sound from raw 16-bit Little Endian file... 'fileName$' endfor select all numSelected = numberOfSelected ("Sound") # print 'numSelected' # change the name of each file - for batch processing for i to numSelected select all currSoundID = selected ("Sound", i) select 'currSoundID' currName$ = "word_'i'" Rename... 'currName$' endfor Read Strings from raw text file... 'allfile_dir$'\'output_listdirname$'.txt #print 'numFiles' for i to numSelected select Sound word_'i' # get the finishing time of the Sound file fTime = Get finishing time fTime = floor(fTime * 100) / 100 # Use numTimes in the loop numTimes = fTime / win_shift newName$ = "word_'i'" select Sound word_'i' # 1st argument: New sample rate 2nd argument: Precision (samples) Resample... 'new_sample_rate' 50 # 1st argument: Time step (s), 2nd argument: Minimum pitch for Analysis, # 3rd argument: Maximum pitch for Analysis To Pitch... 'win_shift' 'minimum_pitch' 'maximum_pitch' Rename... 'newName$' select Sound word_'i'_'new_sample_rate' To Intensity... 100 0 select Sound word_'i'_'new_sample_rate' # 1st argument: prediction order, 2nd argument: Analysis width (seconds) # 3rd argument: Time step (seconds), 4th argument: Pre-emphasis from (Hz) To LPC (autocorrelation)... 'prediction_order' 'win_length' 'win_shift' 50 To Formant Create Table... table_word_'i' numTimes 9 Set column label (index)... 1 T Set column label (index)... 2 F0 Set column label (index)... 3 E Set column label (index)... 4 F1 Set column label (index)... 5 FB1 Set column label (index)... 6 F2 Set column label (index)... 7 FB2 Set column label (index)... 8 F3 Set column label (index)... 9 FB3 for itime to numTimes select Pitch word_'i' curtime = win_shift * itime f0 = 0 f0 = Get value at time... 'curtime' Hertz Linear f0$ = fixed$ (f0, 2) if f0$ = "--undefined--" f0$ = "0" endif curtime$ = fixed$ (curtime, 5) select Intensity word_'i'_'new_sample_rate' intensity = Get value at time... 'curtime' Cubic intensity$ = fixed$ (intensity, 2) if intensity$ = "--undefined--" intensity$ = "0" endif select Formant word_'i'_'new_sample_rate' f1 = Get value at time... 1 'curtime' Hertz Linear f1$ = fixed$ (f1, 2) if f1$ = "--undefined--" f1$ = "0" endif fb1 = Get bandwidth at time... 1 'curtime' Hertz Linear fb1$ = fixed$ (fb1, 2) if fb1$ = "--undefined--" fb1$ = "0" endif f2 = Get value at time... 2 'curtime' Hertz Linear f2$ = fixed$ (f2, 2) if f2$ = "--undefined--" f2$ = "0" endif fb2 = Get bandwidth at time... 2 'curtime' Hertz Linear fb2$ = fixed$ (fb2, 2) if fb2$ = "--undefined--" fb2$ = "0" endif f3 = Get value at time... 3 'curtime' Hertz Linear f3$ = fixed$ (f3, 2) if f3$ = "--undefined--" f3$ = "0" endif fb3 = Get bandwidth at time... 3 'curtime' Hertz Linear fb3$ = fixed$ (fb3, 2) if fb3$ = "--undefined--" fb3$ = "0" endif select Table table_word_'i' Set numeric value... itime T 'curtime$' Set numeric value... itime F0 'f0$' Set numeric value... itime E 'intensity$' Set numeric value... itime F1 'f1$' Set numeric value... itime FB1 'fb1$' Set numeric value... itime F2 'f2$' Set numeric value... itime FB2 'fb2$' Set numeric value... itime F3 'f3$' Set numeric value... itime FB3 'fb3$' endfor select Strings 'output_listdirname$' dirName$ = Get string... i select Table table_word_'i' Write to table file... 'dirName$'.txt endfor select all Remove -- Jangwon Kim Electrical Engineering University of Southern California Mobile: 213-703-7883 E-mail: [email protected] [Non-text portions of this message have been removed]
