Skip to main content

Slice

Extracts a portion of an audio segment between specified start and end times, creating a new audio segment.

Common Properties

  • Name - The custom name of the node.
  • Color - The custom color of the node.
  • Delay Before (sec) - Waits in seconds before executing the node.
  • Delay After (sec) - Waits in seconds after executing node.
  • Continue On Error - Automation will continue regardless of any error. The default value is false.
info

If the ContinueOnError property is true, no error is caught when the project is executed, even if a Catch node is used.

Inputs

  • Audio Segment ID - The ID of the audio segment to slice.

Options

  • Start Time (ms) - Optional start time in milliseconds for the slice. Leave empty to start from the beginning.
  • End Time (ms) - Optional end time in milliseconds for the slice. Leave empty to extend to the end.

Output

  • segment_id - The ID of the newly created sliced audio segment.

How It Works

The Slice node extracts a portion of audio between two time points. When executed, the node:

  1. Validates the segment ID is not empty
  2. Retrieves the original audio segment
  3. Determines the slice range based on provided parameters:
    • Both start and end: Extract segment[start:end]
    • Only start: Extract from start to end segment[start:]
    • Only end: Extract from beginning to end segment[:end]
    • Neither: Return the full segment unchanged
  4. Creates a new segment with the sliced audio
  5. Establishes a dependency link in the processing graph
  6. Returns the ID of the new segment

Requirements

  • Valid audio segment ID (from Create, Concatenate, or other nodes)
  • Segment must exist in memory
  • Start time must be less than end time (if both provided)
  • Times must be within the segment duration

Slicing Modes

Mode 1: Specific Range (Both Start and End)

Start Time: 1000
End Time: 5000
Result: Audio from 1 second to 5 seconds (4 seconds total)

Mode 2: From Start Point (Only Start Time)

Start Time: 3000
End Time: (empty)
Result: Audio from 3 seconds to the end

Mode 3: To End Point (Only End Time)

Start Time: (empty)
End Time: 10000
Result: Audio from beginning to 10 seconds

Mode 4: No Slicing (Both Empty)

Start Time: (empty)
End Time: (empty)
Result: Complete audio segment (creates a copy)

Error Handling

The node will return specific errors in the following cases:

  • Audio segment ID is empty or null
  • Audio segment with the specified ID does not exist
  • Start time is greater than end time
  • Start or end time exceeds segment duration
  • Invalid time values (negative numbers)

Usage Examples

Example 1: Extract Middle Section

Extract a 30-second clip from the middle of audio:

  1. Create segment from audio.mp3
  2. Use Get Metadata to find duration
  3. Slice with Start Time: 30000, End Time: 60000
  4. Export the 30-second segment

Example 2: Remove Beginning

Skip the first 5 seconds of audio:

  1. Create segment from file
  2. Slice with Start Time: 5000, End Time: (empty)
  3. Result contains everything after 5 seconds

Example 3: Keep Only Beginning

Extract just the first 10 seconds:

  1. Create segment from file
  2. Slice with Start Time: (empty), End Time: 10000
  3. Export first 10 seconds

Example 4: Split Audio into Parts

Divide audio into multiple segments:

  1. Create original segment (segment_id_1)
  2. Slice 0-60000 → Part 1 (segment_id_2)
  3. Slice 60000-120000 → Part 2 (segment_id_3)
  4. Slice 120000-end → Part 3 (segment_id_4)
  5. Export each part separately

Example 5: Remove Intro and Outro

Extract only the main content:

  1. Create segment from podcast.mp3
  2. Get Metadata to find total duration
  3. Slice with Start Time: 10000 (skip 10s intro)
  4. Slice result with End Time: (duration - 15000) to remove 15s outro

Example 6: Precise Audio Editing

Extract exact moments from audio:

  1. Create segment
  2. Slice 5250-8750 (3.5 seconds of specific content)
  3. Use in compilation or highlight reel

Usage Notes

  • All times are in milliseconds (1000 ms = 1 second)
  • Slicing is non-destructive - original segment remains in memory
  • The new segment is independent and can be processed further
  • Multiple slices can be taken from the same source segment
  • Leaving both times empty creates a copy of the segment
  • Slicing preserves audio quality (no re-encoding)
  • Use Get Metadata first to know the segment duration
  • Sliced segments can be further sliced

Time Calculation Reference

  • 1 second = 1,000 milliseconds
  • 1 minute = 60,000 milliseconds
  • 5 minutes = 300,000 milliseconds
  • 1 hour = 3,600,000 milliseconds

Quick Conversions

Seconds to ms: seconds × 1000
Minutes to ms: minutes × 60000
ms to seconds: ms ÷ 1000

Performance Considerations

  • Slicing is very fast (near-instantaneous for most audio)
  • Memory usage depends on slice size, not original size
  • Multiple small slices are as efficient as one large slice
  • Sliced segments take up memory until deleted
  • Consider deleting unused slices to free memory

Common Use Cases

  • Removing intro/outro from recordings
  • Extracting highlights or key moments
  • Creating audio samples or previews
  • Splitting long recordings into manageable parts
  • Removing unwanted sections (silence, errors)
  • Creating podcast chapters
  • Building audio clips for compilation
  • Trimming recordings to specific lengths
  • Extracting answers from interview recordings
  • Creating audio snippets for social media

Best Practices

  • Use Get Metadata to determine segment length before slicing
  • Calculate times carefully (remember milliseconds!)
  • Store slice times in variables for dynamic slicing
  • Name your Slice nodes descriptively (e.g., "Extract Intro", "Remove Silence")
  • Delete unused slices to free memory
  • Validate that start < end when both are provided
  • Consider edge cases (very short audio, boundary times)
  • Test slicing parameters with sample audio first
  • Document your slicing logic for complex workflows

Advanced Techniques

Dynamic Slicing Based on Duration

1. Create segment
2. Get Metadata
3. Calculate: middle_start = duration / 2 - 15000
4. Calculate: middle_end = duration / 2 + 15000
5. Slice to extract 30 seconds from middle

Percentage-Based Slicing

1. Get Metadata (duration = 120000 ms)
2. Calculate: start = duration × 0.25 (25% point)
3. Calculate: end = duration × 0.75 (75% point)
4. Slice to extract middle 50%

Batch Slicing Multiple Segments

For each audio file:
1. Create segment
2. Get Metadata
3. Slice: 0 to duration/3 → Part 1
4. Slice: duration/3 to 2×duration/3 → Part 2
5. Slice: 2×duration/3 to end → Part 3
6. Export all parts

Working with Timestamps

From External Data

If you have timestamps from transcription or analysis:

Timestamp format: "00:01:23.500" (1 min, 23.5 sec)
Convert to ms: (1 × 60000) + (23 × 1000) + 500 = 83500
Use in Slice: Start Time = 83500

Creating Chapters

Chapter 1: 0 - 180000 (0:00 - 3:00)
Chapter 2: 180000 - 420000 (3:00 - 7:00)
Chapter 3: 420000 - end (7:00 - end)

Slice three times to create chapter segments

Error Prevention

  • Always validate segment ID exists
  • Check that times are within bounds using Get Metadata
  • Ensure start < end when both are specified
  • Use positive values only
  • Handle edge cases (zero-length slices)
  • Test with known good values first

Integration with Other Nodes

Works seamlessly with:

  • Create - Slice segments after creation
  • Get Metadata - Determine slice boundaries
  • Concatenate - Combine multiple slices
  • Speedup - Adjust speed of sliced segments
  • Export - Save sliced portions
  • Delete - Clean up unused slices

Troubleshooting

Slice returns empty audio

  • End time equals or less than start time
  • Times are beyond segment duration
  • Check with Get Metadata

Unexpected slice length

  • Verify time calculations (milliseconds)
  • Check start and end values
  • Use Get Metadata to confirm

"Segment does not exist" error

  • Segment was deleted
  • Invalid segment ID
  • Typo in variable name

Example Workflow: Podcast Processing

1. Create segment from raw_recording.wav
2. Get Metadata to find duration
3. Slice 0-5000 (remove first 5 seconds)
4. Slice 5000-(duration-10000) (remove last 10 seconds)
5. Export as clean_podcast.mp3
6. Delete segments to free memory

Example Workflow: Audio Highlighting

1. Create segment from long_meeting.mp3
2. Slice 120000-180000 (2:00-3:00 - key discussion)
3. Slice 420000-540000 (7:00-9:00 - decision made)
4. Slice 900000-960000 (15:00-16:00 - action items)
5. Concatenate all three slices
6. Export as meeting_highlights.mp3