waveform_pro 1.1.0 copy "waveform_pro: ^1.1.0" to clipboard
waveform_pro: ^1.1.0 copied to clipboard

Production-quality Flutter waveform widget with GPU-accelerated rendering, discrete bars, curved splines, dual-color progress, zoom, markers, and audio peak extraction.

waveform_pro #

Pub Version Pub Points Pub Likes CI License Platform

A production-quality, GPU-accelerated Flutter audio waveform visualization library supporting continuous envelopes, discrete SoundCloud-style bars, bezier curved splines, dual-color playback progress, interactive zooming/panning, draggable region selection, cue markers, live audio stream buffering, and headless PNG exports.

Now available on pub.flutter-io.cn/packages/waveform_pro.


✨ Features #

  • πŸ“Š Multiple Render Modes:
    • WaveformRenderMode.continuous β€” Classic mirrored continuous path.
    • WaveformRenderMode.bars β€” Discrete rounded vertical bars (SoundCloud & Apple Voice Memos style).
    • WaveformRenderMode.curvedSpline β€” Ultra-smooth cubic bezier spline curves.
  • ⏯️ Dual-Color Playback Progress β€” Colorize played vs unplayed waveform segments (playedWaveColor vs waveColor) based on playheadPosition.
  • ⚑ Multi-Resolution Pyramid Caching β€” Decimates waveform data at powers-of-two for 60fps rendering across any zoom level.
  • πŸ” Interactive Timeline β€” Pinch-to-zoom, horizontal drag/pan, and programmatic WaveformController with automatic viewport adaptation.
  • πŸ“ Regions & Cue Markers β€” Interactive region selection with draggable bounds and labeled cue bookmarks.
  • πŸŽ™οΈ Live Audio Buffer Support β€” Dynamically append audio peaks to WaveformData (data.append(...)) for real-time recorders.
  • πŸ–ΌοΈ Headless PNG Image Exporter β€” Generate waveform images directly to Uint8List via WaveformExporter.toPngBytes(...) without mounting widgets.
  • 🎨 Built-in Presets β€” Ready-to-use themes like WaveformStyle.voiceMemo and WaveformStyle.neonGlow.

πŸ“¦ Installation #

Add waveform_pro to your Flutter project:

flutter pub add waveform_pro

Or add it to your pubspec.yaml dependencies:

dependencies:
  waveform_pro: ^1.1.0

Import:

import 'package:waveform_pro/waveform_pro.dart';

πŸš€ Usage #

1. Basic Waveform Timeline (SoundCloud / Voice Memos Bar Style) #

import 'package:flutter/material.dart';
import 'package:waveform_pro/waveform_pro.dart';

class AudioPlayerWaveform extends StatelessWidget {
  final WaveformData waveformData;

  const AudioPlayerWaveform({super.key, required this.waveformData});

  @override
  Widget build(BuildContext context) {
    return WaveformTimeline(
      data: waveformData,
      style: WaveformStyle.voiceMemo,
      playheadPosition: 12.4, // seconds played
      playheadColor: Colors.blueAccent,
      showTimeRuler: true,
      onTap: (seconds) {
        print('User seeked to: ${seconds}s');
      },
      onRegionChanged: (start, end) {
        print('Selected region: $start - $end');
      },
    );
  }
}

2. Smooth Curved Spline Mode #

WaveformTimeline(
  data: waveformData,
  style: WaveformStyle.neonGlow,
  playheadPosition: 5.0,
  height: 140,
)

3. Live Streaming / Real-time Audio Recording #

WaveformData liveData = WaveformData(samples: [], durationSeconds: 0);

// As microphone buffer packets arrive:
void onAudioBufferReceived(List<double> newPeaks, double bufferDuration) {
  setState(() {
    liveData = liveData.append(newPeaks, addedDurationSeconds: bufferDuration);
  });
}

4. Headless PNG Image Export (Thumbnails / Notifications) #

import 'dart:typed_data';
import 'package:waveform_pro/waveform_pro.dart';

Future<Uint8List> generateWaveformThumbnail(WaveformData data) async {
  return await WaveformExporter.toPngBytes(
    data: data,
    width: 600,
    height: 150,
    style: WaveformStyle.voiceMemo,
    playheadPosition: 20.0,
  );
}

πŸ› οΈ API Overview #

Class Description
WaveformTimeline Interactive Flutter widget with gesture support, time ruler, cue markers, and playhead.
WaveformPainter Custom painter executing GPU-accelerated continuous, discrete bar, and spline rendering.
WaveformRenderMode Enum (continuous, bars, curvedSpline) defining the visual geometry.
WaveformStyle Styling configuration (bar width, gaps, radiuses, wave colors, played progress color).
WaveformData Pyramid-cached sample container with .generate(), .append(), and multi-res getters.
WaveformController Programmatic zoom, scroll, region selection, and marker management.
WaveformExporter Headless rasterizer for exporting waveforms to PNG byte buffers.

πŸ§ͺ Testing #

flutter test

πŸ“„ License #

This package is licensed under the MIT License.

2
likes
0
points
500
downloads

Publisher

verified publishergovindtank.is-a.dev

Weekly Downloads

Production-quality Flutter waveform widget with GPU-accelerated rendering, discrete bars, curved splines, dual-color progress, zoom, markers, and audio peak extraction.

Repository (GitHub)
View/report issues

Topics

#audio #waveform #visualization #player #flutter

License

unknown (license)

Dependencies

flutter

More

Packages that depend on waveform_pro