Gin
Loading...
Searching...
No Matches
Public Member Functions | List of all members
Maximizer Class Reference

Zero crossing maximizer. More...

#include <gin_maximizer.h>

Public Member Functions

 Maximizer ()=default
 
 ~Maximizer ()=default
 
void setSampleRate (double sr)
 
void setNumChannels (int ch)
 
void setThreshold (float db)
 Level the half cycle peaks are scaled back to, in dB.
 
void setCeiling (float db)
 Output ceiling in dB.
 
void setRelease (float seconds)
 How long the gain takes to recover 6 dB, in seconds.
 
void setMaxCycleLength (float seconds)
 The longest half cycle the maximizer will hold, in seconds, which is also its latency.
 
int getLatencySamples () const
 Latency in samples.
 
void reset ()
 
void process (juce::AudioSampleBuffer &buffer)
 

Detailed Description

Zero crossing maximizer.

Not a lookahead limiter. Audio is buffered a half cycle at a time - from one zero crossing to the next - and the peak of that half cycle is measured as it goes by. At the crossing, if the peak overshot the threshold, the whole half cycle that was just buffered is scaled back so its peak lands exactly on the threshold, and the output is caught up from the buffer.

The point is where the gain changes happen: only ever at a zero crossing, where the signal is silent, so there is no step in the middle of a waveform to hear. A conventional limiter has to move its gain while the waveform is doing something, and spends attack and release time trying to make that inaudible.

Latency is one buffer - see setMaxCycleLength(), which sets how long a half cycle can be before the maximizer gives up and restarts on it.

Key Features:

Usage:

max.setSampleRate (44100.0);
max.setNumChannels (2);
max.setThreshold (-6.0f); // scale half cycles back to -6 dB
max.setCeiling (-0.3f); // then bring the whole thing up to -0.3
max.setRelease (0.25f);
processor.setLatencySamples (max.getLatencySamples());
max.process (buffer);
Zero crossing maximizer.
Definition gin_maximizer.h:63
See also
Dynamics, TransientShaper

Constructor & Destructor Documentation

◆ Maximizer()

Maximizer::Maximizer ( )
default

◆ ~Maximizer()

Maximizer::~Maximizer ( )
default

Member Function Documentation

◆ setSampleRate()

void Maximizer::setSampleRate ( double  sr)

References setRelease().

◆ setNumChannels()

void Maximizer::setNumChannels ( int  ch)

◆ setThreshold()

void Maximizer::setThreshold ( float  db)

Level the half cycle peaks are scaled back to, in dB.

◆ setCeiling()

void Maximizer::setCeiling ( float  db)

Output ceiling in dB.

Everything between threshold and ceiling is made up automatically, which is where the loudness comes from.

◆ setRelease()

void Maximizer::setRelease ( float  seconds)

How long the gain takes to recover 6 dB, in seconds.

0 disables the release entirely, so every half cycle is scaled on its own merits.

Referenced by setSampleRate().

◆ setMaxCycleLength()

void Maximizer::setMaxCycleLength ( float  seconds)

The longest half cycle the maximizer will hold, in seconds, which is also its latency.

The default 50 ms covers everything down to 10 Hz. Anything longer is restarted mid cycle, which is audible, so raise this rather than lower it if the source has real subsonic content.

◆ getLatencySamples()

int Maximizer::getLatencySamples ( ) const

Latency in samples.

One slot short of the buffer, because the sample being written is the one read out a whole buffer later.

◆ reset()

void Maximizer::reset ( )

◆ process()

void Maximizer::process ( juce::AudioSampleBuffer &  buffer)

The documentation for this class was generated from the following file: