########################################################## # increase-duration-by-milliseconds.praat ( Written by Kyuchul Yoon kyoon@ling.osu.edu ) # This script lets a user select an interval and increases the duration of the interval # by the amount (in msec) 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 Milliseconds increase wrt/ original duration real msecDur_(in_milliseconds) 10 comment A subfolder with the input filename will be created automatically endform folderName$ = inFile$ - ".wav" folderName$ = folderName$ + "-dur.increase.by.msec-" suffix$ = fixed$(msecDur,0) folderName$ = folderName$ + suffix$ 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$'-orig.wav for i to numOfRepetition select Sound targetSection To Manipulation... 0.01 75 600 Rename... manip durInMsec = msecDur / 1000 durToAdd = durInMsec * i newLength = lenTargetSel + durToAdd paramOfIncrease = newLength / lenTargetSel Edit editor Manipulation manip Set duration range... 0 10 Add duration point at... 0 paramOfIncrease Add duration point at... lenTargetSel paramOfIncrease Publish resynthesis Close select Sound fromManipulationEditor Rename... lengthenedTargetSection select Sound beginSection Copy... newBeginSection select Sound lengthenedTargetSection 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 Manipulation manip plus Sound lengthenedTargetSection plus Sound newBeginSection plus Sound newTargetSection plus Sound newEndSection Remove endfor select Sound beginSection plus Sound targetSection plus Sound endSection Remove