-
Play sound when word changes
I’ve built the expression below to the Source Text of a text layer to make words change based on sliders for frame rate, delay before first change, and ramping. It works – but now I want a sound clip to play each time there’s a word change. I can’t figure out how to do this.
I know I could do it with markers (https://forums.creativecow.net/thread/2/918559) – but this is different. Since it’s all driven by sliders, I can’t use markers. I guess I need to add an expression to Time Remapping on the Audio clip, but other than that, I’m blank.
Anyone?
txt = thisComp.layer("Left Text Source").text.sourceText.value.split("*");
frameRate = thisComp.layer("Controls").effect("Left Words per Second")("Slider")*(thisComp.layer("Controls").effect("Ramp Value Compute Left")("Slider")+1);
startDelay = thisComp.layer("Controls").effect("First Change Time")("Slider");
// define which word to show
wordIndex = Math.ceil((time - startDelay)*frameRate);
if (wordIndex<0) wordIndex = 0;
if (wordIndex>=txt.length) wordIndex = txt.length-1;
txt[wordIndex];
Jarle Leirpoll
PremierePro.net