- Main Page
- Modules
- Data Structures
- Files
- Directories
- Related Pages

# Peak detector
[Audio]

Detect peaks in the volume for steering normalizers and dynamic range compressors. More...

## Typedefs
typedef struct gavl_peak_detector_s | gavl_peak_detector_t
| Opaque structure for peak detector.
## Functions
gavl_peak_detector_t * | gavl_peak_detector_create ()
| Create peak detector.
void | gavl_peak_detector_destroy (gavl_peak_detector_t *pd)
| Destroys a peak detector and frees all associated memory.
void | gavl_peak_detector_set_format (gavl_peak_detector_t *pd, const gavl_audio_format_t *format)
| Set format for a peak detector.
void | gavl_peak_detector_update (gavl_peak_detector_t *pd, gavl_audio_frame_t *frame)
| Feed the peak detector with a new frame.
void | gavl_peak_detector_get_peak (gavl_peak_detector_t *pd, double *min, double *max, double *abs)
| Get the peak volume across all channels.
void | gavl_peak_detector_get_peaks (gavl_peak_detector_t *pd, double *min, double *max, double *abs)
| Get the peak volume for all channels separate.
void | gavl_peak_detector_reset (gavl_peak_detector_t *pd)
| Reset a peak detector.

## Detailed Description

Detect peaks in the volume for steering normalizers and dynamic range compressors.

While normalizers and dynamic range controls are out of the scope of gavl, some low-level functionality can be provided

## Typedef Documentation

typedef struct gavl_peak_detector_s gavl_peak_detector_t

Opaque structure for peak detector.

You don't want to know what's inside.

## Function Documentation

gavl_peak_detector_t* gavl_peak_detector_create | ( |  | ) |

Create peak detector.

Returns:
  A newly allocated peak detector

void gavl_peak_detector_destroy | ( | gavl_peak_detector_t * | pd | ) |

Destroys a peak detector and frees all associated memory.

Parameters:

  | pd | A peak detector

void gavl_peak_detector_set_format | ( | gavl_peak_detector_t * | pd,
|  | const gavl_audio_format_t * | format |
| ) |  |  |

Set format for a peak detector.

Parameters:

  | pd | A peak detector
  | format | The format subsequent frames will be passed with

This function can be called multiple times with one instance. It also calls gavl_peak_detector_reset.

void gavl_peak_detector_update | ( | gavl_peak_detector_t * | pd,
|  | gavl_audio_frame_t * | frame |
| ) |  |  |

Feed the peak detector with a new frame.

Parameters:

  | pd | A peak detector
  | frame | An audio frame

void gavl_peak_detector_get_peak | ( | gavl_peak_detector_t * | pd,
|  | double * | min,
|  | double * | max,
|  | double * | abs |
| ) |  |  |

Get the peak volume across all channels.

Parameters:

  | pd | A peak detector
  | min | Returns minimum amplitude
  | max | Returns maximum amplitude
  | abs | Returns maximum absolute amplitude

The returned amplitudes are normalized such that the minimum amplitude corresponds to -1.0, the maximum amplitude corresponds to 1.0.

void gavl_peak_detector_get_peaks | ( | gavl_peak_detector_t * | pd,
|  | double * | min,
|  | double * | max,
|  | double * | abs |
| ) |  |  |

Get the peak volume for all channels separate.

Parameters:

  | pd | A peak detector
  | min | Returns minimum amplitude
  | max | Returns maximum amplitude
  | abs | Returns maximum absolute amplitude

The returned amplitudes are normalized such that the minimum amplitude corresponds to -1.0, the maximum amplitude corresponds to 1.0.

void gavl_peak_detector_reset | ( | gavl_peak_detector_t * | pd | ) |

Reset a peak detector.

Parameters:

  | pd | A peak detector