Nodes/ComfyUI-MMS-Aligner/MMS Audio-Text Aligner (SRT)
ComfyUI Node

MMS Audio-Text Aligner (SRT)

A ComfyUI node in audio/alignment with 15 inputs and 2 outputs.

By hnvcam·Created 4 months ago·Updated 3 months ago· 0
MMS Audio-Text Aligner (SRT)
  • audio
  • srt
  • output_path
text
languageauto
custom_language_code
romanizefalse
segmentation_modemax_chars+punctuation+newlines
max_chars_per_line42
remove_punctuationfalse
output_namesubtitles
gap_ms300
split_count1
precisionbf16
chunk_with_whisperfalse
whisper_model_sizebase
chunk_max_seconds360
Categoryaudio/alignment

Inputs (15)

NameTypeDefaultDescription
audioAUDIOAudio to align. Connect any node that outputs the ComfyUI AUDIO type (e.g. LoadAudio). Will be resampled to 16 kHz mono in memory.
textSTRINGTranscript to align with the audio. May contain punctuation and newlines, both of which can be used as segmentation cues for the SRT output.
languageCOMBOautoLanguage of the transcript. `auto` detects from the text. Pick `custom` to enter any ISO 639-3 code in `custom_language_code`. The FL102 model supports 102 languages — the chosen language loads its specific adapter weights and tokenizer.
custom_language_codeSTRINGISO 639-3 code (e.g. `vie`, `eng`, `cmn`). Used only when `language` is set to `custom`.
romanizeBOOLEANfalseRomanize the transcript before alignment using uroman. Generally NOT needed — the FL102 tokenizer is trained on each language's native script. Useful as a fallback if you see 'no alignable tokens' errors with text that contains unusual characters.
segmentation_modeCOMBOmax_chars+punctuation+newlinesHow to split words into SRT subtitle lines: - single_word: one word per cue (karaoke-style) - max_chars: pack greedily up to `max_chars_per_line` - punctuation: break at . ! ? , ; : - newlines: break at line breaks in the input text - combinations apply all selected rules
max_chars_per_lineINT420–1000Maximum characters per SRT line. 0 disables the limit (relevant only when `segmentation_mode` includes `max_chars`).
remove_punctuationBOOLEANfalseStrip punctuation (. , ! ? ; : " ( ) [ ] { } — – … « » “ ” ‘ ’) from the SRT output text. Apostrophes and hyphens are kept (so "don't" and "well-known" remain intact). Punctuation still drives segmentation when `segmentation_mode` includes it; only the displayed text is cleaned.
output_nameSTRINGsubtitlesBase file name (no extension) written to ComfyUI's output directory. The `.srt` extension is added automatically. When `split_count` > 1, files are named `<output_name>_<index>.srt`.
gap_msINT3000–5000Bridge small gaps between consecutive cues. If the gap between two cues is smaller than this many milliseconds, the previous cue's end is snapped to the next cue's start (prevents subtitle flicker during fluent speech, especially in `single_word` mode). Larger gaps are preserved as natural pauses. Set to 0 to disable.
split_countINT11–5Number of .srt files to split the output across. 1 (default) writes a single file. Higher values divide cues into near-equal chunks named `<output_name>_1.srt`, `<output_name>_2.srt`, ...
precisionCOMBObf16Compute precision for the MMS model: - bf16 (default): half the VRAM of fp32, wide dynamic range, accurate on Ampere+ GPUs - fp16: half the VRAM of fp32, may underflow on very long audio - fp8: experimental — quantizes Linear weights to float8_e4m3fn, requires PyTorch 2.1+ - fp32: full precision, highest VRAM usage
chunk_with_whisperBOOLEANfalseSplit long audio into smaller chunks using faster-whisper word-level timestamps to find safe split points. Required if MMS OOMs even at fp16/bf16 (typically audio > 15-20 min on consumer GPUs). Adds a Whisper pass before alignment, then merges chunk SRTs.
whisper_model_sizeCOMBObaseFaster-whisper model size used for chunk-point detection (only when chunk_with_whisper=True). `base` is usually plenty — we only need rough word timings to find anchor points. Larger models give more reliable matches in noisy or tonal-language audio at the cost of VRAM and speed.
chunk_max_secondsINT36060–1800Maximum length per chunk in seconds (only when chunk_with_whisper=True). 360s (6 min) is conservative and fits comfortably on 16 GB GPUs at bf16. Increase if your GPU has more VRAM and you want fewer chunks.

Outputs (2)

NameTypeDescription
srtSTRING
output_pathSTRING