Forum Replies Created

Page 1 of 2
  • Nihad Spahic

    October 29, 2025 at 7:39 am in reply to: Audio sound effects follow type

    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!



  • Nihad Spahic

    March 17, 2022 at 6:37 pm in reply to: Controling time between keyframes

    Thanks Dan! This is exactly what I need.

  • Nihad Spahic

    March 7, 2022 at 12:11 pm in reply to: Randomize slider every 30 frames

    Hey Filip,

    works like a charm! Thank you so much, exactly what I needed.

  • Nihad Spahic

    January 24, 2022 at 8:39 pm in reply to: Conditinal statement if/else

    Thank you so much! It works. Basically, when I select 4 of twenty layers based on their index number, I can change their color separately.

  • Nihad Spahic

    January 24, 2022 at 6:17 pm in reply to: Conditinal statement if/else

    Hey Dan,

    I have one more question, if I have on a settings layer four color controls named Color 01, 02, 03, and 04 and on each layer color fill. Is it possible to control color fill separately?

    For example, I have 20 layers which opacity I am controlling with 4 sliders as in the example above, I would love to colorize those 4 layers with separate colors.


    Cheers!

  • Nihad Spahic

    January 20, 2022 at 7:17 am in reply to: Conditinal statement if/else

    Thanks Dan!

  • Nihad Spahic

    January 19, 2022 at 8:27 pm in reply to: Conditinal statement if/else

    Thank you! Works like a charm!

    Could you please explain to me what is happening in the last line of code, I understand this part a == index || b == index || c == index || d == index || e == 1 any of these needs to be true, but I don’t understand “? 100 : 0”

    Thanks

  • Nihad Spahic

    November 14, 2021 at 4:11 pm in reply to: Linkin audio to scale

    Hey Tomas, thank you so much for your answer. I assumed it’s not possible, but wanted to confirm with professionals 🙂

    I’ve tried to make a circle scale react to audio but as a template. Been trying with audio spectrum and a circle mask but its impossible to imitate a circle scaling to audio.

    Cheers!

  • Nihad Spahic

    November 5, 2021 at 6:27 am in reply to: Move layer x pixels every nn frames and then stop

    Thank you so much!

  • Nihad Spahic

    November 4, 2021 at 7:58 pm in reply to: Move layer x pixels every nn frames and then stop

    Hey Dan, one more question. I have tried to use it on the Y-axis as well, but when I change to jumpY it stay on an X-axis? Regards

Page 1 of 2

We use anonymous cookies to give you the best experience we can.
Our Privacy policy | GDPR Policy