Table of Contents

Class WaveformPeaks

Namespace
PluginUI.Dsp
Assembly
PluginUI.dll

Multi-resolution min/max summary of a long signal, so that a waveform of millions of samples is drawn at any zoom level by reading at most a few values per pixel (used by WaveformView).

public sealed class WaveformPeaks
Inheritance
WaveformPeaks
Inherited Members

Remarks

Level k stores the minimum and maximum of blocks of BaseBlock × 4^k samples. Building is O(n) and memory is about 2 × n / BaseBlock × 4/3 floats.

Constructors

WaveformPeaks(float[])

Builds the summary of one channel.

public WaveformPeaks(float[] samples)

Parameters

samples float[]

The samples (kept by reference: do not modify them afterwards).

Exceptions

ArgumentNullException

samples is null.

Fields

BaseBlock

Samples per block of the finest level.

public const int BaseBlock = 64

Field Value

int

Properties

Length

Number of samples summarized.

public int Length { get; }

Property Value

int

Methods

Range(long, long)

Minimum and maximum of the samples in [start, end).

public (float Min, float Max) Range(long start, long end)

Parameters

start long

First sample (clamped).

end long

End sample, exclusive (clamped).

Returns

(float Min, float Max)

(min, max), or (0, 0) for an empty range.