ajout effets audio
This commit is contained in:
1 parent
f8a79b08bf
commit
44a43828f1
14 files changed
+541
-6
No files matched your search
@@ -0,0 +1,32 @@
|
||||
#include "fx_saturation.h"
|
||||
#include <math.h>
|
||||
|
||||
#define FX_SATURATION_DC_BLOCK_R 0.995f
|
||||
|
||||
void FxSaturation_Init(FxSaturationState *state, FxSaturationParams *params)
|
||||
{
|
||||
state->dc_block_x1 = 0.0f;
|
||||
state->dc_block_y1 = 0.0f;
|
||||
|
||||
params->enabled = false;
|
||||
params->drive = 0.3f;
|
||||
params->level = 0.8f;
|
||||
}
|
||||
|
||||
float FxSaturation_Process(FxSaturationState *state, const FxSaturationParams *params, float input)
|
||||
{
|
||||
if (!params->enabled)
|
||||
{
|
||||
return input;
|
||||
}
|
||||
|
||||
float driven = input * (1.0f + params->drive * 12.0f);
|
||||
float shaped = tanhf(driven);
|
||||
|
||||
/* Le tanh sur un signal non symetrique introduit un leger DC : filtre bloqueur de DC. */
|
||||
float y = shaped - state->dc_block_x1 + FX_SATURATION_DC_BLOCK_R * state->dc_block_y1;
|
||||
state->dc_block_x1 = shaped;
|
||||
state->dc_block_y1 = y;
|
||||
|
||||
return y * params->level;
|
||||
}
|
||||
Reference in new issue
Block a user