ComfyUI Node

Calc Audio

Calc Audio — the audio math so you never have to think about atempo again

By LaserDog80·Created 4 months ago·Updated 4 months ago· 0
Calc Audio
    • audio_params
    • summary
    source_fps24.000
    target_fps25.000
    audio_modeallow_shift
    sample_rate48000

    When you change a video's framerate by changing its speed, the audio has to change with it or the whole thing falls apart. And "change the audio speed" hides a genuinely fiddly problem: FFmpeg's atempo filter only works cleanly between 0.5× and 2.0×, so a 5× speed change needs to be chained as atempo=2.0,atempo=2.0,atempo=1.25. Get that wrong and you get distorted audio nobody asked for.

    Calc Audio is the node in the Framerate Converter pack (Trope Tools, TropeMedia) that does all that arithmetic so you don't have to. Pure math, no FFmpeg calls - it just computes the right filter string and hands it off to Build Command. Feed it source fps, target fps, and an audio mode, and out comes an AUDIO_PARAMS bundle plus a plain-English summary.

    Inputs

    • source_fps / target_fps - the same pair you gave Calc Conversion.
    • audio_mode - the four-way choice: allow_shift (default), preserve_pitch, copy, no_audio.
    • sample_rate - optional, default 48000. Only matters for preserve_pitch.

    What each mode computes

    • allow_shift - builds the chained atempo filter for the speed factor and reports the pitch shift in semitones (12·log₂(speed)). For 24→25 that's about +0.70 semitones - audibly nothing to most people, which is why it's the default.
    • preserve_pitch - the clever one. It computes an intermediate sample rate (sample_rate × speed_factor) and produces an asetrate + aresample chain, which speed-adjusts the audio while re-pitching it back to normal. This is the mode to pick if you're picky about pitch.
    • copy - passes the audio through untouched. The summary will cheerfully warn you this desyncs from speed-changed video, because it will.
    • no_audio - produces an empty filter and strips the track.

    The summary output tells you which mode ran and what it did, including the intermediate sample rate for preserve_pitch:

    Audio mode: preserve_pitch
    Audio speed-adjusted with pitch correction
    Intermediate sample rate: 50000Hz -> 48000Hz
    

    The audio_params output is what Build Command consumes.

    Install

    Standard pack install: ComfyUI Manager → Trope Tools - Framerate Converter, or git clone https://github.com/LaserDog80/ComfyUI-FramerateConverter into custom_nodes/ and restart. No pip dependencies.

    You'll likely only reach for it directly when building a custom conversion chain or when you want to force preserve_pitch and verify the numbers. For everyone else, the flagship Convert Framerate node calls it internally - with one nice touch: if the source has no audio at all, the composite node auto-forces no_audio so a silent render doesn't crash on a missing stream. That's the kind of edge case this pack quietly handles for you.

    CategoryTrope Tools/Framerate Converter/Configure

    Inputs (4)

    NameTypeDefaultDescription
    source_fpsFLOAT24.0001–240
    target_fpsFLOAT25.0001–240
    audio_modeCOMBOallow_shift4 options: allow_shift, preserve_pitch, copy, no_audio
    sample_rateoptINT480008000–384000

    Outputs (2)

    NameTypeDescription
    audio_paramsAUDIO_PARAMS
    summarySTRING