####################################################### # pitch-contour-swapping.praat ( Written by Kyuchul Yoon kyoon@ling.osu.edu ) # This script copies the pitch contour of a stressed vowel (specified by a user) # to an unstressed vowel (also specified by the user), thus turning an # unstressed vowel to a stressed vowel. ####################################################### form Make unstressed vowel stressed comment F0 contour donor filename word donorFile_(with_wav) d01_site_01.wav comment F0 contour receiver filename word receiverFile_(with_wav) d06_support_01.wav comment Number of pitch points to simulate pitch contour natural numF0Points 5 comment A new folder with filename will be created real pitch 75 comment PITCH CONTOUR INCREASE IN % natural percentIncrease 10 endform # Folder name donorPrefix$ = donorFile$ - ".wav" receiverPrefix$ = receiverFile$ - ".wav" folderName$ = "donor." + donorPrefix$ folderName$ = folderName$ + "--" folderName$ = folderName$ + "receiver." folderName$ = folderName$ + receiverPrefix$ system mkdir 'folderName$' Read from file... 'donorFile$' Rename... donor Write to WAV file... 'folderName$'/'donorFile$' Read from file... 'receiverFile$' Rename... receiver finishTime = Get finishing time Write to WAV file... 'folderName$'/'receiverFile$' # User input for Donor select Sound donor Edit pause Select DONOR vowel segment editor Sound donor startDonor = Get begin of selection endDonor = Get end of selection lenDonor = endDonor - startDonor Close endeditor # Get pitch contour points from Donor select Sound donor To Pitch... 0 40 600 intervalPitchPointDonor = lenDonor / numF0Points for i to numF0Points timeToExtract = startDonor + (i-1) * intervalPitchPointDonor donorPitchValues'i' = Get value at time... timeToExtract Hertz Linear endfor # User input for Receiver select Sound receiver durReceiver = Get duration Edit pause Select RECEIVER vowel segment editor Sound receiver Move begin of selection to nearest zero crossing Move end of selection to nearest zero crossing startReceiver = Get begin of selection endReceiver = Get end of selection lenReceiver = endReceiver - startReceiver Select... 0 startReceiver Extract windowed selection... beginSection Rectangular 1 no Select... startReceiver endReceiver Extract windowed selection... targetSection Rectangular 1 no Select... endReceiver finishTime Extract windowed selection... endSection Rectangular 1 no # Get the time step to be used to create manipulation object timeStepManip = lenReceiver / numF0Points Close endeditor # Add points to target section manipulation object select Sound targetSection To Manipulation... timeStepManip pitch 600 Rename... manipTargetSection intervalPitchPointReceiver = lenReceiver / numF0Points Edit editor Manipulation manipTargetSection Set pitch range... 500 Select... 0 lenReceiver Remove pitch point(s) for k to numF0Points timeToInsert = (k-1) * intervalPitchPointReceiver tempDummyPitch = donorPitchValues'k' percentVal = percentIncrease / 100 dummyPitch = tempDummyPitch + tempDummyPitch*percentVal Add pitch point at... timeToInsert 'dummyPitch' endfor Publish resynthesis Close endeditor select Sound fromManipulationEditor Rename... pitchModifiedReceiver # Put all together select Sound beginSection Copy... newBeginSection select Sound pitchModifiedReceiver Copy... newTargetSection select Sound endSection Copy... newEndSection select Sound newBeginSection plus Sound newTargetSection plus Sound newEndSection Concatenate Rename... newReceiver Play Edit pause Write? #Close select Sound newReceiver Write to WAV file... 'folderName$'/'folderName$'.wav # Object cleanup select Pitch donor plus Sound beginSection #plus Sound targetSection plus Sound endSection #plus Manipulation manipTargetSection plus Sound pitchModifiedReceiver plus Sound newBeginSection plus Sound newTargetSection plus Sound newEndSection Remove ##### END OF SCRIPT #######