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,39 @@
|
||||
#include "fx_overdrive.h"
|
||||
#include <math.h>
|
||||
|
||||
void FxOverdrive_Init(FxOverdriveState *state, FxOverdriveParams *params)
|
||||
{
|
||||
state->tone_lp_state = 0.0f;
|
||||
|
||||
params->enabled = false;
|
||||
params->drive = 0.4f;
|
||||
params->tone = 0.6f;
|
||||
params->level = 0.7f;
|
||||
}
|
||||
|
||||
float FxOverdrive_Process(FxOverdriveState *state, const FxOverdriveParams *params, float input)
|
||||
{
|
||||
if (!params->enabled)
|
||||
{
|
||||
return input;
|
||||
}
|
||||
|
||||
float driven = input * (1.0f + params->drive * 20.0f);
|
||||
|
||||
/* Ecretage asymetrique (exponentiel) : plus caracteristique/agressif qu'un tanh symetrique. */
|
||||
float shaped;
|
||||
if (driven >= 0.0f)
|
||||
{
|
||||
shaped = 1.0f - expf(-driven);
|
||||
}
|
||||
else
|
||||
{
|
||||
shaped = -1.0f + expf(driven);
|
||||
}
|
||||
|
||||
/* Filtre passe-bas une pole pour la tonalite : coefficient = tone (0..1). */
|
||||
float coeff = 0.05f + params->tone * 0.9f;
|
||||
state->tone_lp_state += coeff * (shaped - state->tone_lp_state);
|
||||
|
||||
return state->tone_lp_state * params->level;
|
||||
}
|
||||
Reference in new issue
Block a user