diff options
author | gramanas <anastasis.gramm2@gmail.com> | 2023-04-18 23:01:22 +0300 |
---|---|---|
committer | gramanas <anastasis.gramm2@gmail.com> | 2023-04-18 23:01:22 +0300 |
commit | 560356027650af8cd3dcc21888cdc3a76382ea5d (patch) | |
tree | 03e6397f678e3ce62f8d60809e935cb59fd78d5f /src/filter.h | |
parent | 9c6410cc3a43d9d1e01f853cb5a8d0f8a6d93b45 (diff) | |
download | synth-project-560356027650af8cd3dcc21888cdc3a76382ea5d.tar.gz synth-project-560356027650af8cd3dcc21888cdc3a76382ea5d.tar.bz2 synth-project-560356027650af8cd3dcc21888cdc3a76382ea5d.zip |
Fix adsr at 0 A and add active switch
Diffstat (limited to 'src/filter.h')
-rw-r--r-- | src/filter.h | 98 |
1 files changed, 49 insertions, 49 deletions
diff --git a/src/filter.h b/src/filter.h index e72d384..2e2839c 100644 --- a/src/filter.h +++ b/src/filter.h @@ -28,33 +28,33 @@ extern "C"{ #endif #endif -typedef struct { + typedef struct { int n; - FTR_PRECISION *A; + FTR_PRECISION *A; FTR_PRECISION *d1; FTR_PRECISION *d2; FTR_PRECISION *w0; FTR_PRECISION *w1; FTR_PRECISION *w2; -} BWLowPass; -// BWHighPass uses exactly the same struct -typedef BWLowPass BWHighPass; + } BWLowPass; + // BWHighPass uses exactly the same struct + typedef BWLowPass BWHighPass; -typedef struct { + typedef struct { int m; FTR_PRECISION ep; - FTR_PRECISION *A; + FTR_PRECISION *A; FTR_PRECISION *d1; FTR_PRECISION *d2; FTR_PRECISION *w0; FTR_PRECISION *w1; FTR_PRECISION *w2; -} CHELowPass; -typedef CHELowPass CHEHighPass; + } CHELowPass; + typedef CHELowPass CHEHighPass; -typedef struct { + typedef struct { int n; - FTR_PRECISION *A; + FTR_PRECISION *A; FTR_PRECISION *d1; FTR_PRECISION *d2; FTR_PRECISION *d3; @@ -64,12 +64,12 @@ typedef struct { FTR_PRECISION *w2; FTR_PRECISION *w3; FTR_PRECISION *w4; -} BWBandPass; + } BWBandPass; -typedef struct { + typedef struct { int m; FTR_PRECISION ep; - FTR_PRECISION *A; + FTR_PRECISION *A; FTR_PRECISION *d1; FTR_PRECISION *d2; FTR_PRECISION *d3; @@ -79,13 +79,13 @@ typedef struct { FTR_PRECISION *w2; FTR_PRECISION *w3; FTR_PRECISION *w4; -} CHEBandPass; + } CHEBandPass; -typedef struct { + typedef struct { int n; FTR_PRECISION r; FTR_PRECISION s; - FTR_PRECISION *A; + FTR_PRECISION *A; FTR_PRECISION *d1; FTR_PRECISION *d2; FTR_PRECISION *d3; @@ -95,14 +95,14 @@ typedef struct { FTR_PRECISION *w2; FTR_PRECISION *w3; FTR_PRECISION *w4; -} BWBandStop; + } BWBandStop; -typedef struct { + typedef struct { int m; FTR_PRECISION ep; FTR_PRECISION r; FTR_PRECISION s; - FTR_PRECISION *A; + FTR_PRECISION *A; FTR_PRECISION *d1; FTR_PRECISION *d2; FTR_PRECISION *d3; @@ -112,46 +112,46 @@ typedef struct { FTR_PRECISION *w2; FTR_PRECISION *w3; FTR_PRECISION *w4; -} CHEBandStop; + } CHEBandStop; -void update_bw_low_pass_filter(BWLowPass* filter, FTR_PRECISION s, FTR_PRECISION f, FTR_PRECISION q); + void update_bw_low_pass_filter(BWLowPass* filter, FTR_PRECISION s, FTR_PRECISION f, FTR_PRECISION q); -BWLowPass* create_bw_low_pass_filter(int order, FTR_PRECISION sampling_frequency, FTR_PRECISION half_power_frequency); -BWHighPass* create_bw_high_pass_filter(int order, FTR_PRECISION sampling_frequency, FTR_PRECISION half_power_frequency); -BWBandPass* create_bw_band_pass_filter(int order, FTR_PRECISION sampling_frequency, FTR_PRECISION lower_half_power_frequency, FTR_PRECISION upper_half_power_frequency); -BWBandStop* create_bw_band_stop_filter(int order, FTR_PRECISION sampling_frequency, FTR_PRECISION lower_half_power_frequency, FTR_PRECISION upper_half_power_frequency); + BWLowPass* create_bw_low_pass_filter(int order, FTR_PRECISION sampling_frequency, FTR_PRECISION half_power_frequency); + BWHighPass* create_bw_high_pass_filter(int order, FTR_PRECISION sampling_frequency, FTR_PRECISION half_power_frequency); + BWBandPass* create_bw_band_pass_filter(int order, FTR_PRECISION sampling_frequency, FTR_PRECISION lower_half_power_frequency, FTR_PRECISION upper_half_power_frequency); + BWBandStop* create_bw_band_stop_filter(int order, FTR_PRECISION sampling_frequency, FTR_PRECISION lower_half_power_frequency, FTR_PRECISION upper_half_power_frequency); -CHELowPass* create_che_low_pass_filter(int order, FTR_PRECISION epsilon, FTR_PRECISION sampling_frequency, FTR_PRECISION half_power_frequency); -CHEHighPass* create_che_high_pass_filter(int order, FTR_PRECISION epsilon, FTR_PRECISION sampling_frequency, FTR_PRECISION half_power_frequency); -CHEBandPass* create_che_band_pass_filter(int order, FTR_PRECISION epsilon, FTR_PRECISION sampling_frequency, FTR_PRECISION lower_half_power_frequency, FTR_PRECISION upper_half_power_frequency); -CHEBandStop* create_che_band_stop_filter(int order, FTR_PRECISION epsilon, FTR_PRECISION sampling_frequency, FTR_PRECISION lower_half_power_frequency, FTR_PRECISION upper_half_power_frequency); + CHELowPass* create_che_low_pass_filter(int order, FTR_PRECISION epsilon, FTR_PRECISION sampling_frequency, FTR_PRECISION half_power_frequency); + CHEHighPass* create_che_high_pass_filter(int order, FTR_PRECISION epsilon, FTR_PRECISION sampling_frequency, FTR_PRECISION half_power_frequency); + CHEBandPass* create_che_band_pass_filter(int order, FTR_PRECISION epsilon, FTR_PRECISION sampling_frequency, FTR_PRECISION lower_half_power_frequency, FTR_PRECISION upper_half_power_frequency); + CHEBandStop* create_che_band_stop_filter(int order, FTR_PRECISION epsilon, FTR_PRECISION sampling_frequency, FTR_PRECISION lower_half_power_frequency, FTR_PRECISION upper_half_power_frequency); -void free_bw_low_pass(BWLowPass* filter); -void free_bw_high_pass(BWHighPass* filter); -void free_bw_band_pass(BWBandPass* filter); -void free_bw_band_stop(BWBandStop* filter); + void free_bw_low_pass(BWLowPass* filter); + void free_bw_high_pass(BWHighPass* filter); + void free_bw_band_pass(BWBandPass* filter); + void free_bw_band_stop(BWBandStop* filter); -void free_che_low_pass(CHELowPass* filter); -void free_che_high_pass(CHEHighPass* filter); -void free_che_band_pass(CHEBandPass* filter); -void free_che_band_stop(CHEBandStop* filter); + void free_che_low_pass(CHELowPass* filter); + void free_che_high_pass(CHEHighPass* filter); + void free_che_band_pass(CHEBandPass* filter); + void free_che_band_stop(CHEBandStop* filter); -FTR_PRECISION bw_low_pass(BWLowPass* filter, FTR_PRECISION input); -FTR_PRECISION bw_high_pass(BWHighPass* filter, FTR_PRECISION input); -FTR_PRECISION bw_band_pass(BWBandPass* filter, FTR_PRECISION input); -FTR_PRECISION bw_band_stop(BWBandStop* filter, FTR_PRECISION input); + FTR_PRECISION bw_low_pass(BWLowPass* filter, FTR_PRECISION input); + FTR_PRECISION bw_high_pass(BWHighPass* filter, FTR_PRECISION input); + FTR_PRECISION bw_band_pass(BWBandPass* filter, FTR_PRECISION input); + FTR_PRECISION bw_band_stop(BWBandStop* filter, FTR_PRECISION input); -FTR_PRECISION che_low_pass(CHELowPass* filter, FTR_PRECISION input); -FTR_PRECISION che_high_pass(CHEHighPass* filter, FTR_PRECISION input); -FTR_PRECISION che_band_pass(CHEBandPass* filter, FTR_PRECISION input); -FTR_PRECISION che_band_stop(CHEBandStop* filter, FTR_PRECISION input); + FTR_PRECISION che_low_pass(CHELowPass* filter, FTR_PRECISION input); + FTR_PRECISION che_high_pass(CHEHighPass* filter, FTR_PRECISION input); + FTR_PRECISION che_band_pass(CHEBandPass* filter, FTR_PRECISION input); + FTR_PRECISION che_band_stop(CHEBandStop* filter, FTR_PRECISION input); -FTR_PRECISION softmax(FTR_PRECISION* data, int size, int target_ind); + FTR_PRECISION softmax(FTR_PRECISION* data, int size, int target_ind); -// Output should be pre-allocated which has the same(or larger) size as the input. -void spike_filter_upward(FTR_PRECISION * input, int size, FTR_PRECISION * output, FTR_PRECISION strength); + // Output should be pre-allocated which has the same(or larger) size as the input. + void spike_filter_upward(FTR_PRECISION * input, int size, FTR_PRECISION * output, FTR_PRECISION strength); #if __cplusplus } |