Compose AudioWaveform

GitHub release (latest by date) GitHub

GitHub followers GitHub stars GitHub forks


AudioWaveform is a lightweight Jetpack Compose library which draws waveform of audio. Library uses compose Canvas API under the hood. It helps us to create customizable and flexible waveforms. This library was inspired by the WaveformSeekBar library (xml implementation). AudioWaveform is fully compatible with Amplituda library.

Waveforms created with AudioWaveform


allprojects {
  repositories {
    maven { url '' }

dependencies {
  implementation 'com.github.lincollincol:compose-audiowaveform:x.y.z'


Common way

var waveformProgress by remember { mutableStateOf(0F) }
  amplitudes = amplitudes,
  progress = waveformProgress,
  onProgressChange = { waveformProgress = it }

Custom color

  • SolidColor() – single color Brush.
  • Brush.horizontalGradient(), Brush.verticalGradient() (and more) – default Brush static gradient implementations.
  • Brush.infinite*Gradient() (where * is one of linear, horizontal or vertical) – infinite animated gradient. This is AudioWaveform library extension functions created with this article.

var waveformProgress by remember { mutableStateOf(0F) }

val colorBrush = SolidColor(Color.Magenta)

val staticGradientBrush = Brush.linearGradient(colors = listOf(Color(0xff22c1c3), Color(0xfffdbb2d)))

val animatedGradientBrush = Brush.infiniteLinearGradient(
  colors = listOf(Color(0xff22c1c3), Color(0xfffdbb2d)),
  animation = tween(durationMillis = 6000, easing = LinearEasing),
  width = 128F

  progress = waveformProgress,
  progressBrush = brush,
  amplitudes = amplitudes,
  onProgressChange = { waveformProgress = it }

All parameters

var waveformProgress by remember { mutableStateOf(0F) }
  modifier = Modifier.fillMaxWidth(),
  // Spike DrawStyle: Fill or Stroke 
  style = Fill,
  waveformAlignment = WaveformAlignment.Center, 
  amplitudeType = AmplitudeType.Avg,
  // Colors could be updated with Brush API
  progressBrush = SolidColor(Color.Magenta),
  waveformBrush = SolidColor(Color.LightGray),
  spikeWidth = 4.dp,
  spikePadding = 2.dp,
  spikeRadius = 4.dp,
  progress = waveformProgress,
  amplitudes = amplitudes,
  onProgressChange = { waveformProgress = it },
  onProgressChangeFinished = {}

Sample app

You could also try sample app, which demonstrates all AudioWaveform library features. Waveform from sample app is also synchronized with Media3. Download sample app apk here.

Amplituda compatibility

AudioWaveform requires amplitudes to draw waveform. This parameter is a list of integers, which represents audio data. You can process the audio file by yourself or use already existing library Amplituda. Amplituda is a fast audio processing library, which provides you data for drawing waveforms. Library has caching and compressing processed data features out of the box. Here is Amplituda library usage in a sample app.


   Copyright 2022-present lincollincol

   Licensed under the Apache License, Version 2.0 (the "License");
   you may not use this file except in compliance with the License.
   You may obtain a copy of the License at

   Unless required by applicable law or agreed to in writing, software
   distributed under the License is distributed on an "AS IS" BASIS,
   See the License for the specific language governing permissions and
   limitations under the License.


View Github