So I have this expression with help of Ai on the text and it works really good.
// Human-like typing with total duration control + blinking cursor + start delay
txt = value.toString(); // full text
dur = comp("Main Comp").layer("General Settings").effect("Duration")(1); // total typing duration (seconds)
delay = comp("Main Comp").layer("General Settings").effect("Delay")(1); // delay before typing starts (seconds)
jitter = 1; // randomness factor (0 = uniform, 1 = irregular)
blinkRate = 3; // cursor blink frequency
t = time - inPoint - delay; // <-- delayed start
seedRandom(index, true);
total = txt.length;
baseStep = dur / total;
typed = 0;
elapsed = 0;
for (i = 0; i < total; i++){
step = baseStep * random(1 - jitter, 1 + jitter);
elapsed += step;
if (elapsed < t) typed++;
}
// keep text invisible until delay is over
if (t < 0) typed = 0;
visible = txt.substr(0, typed);
// blinking cursor
showCursor = (Math.floor(time * blinkRate) % 2 == 0) ? "|" : " ";
visible + showCursor;
And this expression is on the time remap with 5 keyboard sound fx isolated that are 15 fps long and one after each other with space bar sound fx on the beginning.
// --- Link to the Text Layer ---
var textLayer = thisComp.layer("Helo world 3"); // <-- Make sure this layer name is correct!
// --- Your Custom Audio Settings ---
var numRegularSounds = 5; // <-- UPDATE: The number of REGULAR key sounds.
var soundDurationFrames = 15; // <-- UPDATE: The duration of ONE sound slot in frames.
// --- Expression Logic (No need to edit below this line) ---
var soundDuration = framesToTime(soundDurationFrames);
try {
var currentLength = textLayer.text.sourceText.length;
var prevLength = textLayer.text.sourceText.valueAtTime(time - thisComp.frameDuration).length;
if (currentLength > prevLength) {
// A new character was just typed. Check what it is.
var newChar = textLayer.text.sourceText.value.charAt(currentLength - 1);
if (newChar == " ") {
// It's a spacebar. Play the first sound.
0; // Start time of the spacebar sound.
} else {
// It's a regular key. Pick a random sound from the regular keys section.
seedRandom(currentLength, true);
var randomSoundIndex = Math.floor(random(numRegularSounds));
var soundStartTime = soundDuration + (randomSoundIndex * soundDuration); // Offset by the spacebar sound.
soundStartTime;
}
} else {
// No new character, continue playing the last triggered sound.
var timeOfLastCharacter = time;
var lengthAtTime = currentLength;
while (lengthAtTime >= currentLength && timeOfLastCharacter > 0) {
timeOfLastCharacter -= thisComp.frameDuration;
lengthAtTime = textLayer.text.sourceText.valueAtTime(timeOfLastCharacter).length;
}
timeOfLastCharacter += thisComp.frameDuration;
var timeSinceLastKey = time - timeOfLastCharacter;
if (timeSinceLastKey < soundDuration) {
// Continue playing the sound that was triggered.
var lastCharIndex = textLayer.text.sourceText.valueAtTime(timeOfLastCharacter).length;
var lastChar = textLayer.text.sourceText.valueAtTime(timeOfLastCharacter).charAt(lastCharIndex - 1);
var lastSoundStartTime;
if (lastChar == " ") {
lastSoundStartTime = 0;
} else {
seedRandom(lastCharIndex, true);
var lastRandomSoundIndex = Math.floor(random(numRegularSounds));
lastSoundStartTime = soundDuration + (lastRandomSoundIndex * soundDuration);
}
lastSoundStartTime + timeSinceLastKey;
} else {
// Sound has finished, jump to a silent part.
thisLayer.source.duration;
}
}
} catch (e) {
// Error fallback.
thisLayer.source.duration;
}
It doesnt understand the delay and also its somehow chunky weird noises even tough on each sound FX there is a pause on the begining and in the end
Thanks in advance!