AudioWaveform
A highly customizable audio waveform visualization composable.
Supports multiple visualization styles, smooth animations, playback progress tracking, and interactive seeking.
Basic Usage
AudioWaveform(
amplitudes = recorderState.liveAmplitudes,
modifier = Modifier.fillMaxWidth().height(64.dp)
)With Custom Style
AudioWaveform(
amplitudes = amplitudes,
style = WaveformStyle.Mirrored(barWidth = 4.dp, gap = 4.dp),
colors = WaveformColors.PurpleGradient,
modifier = Modifier.fillMaxWidth().height(80.dp)
)With Playback Progress
AudioWaveform(
amplitudes = amplitudes,
progress = playbackProgress,
onProgressChange = { newProgress -> seekTo(newProgress) },
colors = WaveformColors(
waveColor = SolidColor(Color.Gray),
progressColor = SolidColor(Color.Green),
),
modifier = Modifier.fillMaxWidth().height(48.dp)
)Available Styles
WaveformStyle.Bar - Classic vertical bars (default)
WaveformStyle.Spike - Thin spikes like SoundCloud
WaveformStyle.Line - Smooth connected line graph
WaveformStyle.Mirrored - Symmetric bars (ideal for recording)
WaveformStyle.Filled - Filled area under the curve
Parameters
List of amplitude values (0.0 to 1.0). Values outside this range are clamped.
Modifier for the waveform. Must include size constraints (e.g., fillMaxWidth(), height()).
Visualization style. Defaults to WaveformStyle.Bar.
Color configuration. Defaults to WaveformColors.default.
Playback progress (0.0 to 1.0). Bars before this point use progressColor.
Callback when user seeks via tap/drag. Pass null to disable interaction.
Whether to animate amplitude changes. Defaults to true.
Animation specification for amplitude transitions.
See also
Simplified overload for basic waveform display without progress tracking.
Parameters
List of amplitude values (0.0 to 1.0)
Modifier for the waveform
Visualization style
Color configuration
Whether to animate amplitude changes