diarize: Speaker Diarization

View source: R/diarize.R

diarizeR Documentation

Speaker Diarization

Description

Finds who spoke when in a recording. Speakers are numbered from 1 in order of first arrival; up to eight are tracked.

Usage

diarize(
  audio,
  model = NULL,
  threshold = 0.5,
  probs = FALSE,
  sample_rate = 16000L
)

Arguments

audio

Path to an audio or video file, or a numeric vector of 16 kHz mono samples.

model

A model from load_n3d. Loaded on first use when NULL.

threshold

Speaker probability above which a frame counts as speech.

probs

Whether to also return the per-frame probabilities.

sample_rate

Sampling rate of numeric audio; must be 16000.

Details

The recording is processed offline in 27.2 s chunks with 3.2 s of look-ahead, carrying the arrival-order speaker cache between chunks, so its length is not limited.

Value

A data frame of segments with columns start, end (seconds) and speaker. With probs = TRUE, a list of segments and probs, a frames x 8 matrix with one frame per 10 ms.

Examples


if (n3d_exists()) {
  model <- load_n3d()
  mp3 <- system.file("samples", "Synapsis-Wonderland.mp3", package = "av")
  diarize(mp3, model)
}


n3d documentation built on Oct. 14, 2026, 5:08 p.m.

Related to diarize in n3d...