seblavoie
8/22/2016 - 7:10 PM

Expression taken here: http://zacklovatt.com/sync-precomp-audio/

// Use if there is *no* time remapping in parent comp.
parentComp = comp("# Main");

compStartTimeInParent = parentComp.layer(thisComp.name).startTime;
audioStartTimeInParent = parentComp.layer(thisLayer.name).startTime;
fullStartTime = this.startTime;
fullEndTime = this.source.duration+startTime;

linear(time, fullStartTime, fullEndTime, fullStartTime+compStartTimeInParent-audioStartTimeInParent, fullEndTime+compStartTimeInParent-audioStartTimeInParent)


// Use if there *is* time remapping in parent comp.
parentComp = comp("# Main");

compStartTimeInParent = parentComp.layer(thisComp.name).startTime;

parentComp.layer(thisLayer.name).timeRemap.valueAtTime(time + compStartTimeInParent)