A modern, Jetpack Compose-based Android library to visualize audio waveforms, playback progress, and interactively select or segment audio clips with ease.
- 📊 Graph Visualizations: Render line and bar graphs for audio amplitude data.
- 🎧 Playback Visualizer: Display a scrollable, center-pinned waveform synced to audio playback.
- ✂️ Audio Segmentation Tool: Select multiple audio segments using an intuitive timeline interface.
- 🔍 Audio Segment Picker: Zoom into waveform regions and fine-tune a single segment.
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)

- ✅ Drag to select segments
- 🛠️ Enable adjustments with min/max segment durations
- 📄 Output format:
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:
- Spike width, spacing, and corner radius
- Waveform alignment (
Top
,Center
,Bottom
) - Drawing style (
Fill
orStroke
) - Amplitude aggregation (
Max
,Average
) - Zoom levels and segment constraints
- Jetpack Compose
- ExoPlayer (integration friendly)
- Kotlin Coroutines
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