| n3d_stream | R Documentation |
Opens a streaming session: push audio as it arrives and get speaker probabilities for each completed chunk. The speaker cache keeps speaker numbering consistent across the whole stream.
n3d_stream(model, mode = "low_latency")
model |
A model from |
mode |
Streaming mode: |
Latency is the audio a chunk waits for, its frames plus look-ahead:
1.04 s for "low_latency", 0.64 s for "very_low_latency" and
0.32 s for "ultra_low_latency", excluding compute time.
Every step re-encodes the speaker cache and FIFO queue (about 540 encoder frames) to score one chunk, so keeping up with live audio needs a GPU; on a CPU a step takes seconds.
An n3d_stream session.
n3d_stream_push, n3d_stream_finish
if (n3d_exists()) {
model <- load_n3d()
mp3 <- system.file("samples", "Synapsis-Wonderland.mp3", package = "av")
samples <- load_audio(mp3)
s <- n3d_stream(model)
probs <- list()
for (start in seq(1, length(samples), by = 8000)) {
piece <- samples[start:min(start + 7999, length(samples))]
probs[[length(probs) + 1]] <- n3d_stream_push(s, piece)
}
probs[[length(probs) + 1]] <- n3d_stream_finish(s)
probs_to_segments(do.call(rbind, probs))
}
Add the following code to your website.
For more information on customizing the embed code, read Embedding Snippets.