########################################################## # increase-amplitude-by-percent.praat ( Written by Kyuchul Yoon kyoon@ling.osu.edu ) # This script lets a user select an interval and increases the amplitude of the interval # by the amount (in %) specified in the form ########################################################## form Specify files and folders word inFile_(with_wav) basson.wav comment Number of repetitions you want natural numOfRepetition 5 comment Percent increase wrt/ original duration real percentOrigAmp_(wrt_original_duration) 50 comment A subfolder with the input filename will be created automatically endform folderName$ = inFile$ - ".wav" folderName$ = folderName$ + "-amp" system mkdir 'folderName$' Read from file... 'inFile$' Rename... inFile finishTime = Get finishing time select Sound inFile Edit editor Sound inFile pause Select the interval whose duration you wish to increase Move begin of selection to nearest zero crossing Move end of selection to nearest zero crossing beginSel = Get begin of selection endSel = Get end of selection lenTargetSel = endSel - beginSel Select... 0 beginSel Extract windowed selection... beginSection Rectangular 1 no Select... beginSel endSel Extract windowed selection... targetSection Rectangular 1 no Select... endSel finishTime Extract windowed selection... endSection Rectangular 1 no Close endeditor select Sound inFile Write to WAV file... 'folderName$'/'folderName$'-0.wav for i to numOfRepetition select Sound targetSection Copy... tempTargetSection factorOfAddition = percentOrigAmp/100 * i paramOfIncrease = factorOfAddition + 1 Multiply... paramOfIncrease Rename... amplifiedTargetSection select Sound beginSection Copy... newBeginSection select Sound amplifiedTargetSection Copy... newTargetSection select Sound endSection Copy... newEndSection select Sound newBeginSection plus Sound newTargetSection plus Sound newEndSection Concatenate Rename... 'i' Play Edit editor Sound 'i' pause Write and proceed to next? Close select Sound 'i' Write to WAV file... 'folderName$'/'folderName$'-'i'.wav select Sound amplifiedTargetSection plus Sound newBeginSection plus Sound newTargetSection plus Sound newEndSection Remove endfor