Skip to main content

splitbuf

splitbuf(
@buffer ## llll (required)
@split 100
@mode 0
@overlap 1
@partials 1
) -> llll

Splits a buffer into multiple segments. Based on the split mode, it segments the buffer based on segment duration, number of segment, or split points.


Arguments

  • @buffer [llll]: Buffer to segment. (required)
  • @split [int/float/list]: Split value, based on split mode. (default: 100).
  • @mode [int]: Segmentation mode (default: 0).
    • 0: Segment duration.
    • 1: Number of segments.
    • 2: Split points.
  • @overlap [int/float]: Overlap factor. Ignored if @mode is 2. (default: 1).
  • @partials [int]: When @mode < 2, always include trailing buffer. (default: 1).
    • 0: Off
    • 1: On

Output

List of segmented buffers. [llll]


Usage

$buf = importaudio('singing.wav');
$segdur = 250;
$segments = $buf.splitbuf(@split $segdur); ## split into 200 ms segments;
$onset = 0;
for $seg in rev($segments) do (
$seg.transcribe(@onset $onset);
$onset += $segdur
);
render(@play 1)