Waveforms

object Waveforms

Audio apps draw the file. This decodes it into the shape they draw.

Functions

Link copied to clipboard
suspend fun of(item: MediaItem, buckets: Int = 1000, stream: TrackId? = null): Waveform

Decodes the primary audio stream, or stream, into buckets equal time slices of peak and RMS, the channels averaged to mono first. Reads the whole stream; seconds on a long album, so call it off the main thread. Samples are placed by counting them from the start at the stream's rate, so a file with gaps in its timeline draws them closed up.