# Add to dynamic menu... Sound 0 ÒÓ 0 ÒÓ 0 ÒVT change...Ó ÒFo & Length...Ó 1 cjdisk:Applications:Sound:speech:Praat:scripts:VTchange-dynamic # This script will change the "vocal tract size" of the selected sounds # by the factor which is given in the dialogue box. # and the overall Fo by the given expression # If the quality is bad try changing the minimum pitch or maximum pitch # the script changes pitch and duration and then resamples to bring them back to original values, # leaving the formants etc changed. form Change vocal tract size positive Lengthening_factor 1.0 sentence Fo_expression self*1.0 comment Analysis parameters positive minimum_Fo 75 positive maximum_Fo 300 boolean Play_after_synthesis 1 boolean Delete_Manipulation_file 1 boolean Write_wav_file 1 sentence Directory_for_output_files cjdisk:testout: endform vtfactor = 'Lengthening_factor' fomin = 'minimum_Fo' fomax = 'maximum_Fo' directoryo$ = directory_for_output_files$ #find out how many Sounds have been selected numberOfSounds = numberOfSelected ("Sound") #set up arrays with names and IDs of selected Sounds #this is necessary because vtchange changes the selections for ifile from 1 to numberOfSounds sound$ = selected$ ("Sound", 'ifile') soundID = selected ("Sound", 'ifile') ids'ifile' = soundID names'ifile'$ = sound$ endfor #now get down to business for ifile from 1 to numberOfSounds soundID = ids'ifile' sound$ = names'ifile'$ call vtchange endfor procedure vtchange # select 'soundID' durn = Get duration #create Pitch & Manipulation objects select 'soundID' To Pitch... 0.01 fomin fomax plus 'soundID' To Manipulation select Pitch 'sound$' #apply the appropriate transformation to the Pitch object #includes vtfactor because of subsequent rescaling Formula... 'fo_expression$'*'vtfactor' #turn it into a PitchTier and place it into the Analysis object select Pitch 'sound$' Down to PitchTier select Manipulation 'sound$' plus PitchTier 'sound$' Replace pitch tier select Pitch 'sound$' plus PitchTier 'sound$' Remove Create DurationTier... 'sound$' 0 'durn' Add point... 0 1/'vtfactor' select Manipulation 'sound$' plus DurationTier 'sound$' Replace duration tier select DurationTier 'sound$' Remove #resynthesise with new pitch and duration contour select Manipulation 'sound$' Get resynthesis (PSOLA) Rename... 'sound$'r #resample and return sample rate to original fsamp = Get sample rate Resample... fsamp*vtfactor 50 Override sample rate... fsamp #tidy up decimals in name vtf$ = fixed$(vtfactor,2) # remove self* string if it is there pos = index (fo_expression$,"self*") if pos > 0 eleng = length (fo_expression$) foe$ = left$ (fo_expression$, pos -1) + right$(fo_expression$,eleng-pos-4) else foe$ = fo_expression$ endif if play_after_synthesis = 1 Play endif if write_wav_file = 1 Write to WAV file... 'directoryo$''sound$'.'vtf$'.'foe$'.wav Remove else Rename... 'sound$'.'vtf$'.'foe$' endif #tidy-up select Sound 'sound$'r Remove if delete_Manipulation_file = 1 select Manipulation 'sound$' Remove endif endproc