-
Syncing text to audio
Hi.. I wanted to sync my voice-over with markers aligned perfectly to each word said in the VO. I want to sync the VO with its corresponding text to the text appears as the word is being spoken… I tried using expressions but it doesn’t sync perfectly. Is there a mistake in my expression or my expression is completely wrong.
Here’s my code
4a642036-d23e-42ff-84f2-06b40e5fb39b.png.jpgThanks,
Cheers.// TypeMonkey
m = thisComp.layer("1.mp3").marker;
rate = 20;
n = text.sourceText.length;
d = n/rate;
pre = d/2;
t = time
n = 0;
if (marker.numKeys > 0){
n = marker.nearestKey(time).index;
if (marker.key(n).time > time){
n--;
}
}if (n == 0){
0
}else{
m = marker.key(n);
myComment = m.comment;
t = time - m.time;
try{
actMarker = action.marker.key(myComment);
if (action.marker.numKeys > actMarker.index){
tMax = action.marker.key(actMarker.index + 1).time - actMarker.time;
}else{
tMax = action.outPoint - actMarker.time;
}
t = Math.min(t, tMax);
actMarker.time + t;
}catch (err){
0
}
}
linear(t,0,d,0,100)