0
1
mirror of https://github.com/radio95-rnt/fm95.git synced 2026-02-26 19:23:51 +01:00
This commit is contained in:
2024-12-31 16:10:21 +01:00
parent c96fe78618
commit 1868cd98ca
16 changed files with 199 additions and 279 deletions

23
lib/filters.h Normal file
View File

@@ -0,0 +1,23 @@
#include "math.h"
#include <string.h>
#include "constants.h"
#define FIR_PHASES 32
#define FIR_TAPS 32
typedef struct {
float alpha;
float prev_sample;
} Emphasis;
void init_emphasis(Emphasis *pe, float tau, float sample_rate);
float apply_pre_emphasis(Emphasis *pe, float sample);
typedef struct {
float low_pass_fir[FIR_PHASES][FIR_TAPS];
float sample_buffer[FIR_TAPS];
int buffer_index;
} LowPassFilter;
void init_low_pass_filter(LowPassFilter *lp, float cutoff_frequency, float sample_rate);
float apply_low_pass_filter(LowPassFilter *lp, float sample);