|
Gin
|
Stereo phase correlation and balance meter. More...
#include <gin_correlationmeter.h>
Public Member Functions | |
| CorrelationMeter ()=default | |
| void | prepare (double sampleRate, double windowSeconds=0.3) |
| void | setWindow (double windowSeconds) |
| Averaging time constant. | |
| double | getWindowSeconds () const |
| void | reset () |
| Clears the averages. | |
| void | process (const float *left, const float *right, int numSamples) |
| void | process (const juce::AudioBuffer< float > &buffer) |
| Uses the first two channels. | |
| float | getCorrelation () const |
| -1 to +1. | |
| float | getBalance () const |
| -1 (left only) to +1 (right only). | |
Stereo phase correlation and balance meter.
Correlation is the normalised cross-correlation of left and right at zero lag: +1 for identical channels (mono), 0 for unrelated signals, -1 for identical but inverted channels. Balance is derived from the RMS of each side: -1 is all left, +1 all right. Both are averaged with a one pole filter whose time constant is set by setWindow().
Call process() from the audio thread; the getters are safe from any thread.
|
default |
| double CorrelationMeter::getWindowSeconds | ( | ) | const |
| void CorrelationMeter::reset | ( | ) |
Clears the averages.
Safe from any thread.
Uses the first two channels.
A mono buffer reads as fully correlated.
| float CorrelationMeter::getCorrelation | ( | ) | const |
-1 to +1.
Returns 0 when both channels are silent.
| float CorrelationMeter::getBalance | ( | ) | const |
-1 (left only) to +1 (right only).
0 when balanced or silent.