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
DefaultSize
Natural size used when no explicit size is given.
protected override Size DefaultSize { get; }
Property Value
FftSize
FFT size (power of two, 256 … 16384): frequency resolution vs time resolution.
public int FftSize { get; set; }
Property Value
IsFrozen
Stops scrolling.
public bool IsFrozen { get; set; }
Property Value
MaxDb
Level mapped to the brightest color (dBFS).
public float MaxDb { get; set; }
Property Value
MaxFrequency
Highest displayed frequency in Hz.
public float MaxFrequency { get; set; }
Property Value
MinDb
Level mapped to the darkest color (dBFS).
public float MinDb { get; set; }
Property Value
MinFrequency
Lowest displayed frequency in Hz.
public float MinFrequency { get; set; }
Property Value
SampleRate
Sample rate of the source in Hz.
public float SampleRate { get; set; }
Property Value
ShowGrid
Draws the frequency grid and labels over the image.
public bool ShowGrid { get; set; }
Property Value
Source
Sample source.
[Browsable(false)]
public AudioRingBuffer? Source { get; set; }
Property Value
Methods
Advance(double)
Runs the analyses due since the previous frame (public for offscreen hosts and tests).
public void Advance(double elapsedSeconds)
Parameters
elapsedSecondsdoubleTime 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
dcDrawingContextwidgetRectstyleVectorStyle