Skip to content

Instantly share code, notes, and snippets.

@finnp
Created June 14, 2012 21:54
Show Gist options
  • Save finnp/2933216 to your computer and use it in GitHub Desktop.
Save finnp/2933216 to your computer and use it in GitHub Desktop.
Praat script for Synchronizing audios
video = selected ("Sound", 1)
audio = selected ("Sound", 2)
select video
maxvideo = Get time of maximum... 0 0 none
select audio
maxaudio = Get time of maximum... 0 0 none
audioend = Get end time
sf = Get sampling frequency
printline
printline Video-Clap: 'maxvideo' Sekunden
printline Audio-Clap: 'maxaudio' Sekunden
if maxaudio > maxvideo
diff = maxaudio - maxvideo
printline Audio-Clap kommt später
printline => Schneide am Audio etwas weg
Extract part... 'diff' 'audioend' Rectangular 1.0 no
Rename... SynchronisiertesAudio
plus video
Combine to stereo
Rename... KontrollAudioStereo
else
diff = maxvideo - maxaudio
printline Video-Clap kommt später
printline => Füge Silent vorne ans Audio an
Create Sound... silent 0 'diff' 'sf' 0
select audio
Copy... temp
plus Sound silent
Concatenate
Rename... SynchronisiertesAudio
plus video
Combine to stereo
Rename... KontrollAudioStereo
select Sound temp
plus Sound silent
Remove
endif
printline Differenz: 'diff' Sekunden
plus video
@finnp
Copy link
Author

finnp commented Jun 14, 2012

I wrote this Praat script for automatically synchronize the audio of a video and the audio of a microphone. It is essential that you can hear a clap (for example with a movie clapper) in both of the audios. Both audios also need to be mono.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment