PitchContour

data class PitchContour(val samples: List<PitchPoint>, val sampleRate: Int = 16000, val hopSize: Int = 0)

A sequence of PitchPoints representing a pitch contour over time.

The primary data type flowing through the tona pipeline: PitchDetection produces it, PitchProcessing cleans it, PitchAnalysis analyzes it, and downstream modules (tessera, accura, calibra) consume it.

Construct via fromArrays (from parallel time/pitch arrays), fromPoints (from a list), or fromPitchData (from parsed file data).

See also

PitchDetection.createDetector

For realtime contour accumulation

PitchDetection.createContourExtractor

For batch extraction

PitchProcessing.process

For cleaning a contour

Constructors

Link copied to clipboard
constructor(samples: List<PitchPoint>, sampleRate: Int = 16000, hopSize: Int = 0)

Types

Link copied to clipboard
object Companion

Properties

Link copied to clipboard

Duration of the contour in seconds

Link copied to clipboard

Hop size in samples between pitch frames (0 = unknown/unset).

Link copied to clipboard

True if contour has no samples

Link copied to clipboard

Pitches in Hz (fast path). Unvoiced frames use -1.

Link copied to clipboard

Pitches in MIDI for native evaluator (fast path). Unvoiced frames use -1.

Link copied to clipboard

Original audio sample rate (default 16kHz).

Link copied to clipboard

List of pitch points in chronological order.

Link copied to clipboard
val size: Int

Number of samples in the contour

Link copied to clipboard

Times array for native evaluator (fast path)

Link copied to clipboard

Ratio of voiced samples to total samples (0.0 - 1.0)

Functions

Link copied to clipboard
fun slice(startTime: Float, endTime: Float, relativeTimes: Boolean = true): PitchContour

Extract a slice of the contour within a time range.

Link copied to clipboard

Get pitches as a FloatArray (for compatibility with internal APIs).

Link copied to clipboard

Get times as a FloatArray (for compatibility with internal APIs).