0
1
mirror of https://github.com/radio95-rnt/fm95.git synced 2026-02-27 03:23:54 +01:00

remove tilt, and add a non-mpx output

This commit is contained in:
Kuba
2025-10-11 10:22:36 +02:00
parent 53d5d8ec6b
commit 8d00202869
4 changed files with 46 additions and 53 deletions

View File

@@ -13,26 +13,4 @@ inline float apply_preemphasis(ResistorCapacitor *filter, float sample) {
float out = (sample - filter->alpha * filter->prev_sample) * filter->gain;
filter->prev_sample = sample;
return out;
}
void tilt_init(TiltCorrectionFilter* f, float correction_strength, float sr) {
float cutoff = 1000.0f; // fixed split point
// one-pole lowpass setup
float alpha = expf(-2.0f * (float)M_PI * cutoff / sr);
f->a1 = alpha;
f->a0 = 1.0f - alpha;
f->lp = 0.0f;
// simple low/high gains from tilt
float t = (correction_strength < -1.0f) ? -1.0f : (correction_strength > 1.0f ? 1.0f : correction_strength);
f->low_gain = 1.0f - t;
f->high_gain = 1.0f + t;
}
float tilt(TiltCorrectionFilter* f, float in) {
// lowpass
f->lp = f->a0 * in + f->a1 * f->lp;
float hp = in - f->lp;
return f->lp * f->low_gain + hp * f->high_gain;
}