Zrythm
a highly automated and intuitive digital audio workstation
Loading...
Searching...
No Matches
dsp.h File Reference

Optimized DSP functions. More...

#include "zrythm-config.h"
#include <cstddef>
#include "utils/math.h"
#include "zrythm.h"
#include <glib.h>
Include dependency graph for dsp.h:

Go to the source code of this file.

Functions

NONNULL float dsp_min (float *buf, size_t size)
 Gets the minimum of the buffer.
 
NONNULL float dsp_max (float *buf, size_t size)
 Gets the maximum of the buffer.
 
NONNULL void dsp_mix_add2 (float *dest, const float *src1, const float *src2, float k1, float k2, size_t size)
 Calculate dst[i] = dst[i] + src1[i] * k1 + src2[i] * k2.
 
NONNULL void dsp_linear_fade_in_from (float *dest, int32_t start_offset, int32_t total_frames_to_fade, size_t size, float fade_from_multiplier)
 Calculate linear fade by multiplying from 0 to 1 for.
 
NONNULL void dsp_linear_fade_out_to (float *dest, int32_t start_offset, int32_t total_frames_to_fade, size_t size, float fade_to_multiplier)
 Calculate linear fade by multiplying from 0 to 1 for.
 
NONNULL void dsp_make_mono (float *l, float *r, size_t size, bool equal_power)
 Makes the two signals mono.
 

Detailed Description

Function Documentation

◆ dsp_linear_fade_in_from()

NONNULL void dsp_linear_fade_in_from ( float * dest,
int32_t start_offset,
int32_t total_frames_to_fade,
size_t size,
float fade_from_multiplier )

Calculate linear fade by multiplying from 0 to 1 for.

Parameters
total_frames_to_fadesamples.
Note
Does not work properly when
Parameters
fade_from_multiplieris < 1k.
start_offsetStart offset in the fade interval.
total_frames_to_fadeTotal frames that should be faded.
sizeNumber of frames to process.
fade_from_multiplierMultiplier to fade from (0 to fade from silence.)

◆ dsp_linear_fade_out_to()

NONNULL void dsp_linear_fade_out_to ( float * dest,
int32_t start_offset,
int32_t total_frames_to_fade,
size_t size,
float fade_to_multiplier )

Calculate linear fade by multiplying from 0 to 1 for.

Parameters
total_frames_to_fadesamples.
start_offsetStart offset in the fade interval.
total_frames_to_fadeTotal frames that should be faded.
sizeNumber of frames to process.
fade_to_multiplierMultiplier to fade to (0 to fade to silence.)

◆ dsp_make_mono()

NONNULL void dsp_make_mono ( float * l,
float * r,
size_t size,
bool equal_power )

Makes the two signals mono.

Parameters
equal_powerTrue for equal power, false for equal amplitude.
Note
Equal amplitude is more suitable for mono compatibility checking. For reference:
  • equal power sum = (L+R) * 0.7079 (-3dB)
  • equal amplitude sum = (L+R) /2 (-6.02dB)