RealWaveformGenerator class

Service for generating waveform visualization data from audio sources.

Supports three strategies:

  1. WAV files — Parses raw PCM data to extract real amplitude information.
  2. Duration-based — Uses AudioPlayer to get duration, then generates a visually realistic waveform seeded by the URL (deterministic).
  3. Fallback — Random but plausible waveform if all else fails.

Usage:

final data = await RealWaveformGenerator.generateWaveformFromAudio(
  'https://example.com/audio.mp3',
  targetBars: 50,
  minHeight: 2.0,
  maxHeight: 25.0,
);

Constructors

RealWaveformGenerator()

Properties

hashCode → int
The hash code for this object.
no setterinherited
runtimeType → Type
A representation of the runtime type of the object.
no setterinherited

Methods

noSuchMethod(Invocation invocation) → dynamic
Invoked when a nonexistent method or property is accessed.
inherited
toString() → String
A string representation of this object.
inherited

Operators

operator ==(Object other) → bool
The equality operator.
inherited

Static Methods

clearCache() → void
Clears the waveform cache to free memory.
generateWaveformFromAudio(String audioSource, {int targetBars = 50, double minHeight = 2.0, double maxHeight = 30.0, bool isAsset = false}) → Future<List<double>>
Generates waveform data suitable for visualization.