Split Audio icon

Split Audio

Splits an audio file into various chunks and returns the filenames of those chunks

Split Audio

AI-generated

Overview

This node splits a given audio file into multiple smaller chunks based on specified chunk length and overlap duration. It processes the input audio file, divides it into segments with optional overlapping seconds between consecutive chunks, and outputs the filenames of these generated audio chunks.

Common scenarios where this node is useful include:

  • Preparing audio files for transcription services that have maximum file size or duration limits.
  • Creating preview clips or samples from longer audio recordings.
  • Segmenting podcasts or interviews into manageable parts for easier distribution or analysis.

For example, if you have a 1-hour podcast episode and want to split it into 15-minute segments with 1.5 minutes overlap to maintain context between chunks, this node can automate that process and output the paths to each segment file.

Properties

Name Meaning
Chunk Length (Seconds) Duration in seconds of each audio chunk to create.
Overlap Length (Seconds) Number of seconds each chunk overlaps with the previous one to maintain continuity.
Input File Path Full path to the source audio file to be split.
Output File Path Template Template for naming output chunk files. Use %i as a placeholder for the chunk index number.

Output

The node outputs a JSON array where each item contains a chunkFiles field. This field is an array of strings representing the file paths of the generated audio chunks.

Example output structure:

[
  {
    "chunkFiles": [
      "split_chunk_0.mp3",
      "split_chunk_1.mp3",
      "split_chunk_2.mp3"
    ]
  }
]

No binary data is output directly by the node; instead, it provides references to the saved chunk files.

Dependencies

  • The node relies on the fluent-ffmpeg library to handle audio processing and splitting.
  • The system running the node must have FFmpeg installed and accessible in the environment's PATH, as fluent-ffmpeg is a wrapper around the FFmpeg command-line tool.
  • No additional API keys or external services are required.

Troubleshooting

  • Error: Could not find duration
    This error occurs if the node cannot determine the length of the input audio file. Ensure the input file path is correct and points to a valid audio file.

  • FFmpeg not found or execution errors
    If the node fails during chunk creation, verify that FFmpeg is installed on your system and accessible via the command line. You can test this by running ffmpeg -version in your terminal.

  • Output file naming issues
    Make sure the output template includes %i to generate unique filenames for each chunk. Omitting this may cause overwriting of files or unexpected behavior.

  • File permissions
    Confirm that the node has read access to the input file and write access to the directory where output chunks will be saved.

Links and References

Discussion