TesseraSession

Streaming multi-metric session — feed audio incrementally, get results on demand.

What is a Tessera Session?

The streaming counterpart to Tessera.analyze. Instead of passing a complete PitchContour, you feed raw audio or pre-extracted pitch incrementally via addAudio / addPitch. When you want results, call getResult — breath and agility are computed in batch on the full accumulated contour; vocal range bounds (lower/upper) come from a streaming histogram that updates as pitch arrives, while the search vector is recomputed in batch from the accumulated contour.

When to Use

ScenarioUse ThisWhy
Live voice profiling while recordingYesIncremental accumulation
Batch analysis from a complete recordingNoUse Tessera.analyze
Interactive guided range detectionNoUse TesseraRangeSession

Quick Start

Kotlin

val session = TesseraSession.create()

recorder.audioBuffers.collect { buffer ->
session.addAudio(buffer.samples, sampleRate = 48000)
}

val result = session.getResult()
println("Breath: ${result.breath?.controlScore}")
session.release()

Swift

let session = TesseraSession.create()

for await buffer in recorder.audioBuffers {
session.addAudio(samples: buffer.samples, sampleRate: Int32(hwRate))
}

let result = session.getResult()
print("Breath: \(result.breath?.controlScore ?? 0)")
session.release()

Common Pitfalls

  1. Call release() when done: Holds a pitch detector and range detector internally.

  2. addAudio requires a detector: The default create() always creates one. If you only use addPitch, the internal detector is created but unused — a minor overhead, not an error.

  3. getResult() can be called multiple times: Each call recomputes breath/agility on the accumulated data. Range uses the streaming histogram so it's cheap.

  4. Max session duration is 10 minutes: After that, old pitch points are trimmed from the accumulator.

See also

Batch counterpart (single-call analysis)

For guided interactive range detection

The result type (shared with Tessera)

Types

Link copied to clipboard
object Companion

Functions

Link copied to clipboard
fun addAudio(samples: FloatArray, sampleRate: Int = 16000)

Add raw audio samples. Resamples to 16kHz and extracts pitch internally.

Link copied to clipboard
fun addPitch(time: Float, pitchHz: Float, confidence: Float)

Add a pre-extracted pitch point. Skips internal pitch detection.

Link copied to clipboard

Compute all requested metrics from the accumulated data.

Link copied to clipboard
fun release()

Release all resources. Must be called when done.

Link copied to clipboard
fun reset()

Reset all accumulated data for a new session.