######################### # # Flattens the intensity curve of the # sound files in a directory. All speech # segments will have the same intensity. # This includes periods of silence - they # will be amplified to sound like white # noise. Could perhaps be modified with # reference to a textgrid, selecting for # specific sounds. # ######################### form Neutralize Intensity in files comment Directory of source sound files text sound_directory c:\temp\ sentence Sound_file_extension .wav comment Directory of created files text end_directory c:\temp\ comment Neutralize to Intensity positive max 75 endform # Here, you make a listing of all the sound files in a directory. Create Strings as file list... list 'sound_directory$'*'sound_file_extension$' numberOfFiles = Get number of strings for ifile to numberOfFiles # A sound file is opened from the listing: filename$ = Get string... ifile Read from file... 'sound_directory$''filename$' sound_one$ = selected$ ("Sound") # Set up the resynthesis objects start = Get start time end = Get end time To Intensity... 50 0.005 1 intensity_one$ = selected$ ("Intensity") Create IntensityTier... "scaler" start end intensity_new$ = selected$ ("IntensityTier") # Go through file, measure intensity and calculate the equalization value numberOfMeasurements = end div 0.01 time = 0.01 for counter from 0 to numberOfMeasurements select Intensity 'intensity_one$' intensity = Get value at time... time Cubic if intensity != undefined scale = max - intensity select IntensityTier 'intensity_new$' Add point... time scale endif time = time + 0.01 endfor # Resynthesize select IntensityTier 'intensity_new$' plus Sound 'sound_one$' Multiply... 1 Scale intensity... max # And save Write to WAV file... 'end_directory$''filename$' Remove select IntensityTier 'intensity_new$' plus Intensity 'intensity_one$' plus Sound 'sound_one$' Remove select Strings list endfor select all Remove