Waveform class final

A class for generating and managing audio waveforms.

The Waveform class allows you to create and manipulate various types of audio waveforms (sine, square, sawtooth, triangle) using a flexible API. It is particularly useful for testing audio pipelines or generating procedural audio signals.

Example Usage:

final waveform = Waveform(
  config: WaveformSineConfig(
    sampleFormat: PcmFormat.f32,
    sampleRate: 44100,
    channels: 2,
    amplitude: 1.0,
    frequency: 440.0,
  ),
);

final pcmFrames = waveform.readWaveformPcmFrames(frameCount: 1024);
print('Read ${pcmFrames.framesRead} frames');

waveform.dispose();
Implemented types

Constructors

Waveform.new({required BaseWaveformConfig config})
Creates a new waveform instance based on the provided configuration.
factory

Properties

config → BaseWaveformConfig
The waveform configuration used for generating PCM frames.
final
finalizer NativeFinalizer
Finalizer used to release the native resource.
no setter
hashCode int
The hash code for this object.
no setterinherited
isFinalized bool
Indicates whether the resource has been disposed or finalized.
no setterinherited
runtimeType Type
A representation of the runtime type of the object.
no setterinherited

Methods

dispose() → void
Releases the resource manually.
inherited
ensureIsNotFinalized() Pointer<Void>
Ensures that the resource is not finalized before accessing it.
inherited
noSuchMethod(Invocation invocation) → dynamic
Invoked when a nonexistent method or property is accessed.
inherited
readWaveformPcmFrames({required int frameCount}) → ({TypedData frames, int framesRead})
Reads PCM frames from the waveform generator.
releaseResource() → void
Defines how the native resource should be released.
toString() String
A string representation of this object.
inherited

Operators

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