KJNodes/audiogenerated

Play Sound KJ(PlaySoundKJ)

Plays the input audio in the browser. Modes: 'always' plays on every execution, 'on_empty_queue' plays only when the queue finishes, 'on_change' plays only when the audio content changes. Duration limits playback length (0 = full audio).

Play Sound KJ

any_input
audio
any_output
audio_path
STRING
mode
always
volume
0.50
duration
5.0
KJNodes

Description

Plays audio in the browser when execution reaches this node. The audio can be provided via an audio input (AUDIO type) or by specifying a file path in the audio_path string input (used when the audio input is not connected). The node offers three playback modes: always (play on every execution), on_empty_queue (play only when the queue finishes), and on_change (play only when the audio content changes). A duration parameter limits playback length; set to 0.0 to play the full audio file.

Inputs

NameTypeRequiredDefaultDescription
any_inputANYTYPENoA generic passthrough input. Allows you to insert this node into a workflow without breaking existing connections.
audioAUDIONoAudio data from another node (e.g., a VAE decode output). When connected, this is the audio source that will be played.
audio_pathSTRINGYes""File path to an audio file. Used only when the audio input is not connected. Leave empty if using the audio input.
modeCOMBOYes"always"Playback trigger mode. Options: "always" – plays on every execution; "on_empty_queue" – plays only when the queue finishes; "on_change" – plays only when the audio content (from audio input or audio_path) changes.
volumeFLOATYes0.5Playback volume, from 0.0 (silent) to 1.0 (full volume). Step size 0.01.
durationFLOATYes5.0Duration in seconds to play. Set to 0.0 to play the full audio. Range: 0.0 to 300.0, step 0.1.

Outputs

TypeDescription
ANYTYPEPasses through the value of the any_input input unchanged, enabling workflow continuity. If any_input is not connected, the output will be None.

Usage Notes

  • Audio source priority: When the audio input is connected, it takes precedence over audio_path. If both are provided, the audio input is used.
  • Mode behavior:
    • always – suitable for testing or continuous playback.
    • on_empty_queue – useful for playing a notification sound after a batch of generations completes.
    • on_change – plays only when the actual audio data (or the file path, if using audio_path) differs from the previous execution. This avoids repeated playback when the node is executed multiple times with the same audio.
  • Duration: A value of 0.0 plays the entire audio clip. Otherwise, playback is cut off after the specified number of seconds (up to 300 seconds maximum).
  • Volume: The volume is a linear gain applied to the audio. Values above 1.0 are not permitted; for amplification, pre-process the audio elsewhere.
  • Output: The any_input passthrough allows you to chain this node without affecting the data flow (e.g., connect it in parallel to a node whose output you wish to monitor audibly).
  • Browser environment: The audio is played through the browser's audio system. Ensure your browser has audio playback enabled and that any autoplay policies are satisfied (the node may require a user gesture on first execution).

Comments

Sign in with GitHub to join the discussion.

Loading comments…
Play Sound KJ (PlaySoundKJ) - ComfyUI-KJNodes | ComfyUI Wiki