Waveform
0.1.1indexedRenders scrollable, center‑pinned waveforms synced to playback; enables multi‑segment selection, precise segment picking, zooming, bar/line graphs and extensive visual customization.
15
Stars
—
Used by
dependents
—
Health
/ 100
Renders scrollable, center‑pinned waveforms synced to playback; enables multi‑segment selection, precise segment picking, zooming, bar/line graphs and extensive visual customization.
A modern, Jetpack Compose-based Android library to visualize audio waveforms, playback progress, and interactively select or segment audio clips with ease.
dependencies {
implementation("io.github.karya-inc:waveform:<latest-version>")
}
@Composable
fun BarGraphExample() {
AmplitudeBarGraph(
amplitudes = listOf(100, 200, 300, 500, 100, 20),
onProgressChange = { newProgress -> /* handle scrub */ }
)
}
@Composable
fun PlaybackVisualizer() {
CenterPinnedAmplitudeBarGraph(
amplitudes = listOf(100, 200, 300, 500, 100, 20),
durationMs = 2000,
progressMs = 1000
)
}
val segmentationState = rememberAudioSegmentationState(
audioFilePath = audioPath,
amplitudes = amplitudeList,
durationMs = totalDuration,
enableAdjustment = true
)
AudioSegmentationUi(state = segmentationState)
List<Pair<startMs, endMs>>Zoom into a waveform and select a precise segment interactively.
val pickerState = rememberAudioSegmentPickerState(
audioFilePath = audioPath,
amplitudes = amplitudeList,
durationMs = totalDuration,
segment = Pair(0, totalDuration / 4),
window = Pair(0, totalDuration / 8)
)
AudioSegmentPicker(
state = pickerState,
mainPlayerProgress = pickerState.activeSegment.first + currentProgress,
segmentPlaybackProgress = pickerState.activeSegment.first + currentProgress,
isPlaying = isPlaying,
toggleSegmentPlayback = {
val segment = pickerState.activeSegment
// Control playback with your own ExoPlayer instance
}
)
Graph(
amplitudes = listOf(200f, 30f, 45f, 5f, 16f, 20f),
type = GraphType.Bar,
maxAmplitude = 300f
)
Graph(
amplitudes = listOf(200f, 30f, 45f, 5f, 16f, 20f),
type = GraphType.Line,
maxAmplitude = 300f
)
You can customize:
Top, Center, Bottom)MIT License. See LICENSE for details.
Contributions, bug reports, and feature suggestions are welcome! Feel free to open an issue or pull request.
This library is inspired by compose-audiowaveform by lincollincol
Fill or Stroke)Max, Average)Surfaced from shared tags and platforms — no rankings paid for.