Table of Contents

Class Spectrogram

Namespace
PluginUI
Assembly
PluginUI.dll

Scrolling spectrogram (waterfall): time runs from right to left, frequency on a logarithmic vertical axis, level as color. Reads an AudioRingBuffer written by the audio thread and analyzes it with Fft.

public class Spectrogram : Control
Inheritance
Spectrogram
Inherited Members

Remarks

The image is kept in a pixel buffer of the element's size (in DIPs) and scrolled by one column per analysis; each analysis takes the latest FftSize samples (Hann window). ColumnsPerSecond sets the scrolling speed.

The color map goes from transparent dark blue (below MinDb) through purple, red and orange to pale yellow (at MaxDb).

Constructors

Spectrogram()

Creates a spectrogram.

public Spectrogram()

Properties

ColumnsPerSecond

Scrolling speed in columns (analyses) per second.

public float ColumnsPerSecond { get; set; }

Property Value

float

DefaultSize

Natural size used when no explicit size is given.

protected override Size DefaultSize { get; }

Property Value

Size

FftSize

FFT size (power of two, 256 … 16384): frequency resolution vs time resolution.

public int FftSize { get; set; }

Property Value

int

IsFrozen

Stops scrolling.

public bool IsFrozen { get; set; }

Property Value

bool

MaxDb

Level mapped to the brightest color (dBFS).

public float MaxDb { get; set; }

Property Value

float

MaxFrequency

Highest displayed frequency in Hz.

public float MaxFrequency { get; set; }

Property Value

float

MinDb

Level mapped to the darkest color (dBFS).

public float MinDb { get; set; }

Property Value

float

MinFrequency

Lowest displayed frequency in Hz.

public float MinFrequency { get; set; }

Property Value

float

SampleRate

Sample rate of the source in Hz.

public float SampleRate { get; set; }

Property Value

float

ShowGrid

Draws the frequency grid and labels over the image.

public bool ShowGrid { get; set; }

Property Value

bool

Source

Sample source.

[Browsable(false)]
public AudioRingBuffer? Source { get; set; }

Property Value

AudioRingBuffer

Methods

Advance(double)

Runs the analyses due since the previous frame (public for offscreen hosts and tests).

public void Advance(double elapsedSeconds)

Parameters

elapsedSeconds double

Time since the previous call.

OnAttached()

Called when the element joins a host (subscribe to external events here).

protected override void OnAttached()

OnDetached()

Called when the element leaves its host (unsubscribe here).

protected override void OnDetached()

RenderVector(DrawingContext, Rect, VectorStyle)

Vector rendering of the widget area.

protected override void RenderVector(DrawingContext dc, Rect widget, VectorStyle style)

Parameters

dc DrawingContext
widget Rect
style VectorStyle