SonixFrames

Utilities for converting between frame indices and time (seconds).

In audio processing, pitch detection and feature extraction operate on overlapping frames. A frame index f with hop length h at sample rate sr corresponds to time f * h / sr seconds. This utility converts between the two representations.

See also

Uses frame-based timing internally

Functions

Link copied to clipboard
fun framesToTime(frame: Int, sampleRate: Int, hopLength: Int): Double

Convert frame index to time (in seconds).

fun framesToTime(frames: List<Int>, sampleRate: Int, hopLength: Int): List<Double>

Convert list of frame indices to times.

Link copied to clipboard
fun timeToFrames(time: Double, sampleRate: Int, hopLength: Int): Int

Convert time (in seconds) to frame index.

fun timeToFrames(times: List<Double>, sampleRate: Int, hopLength: Int): List<Int>

Convert list of times to frame indices.