Class SpectrumAnalyzer
- Namespace
- PluginUI
- Assembly
- PluginUI.dll
Real-time FFT spectrum analyzer reading an AudioRingBuffer: logarithmic frequency axis, dB range,
per-column attack/release smoothing, peak-hold curve, slope compensation (dB/octave around 1 kHz),
line or fractional-octave bar display, labeled grid. iPlug2 IVSpectrumAnalyzerControl.
public class SpectrumAnalyzer : Control
- Inheritance
-
SpectrumAnalyzer
- Inherited Members
Remarks
The FFT runs on the UI thread at frame rate, only when new audio arrived. Buffers are preallocated.
Constructors
SpectrumAnalyzer()
Creates an analyzer.
public SpectrumAnalyzer()
Properties
AttackSeconds
Attack time constant in seconds.
public float AttackSeconds { get; set; }
Property Value
BandsPerOctave
Bars per octave in Bars (1, 2, 3, 6...).
public int BandsPerOctave { get; set; }
Property Value
CurveColor
Curve color (null = theme accent).
public Color? CurveColor { 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).
public int FftSize { get; set; }
Property Value
IsFrozen
Stops updating.
public bool IsFrozen { get; set; }
Property Value
MaxDb
Top of the dB range.
public float MaxDb { get; set; }
Property Value
MaxFrequency
Highest displayed frequency.
public float MaxFrequency { get; set; }
Property Value
MinDb
Bottom of the dB range.
public float MinDb { get; set; }
Property Value
MinFrequency
Lowest displayed frequency.
public float MinFrequency { get; set; }
Property Value
Mode
Line or bars.
public SpectrumMode Mode { get; set; }
Property Value
PeakDecayDbPerSecond
Peak curve decay in dB per second.
public float PeakDecayDbPerSecond { get; set; }
Property Value
ReleaseDbPerSecond
Release speed in dB per second.
public float ReleaseDbPerSecond { get; set; }
Property Value
SampleRate
Sample rate of the source in Hz.
public float SampleRate { get; set; }
Property Value
ShowGrid
Draws the frequency/dB grid and labels.
public bool ShowGrid { get; set; }
Property Value
ShowPeakHold
Draws a slowly decaying peak curve.
public bool ShowPeakHold { get; set; }
Property Value
SlopeDbPerOctave
Tilt added to the spectrum in dB per octave around 1 kHz (4.5 makes pink noise look flat).
public float SlopeDbPerOctave { get; set; }
Property Value
Source
Sample source.
[Browsable(false)]
public AudioRingBuffer? Source { get; set; }
Property Value
Window
Analysis window.
public WindowFunction Window { get; set; }
Property Value
Methods
FrequencyToX(float, Rect)
X position of a frequency inside an area (log axis).
public float FrequencyToX(float hz, Rect area)
Parameters
Returns
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
XToFrequency(float, Rect)
Frequency at an X position inside an area.
public float XToFrequency(float x, Rect area)