Dataclay — Automating Digital Production
    • Categories
    • Recent
    • Tags
    • Popular
    • Users
    • Register
    • Login

    Tip: After Effects expression to fade out audio

    Scheduled Pinned Locked Moved
    Templates
    4
    8
    1.6k
    Loading More Posts
    • Oldest to Newest
    • Newest to Oldest
    • Most Votes
    Reply
    • Reply as topic
    Log in to reply
    This topic has been deleted. Only users with topic management privileges can see it.
    • Jonundefined
      Jon
      last edited by

      Hello! A quick tip on how to fade audio with Templater via an expression. Since Templater can dynamically swap a wide variety of media sources of varying lengths, you can’t count on keyframes to be able to accommodate the variation of durations for consistent fade-outs of audio tracks. Here’s a sample of how to do that. Apply this expression to the Audio Levels.

      fadeTime = 30; //frames for fade
      audio.audioLevelsMin = -48; 
      audio.audioLevelsMax = audio.audioLevels[0];
      layerDuration = outPoint - inPoint;
      singleFrame = thisComp.frameDuration;
      animateOut = linear(time, (outPoint - framesToTime(fadeTime+1)), (outPoint-singleFrame), audio.audioLevelsMax, audio.audioLevelsMin);
      [animateOut,animateOut];
      

      In this example, the expression takes the audio level you’ve set and fades to -48 db over 30 frames (assuming 30fps composition, that is 1 second).

      VideoHoneyundefined 1 Reply Last reply Reply Quote 3
      • GwynEavesundefined
        GwynEaves
        last edited by GwynEaves

        This post is deleted!
        1 Reply Last reply Reply Quote 1
        • VideoHoneyundefined
          VideoHoney @Jon
          last edited by

          @jon I tried this expression to AE 2023 and it does not fade the audio.
          There are no any error messages either, but I did not see this would have done anything.
          Could you please confirm this expression is working on AE 2023?

          Jonundefined 1 Reply Last reply Reply Quote 0
          • Jonundefined
            Jon @VideoHoney
            last edited by

            @videohoney I just tested in AE 2023 and it still appears to be working. Are you applying the expression to the Audio Levels property? Is it the only expression on that property for that layer?

            VideoHoneyundefined 1 Reply Last reply Reply Quote 0
            • VideoHoneyundefined
              VideoHoney @Jon
              last edited by

              @jon Thank you for checking.
              Yes, the expression is applied to the Audio Levels property, and it is only expression.
              Here is a screenshot:
              AE Audio Fade Expression.png

              The audio does not fade at the end.
              I do not know what I am doing wrong.

              Jeffundefined Jonundefined 2 Replies Last reply Reply Quote 0
              • Jeffundefined
                Jeff @VideoHoney
                last edited by

                @videohoney

                From the screenshot you posted, it appears that the work area/overall comp length might be cutting the audio layer off before it can get to the end, where the fade-out occurs. Would it be possible to adjust the duration of the “render” comp to ensure it’s long enough to get to the end of the audio file?

                It might also be helpful to apply Templater to the layer and then check the “Comp Starts at In Point” and “Comp Ends at Out Point” options under the “Time” section. This should ensure that the comp is resized to fit the whole duration of the clip into the timeline.

                If that doesn’t work, let us know, and we’ll see where we need to go from there. Additionally, please feel free to get in touch with us at support@dataclay.com if you’d like to move this discussion to a more direct setting.

                Thanks!

                1 Reply Last reply Reply Quote 0
                • Jonundefined
                  Jon @VideoHoney
                  last edited by

                  @videohoney did Jeff’s suggestion help? From the screenshot, the expression is likely working, but you have to shorten the length of the audio track (or extend the length of the comp) for the fade to work correctly. Also, the audio.audioLevels on the first line of your expression shouldn’t be included.

                  VideoHoneyundefined 1 Reply Last reply Reply Quote 0
                  • VideoHoneyundefined
                    VideoHoney @Jon
                    last edited by

                    @Jon Sorry for the late reply.
                    Yes, I got everything working with Jeff’s advice and your tips.
                    Big thanks for the help.

                    1 Reply Last reply Reply Quote 0
                    • First post
                      Last post