Wolf-LITE/STM32/Core/Src/audio_filters.c

767 wiersze
78 KiB
C

#include "audio_filters.h"
#include "stm32f4xx_hal.h"
#include <stdio.h>
#include <string.h>
#include <stdlib.h>
#include <math.h>
#include "arm_math.h"
#include "functions.h"
#include "wm8731.h"
#include "settings.h"
#include "auto_notch.h"
#include "trx_manager.h"
//Private variables
static float32_t Fir_RX_Hilbert_State_I[FIR_RX_HILBERT_STATE_SIZE] = {0}; // buffers of filter states
static float32_t Fir_RX_Hilbert_State_Q[FIR_RX_HILBERT_STATE_SIZE] = {0};
static float32_t Fir_Tx_Hilbert_State_I[FIR_TX_HILBERT_STATE_SIZE] = {0};
static float32_t Fir_Tx_Hilbert_State_Q[FIR_TX_HILBERT_STATE_SIZE] = {0};
static float32_t IIR_RX_LPF_I_State[IIR_RX_LPF_Taps_STATE_SIZE] = {0};
static float32_t IIR_RX_LPF_Q_State[IIR_RX_LPF_Taps_STATE_SIZE] = {0};
static float32_t IIR_RX_GAUSS_State[IIR_RX_GAUSS_Taps_STATE_SIZE] = {0};
static float32_t IIR_TX_LPF_I_State[IIR_RX_LPF_Taps_STATE_SIZE] = {0};
static float32_t IIR_RX_HPF_I_State[IIR_RX_HPF_Taps_STATE_SIZE] = {0};
static float32_t IIR_TX_HPF_I_State[IIR_RX_HPF_Taps_STATE_SIZE] = {0};
static float32_t IIR_RX_HPF_SQL_State[IIR_RX_HPF_SQL_STATE_SIZE] = {0};
static float32_t EQ_RX_LOW_FILTER_State[2 * EQ_STAGES] = {0};
static float32_t EQ_RX_MID_FILTER_State[2 * EQ_STAGES] = {0};
static float32_t EQ_RX_HIG_FILTER_State[2 * EQ_STAGES] = {0};
static float32_t EQ_RX_LOW_FILTER_Coeffs[BIQUAD_COEFF_IN_STAGE * EQ_STAGES] = {0};
static float32_t EQ_RX_MID_FILTER_Coeffs[BIQUAD_COEFF_IN_STAGE * EQ_STAGES] = {0};
static float32_t EQ_RX_HIG_FILTER_Coeffs[BIQUAD_COEFF_IN_STAGE * EQ_STAGES] = {0};
static float32_t EQ_MIC_LOW_FILTER_State[2 * EQ_STAGES] = {0};
static float32_t EQ_MIC_MID_FILTER_State[2 * EQ_STAGES] = {0};
static float32_t EQ_MIC_HIG_FILTER_State[2 * EQ_STAGES] = {0};
static float32_t EQ_MIC_LOW_FILTER_Coeffs[BIQUAD_COEFF_IN_STAGE * EQ_STAGES] = {0};
static float32_t EQ_MIC_MID_FILTER_Coeffs[BIQUAD_COEFF_IN_STAGE * EQ_STAGES] = {0};
static float32_t EQ_MIC_HIG_FILTER_Coeffs[BIQUAD_COEFF_IN_STAGE * EQ_STAGES] = {0};
static float32_t AGC_RX_KW_HSHELF_FILTER_State[2 * EQ_STAGES] = {0};
static float32_t AGC_RX_KW_HPASS_FILTER_State[2 * EQ_STAGES] = {0};
static float32_t AGC_RX_KW_HSHELF_FILTER_Coeffs[BIQUAD_COEFF_IN_STAGE * EQ_STAGES] = {0};
static float32_t AGC_RX_KW_HPASS_FILTER_Coeffs[BIQUAD_COEFF_IN_STAGE * EQ_STAGES] = {0};
static DC_filter_state_type DC_Filter_State[8] = {0}; // states of the DC corrector
// Collection of filters
//IQ Hilbert with (+45 q / -45 i) degrees phase added, 48000 sampling frequency Fc=1.95kHz, BW=4.53kHz Sinc, Raised Cosine 0.910 // Iowa Hills Hilbert Filters
//static const float32_t FIR_HILB_I_coeffs[IQ_HILBERT_TAPS] = {223.7509881945750E-9, 948.5448959443470E-9, 2.239548070940360E-6, 4.104081513478730E-6, 6.473278399896580E-6, 9.243363618311680E-6, 0.000012375306830145, 0.000016008470118094, 0.000020514831353058, 0.000026428582704618, 0.000034238287518054, 0.000044107685972401, 0.000055658388468059, 0.000067960735122181, 0.000079814414911969, 0.000090271019268658, 0.000099208267996747, 0.000107682375571142, 0.000117820188231993, 0.000132178448300499, 0.000152741505943579, 0.000179946397181736, 0.000212200254787838, 0.000246219865497213, 0.000278197754411937, 0.000305403847133994, 0.000327547176022056, 0.000347211639892836, 0.000369004605143288, 0.000397624259417610, 0.000435628238606010, 0.000481985678838541, 0.000532308421669435, 0.000580973374933797, 0.000624402160968576, 0.000663975552226445, 0.000706866273201483, 0.000763718418281774, 0.000843470610359944, 0.000947212263362751, 0.001064042332409273, 0.001171796460180425, 0.001243951997037104, 0.001261369267521314, 0.001224751811749544, 0.001162086034885813, 0.001125920875792500, 0.001178490669945493, 0.001367614744816024, 0.001701279127048149, 0.002131623535440460, 0.002557937761052193, 0.002852717842663536, 0.002906138181592429, 0.002675393927642395, 0.002219948090046554, 0.001704839436171120, 0.001362891287901267, 0.001421041702098347, 0.002011509947420330, 0.003099138284411245, 0.004456751183384506, 0.005708484289066565, 0.006438931350315933, 0.006340243026888855, 0.005349242515151897, 0.003720982515017856, 0.001998787552236407, 0.000872042233036055, 0.000953170264748813, 0.002540912444746210, 0.005454091829370742, 0.009009087200446018, 0.012174602696360195, 0.013878843787567130, 0.013385124179631247, 0.010613479505888278, 0.006285039489443841, 0.001808717781247508, -0.001092430678638297, -0.000927283437365230, 0.003006301950665575, 0.010243640800918661, 0.019112611427735394, 0.027098107257607106, 0.031553929105355837, 0.030581250057604290, 0.023812767466428037, 0.012836160782847062, 0.001069713701562541, -0.006949315019545316, -0.006726605747478962, 0.004866458991959632, 0.028477691298525291, 0.061710400362786785, 0.099325780000166744, 0.134224240487393925, 0.158999573746049172, 0.167687454575943418, 0.157256673476852710, 0.128442847558250611, 0.085689313488739788, 0.036193922460058224, -0.011702019132317934, -0.050372660860353115, -0.074543394440449343, -0.082300601206559604, -0.075248447552329234, -0.057817989610136365, -0.035955570364459531, -0.015567203459010078, -0.001134744675231588, 0.005157014696688749, 0.003607309109247389, -0.003474931963170549, -0.012705711479376576, -0.020715053812433180, -0.025075301617804493, -0.024833661635348364, -0.020552614868337892, -0.013912891586523883, -0.007052065843042134, -0.001866246821034922, 0.000516223781271204, -0.000041989114492909, -0.002791021180205989, -0.006447927676302333, -0.009659645602751786, -0.011419791177594530, -0.011319648039713963, -0.009580882713672524, -0.006891697580158546, -0.004125421384087170, -0.002045398082686481, -0.001089117339142527, -0.001286193727599866, -0.002314945400675894, -0.003658321010890728, -0.004794865749544438, -0.005359485571258614, -0.005228661686680162, -0.004515964267980362, -0.003494458365862956, -0.002483052706789675, -0.001739036113379079, -0.001389760063268084, -0.001418064078799173, -0.001696122343817232, -0.002047716179087368, -0.002313436442110995, -0.002397200313346026, -0.002282760930956755, -0.002020990464106081, -0.001698228383151980, -0.001400181098315894, -0.001184326559787539, -0.001068152544581845, -0.001033582851205000, -0.001042310654116016, -0.001054161971946344, -0.001041346771202241, -0.000994567685711711, -0.000920829128941494, -0.000835855182120961, -0.000755329158990894, -0.000688603234807107, -0.000636705673632633, -0.000594357900905697, -0.000554181925717891, -0.000510804932678112, -0.000463118664475597, -0.000414096319555456, -0.000368727521834393, -0.000331328678648681, -0.000303524506053571, -0.000283683901660525, -0.000267842266116449, -0.000251506689829605, -0.000231463646998481, -0.000206844002176803, -0.000179121332298031, -0.000151204743056522, -0.000126126266083465, -0.000105901672116307, -0.000090974893900219, -0.000080352409047133, -0.000072242785698550, -0.000064854267073064, -0.000057011646034372, -0.000048396414268341, -0.000039406214264031, -0.000030781942374507, -0.000023208699143715, -0.000017056318020772, -0.000012325180003317, -8.759613105575410E-6, -6.029969405701850E-6, -3.882492263574330E-6, -2.200025615965410E-6, -975.1397524474980E-9, -239.2027170806280E-9};
//static const float32_t FIR_HILB_Q_coeffs[IQ_HILBERT_TAPS] = {-239.2027170806560E-9, -975.1397524476660E-9, -2.200025615965810E-6, -3.882492263574850E-6, -6.029969405702120E-6, -8.759613105574830E-6, -0.000012325180003315, -0.000017056318020768, -0.000023208699143709, -0.000030781942374500, -0.000039406214264024, -0.000048396414268337, -0.000057011646034372, -0.000064854267073069, -0.000072242785698559, -0.000080352409047147, -0.000090974893900237, -0.000105901672116327, -0.000126126266083482, -0.000151204743056535, -0.000179121332298038, -0.000206844002176803, -0.000231463646998477, -0.000251506689829601, -0.000267842266116452, -0.000283683901660539, -0.000303524506053597, -0.000331328678648716, -0.000368727521834428, -0.000414096319555478, -0.000463118664475595, -0.000510804932678080, -0.000554181925717832, -0.000594357900905625, -0.000636705673632569, -0.000688603234807070, -0.000755329158990898, -0.000835855182121003, -0.000920829128941556, -0.000994567685711768, -0.001041346771202267, -0.001054161971946331, -0.001042310654115978, -0.001033582851204978, -0.001068152544581889, -0.001184326559787687, -0.001400181098316153, -0.001698228383152308, -0.002020990464106389, -0.002282760930956934, -0.002397200313345985, -0.002313436442110709, -0.002047716179086903, -0.001696122343816746, -0.001418064078798878, -0.001389760063268167, -0.001739036113379629, -0.002483052706790617, -0.003494458365864043, -0.004515964267981224, -0.005228661686680431, -0.005359485571258059, -0.004794865749543089, -0.003658321010888926, -0.002314945400674231, -0.001286193727599023, -0.001089117339143038, -0.002045398082688510, -0.004125421384090377, -0.006891697580162112, -0.009580882713675352, -0.011319648039715023, -0.011419791177593237, -0.009659645602748290, -0.006447927676297602, -0.002791021180201610, -0.000041989114490631, 0.000516223781270046, -0.001866246821039895, -0.007052065843050045, -0.013912891586532689, -0.020552614868344893, -0.024833661635351008, -0.025075301617801304, -0.020715053812424448, -0.012705711479364563, -0.003474931963159146, 0.003607309109253661, 0.005157014696686077, -0.001134744675244962, -0.015567203459032938, -0.035955570364487460, -0.057817989610162497, -0.075248447552345707, -0.082300601206559548, -0.074543394440428748, -0.050372660860312120, -0.011702019132261260, 0.036193922460122083, 0.085689313488800323, 0.128442847558297574, 0.157256673476878356, 0.167687454575944500, 0.158999573746027162, 0.134224240487354735, 0.099325780000119254, 0.061710400362740524, 0.028477691298488390, 0.004866458991937123, -0.006726605747485966, -0.006949315019539358, 0.001069713701576379, 0.012836160782862767, 0.023812767466440302, 0.030581250057609779, 0.031553929105353769, 0.027098107257598970, 0.019112611427724233, 0.010243640800907937, 0.003006301950658107, -0.000927283437367983, -0.001092430678636460, 0.001808717781252494, 0.006285039489449838, 0.010613479505893192, 0.013385124179633633, 0.013878843787566531, 0.012174602696357130, 0.009009087200441680, 0.005454091829366533, 0.002540912444743289, 0.000953170264747782, 0.000872042233036866, 0.001998787552238471, 0.003720982515020316, 0.005349242515153926, 0.006340243026889902, 0.006438931350315841, 0.005708484289065552, 0.004456751183383028, 0.003099138284409812, 0.002011509947419342, 0.001421041702097986, 0.001362891287901485, 0.001704839436171697, 0.002219948090047204, 0.002675393927642869, 0.002906138181592586, 0.002852717842663368, 0.002557937761051797, 0.002131623535439987, 0.001701279127047741, 0.001367614744815772, 0.001178490669945418, 0.001125920875792563, 0.001162086034885941, 0.001224751811749666, 0.001261369267521385, 0.001243951997037112, 0.001171796460180390, 0.001064042332409229, 0.000947212263362729, 0.000843470610359959, 0.000763718418281822, 0.000706866273201547, 0.000663975552226500, 0.000624402160968601, 0.000580973374933785, 0.000532308421669388, 0.000481985678838475, 0.000435628238605942, 0.000397624259417553, 0.000369004605143252, 0.000347211639892820, 0.000327547176022054, 0.000305403847133999, 0.000278197754411941, 0.000246219865497210, 0.000212200254787827, 0.000179946397181720, 0.000152741505943561, 0.000132178448300484, 0.000117820188231982, 0.000107682375571138, 0.000099208267996750, 0.000090271019268667, 0.000079814414911980, 0.000067960735122194, 0.000055658388468071, 0.000044107685972409, 0.000034238287518059, 0.000026428582704620, 0.000020514831353058, 0.000016008470118092, 0.000012375306830142, 9.243363618309360E-6, 6.473278399895030E-6, 4.104081513477980E-6, 2.239548070940140E-6, 948.5448959443480E-9, 223.7509881945930E-9};
static const float32_t FIR_HILB_Q_coeffs_rx[IQ_HILBERT_TAPS_RX] =
//{-5.702029823289780E-6,-0.000039219921881772,-0.000125961068157237,-0.000270915868650029,-0.000435993654001520,-0.000540377608401144,-0.000497504547388838,-0.000282830558176925,-2.421702967718130E-6,0.000082954298431622,-0.000382670153833527,-0.001700621211116391,-0.003920158431250949,-0.006681314536912206,-0.009200409429965023,-0.010466629248141970,-0.009637173648363497,-0.006516625440883324,-0.001926794263403978,0.002239659354791165,0.003411293934926346,-0.000850063052119150,-0.011826169645843291,-0.028755507153826302,-0.048456557469219834,-0.065717656839010666,-0.074471271884586326,-0.069486353007572735,-0.048086624492331379,-0.011328593299850849,0.035805263058567308,0.085352373172954799,0.128243450680040061,0.156577648180890816,0.165625340599039911,0.154958903256784741,0.128386567929334255,0.092744251946634576,0.055953014535082536,0.024955620998299490,0.004140778180043780,-0.005338445681787938,-0.005262344892036169,0.000716546420940858,0.008462390387404947,0.014602504124462335,0.017281600304896699,0.016291703631702837,0.012671228801091745,0.008020781513322696,0.003824038292439508,0.000995567718524096,-0.000252182117595943,-0.000263867482074276,0.000353056290897718,0.001023718549879908,0.001394469069796279,0.001377552373787447,0.001080605783388492,0.000686212071331413,0.000346610446248922,0.000131756987082392,0.000033840379282726,5.495187851186830E-6,1.184916684512400E-6,};
//{-0.000503060824435524,-0.001600113977711891,-0.003037976842448786,-0.004353314029307187,-0.005026144284124823,-0.004711671322296953,-0.003443043258863156,-0.001703636649111669,-0.000308042508313548,-0.000107318065114870,-0.001617352778619836,-0.004722567730174505,-0.008601414104677957,-0.011947971251872868,-0.013446543902637421,-0.012337971740773251,-0.008848943344771125,-0.004276117992887261,-0.000629976486752305,0.000085258525754190,-0.003286497848948079,-0.010421351044638240,-0.019390807326265806,-0.027179330586389362,-0.030737968455383537,-0.028235070569262721,-0.020034947469386520,-0.008972704221266496,0.000295407917029802,0.002763078815578515,-0.005061565589398714,-0.023529195508723688,-0.049083725616005422,-0.074745234377879333,-0.091829370376441510,-0.092459720888029520,-0.072117656806988728,-0.031400414758898015,0.023637018523631329,0.082753613229944067,0.134092560913908698,0.167308709870570227,0.176317860326862724,0.160840312780289901,0.126287126737536531,0.082057108217275299,0.038802510871817013,0.005520744875624805,-0.012655542237524853,-0.015362058941531989,-0.006437304884430776,0.007804754770250635,0.020817632108413465,0.027831066085518597,0.027024828175793745,0.019599218813264561,0.008862751615282435,-0.001233382215308393,-0.007552565090318384,-0.008733018170278306,-0.005393673114898918,0.000379163288273399,0.005984259435763715,0.009300464982414909,0.009365997486804686,0.006544680069102935,0.002192673187633606,-0.001982425346544567,-0.004593311474415576,-0.005026435107134037,-0.003543633476229548,-0.001047394653953288,0.001352354253347106,0.002778527436609532,0.002868988455970437,0.001820087374505057,0.000214082066799741,-0.001268321890271385,-0.002121335632082419,-0.002170959557198075,-0.001575352255389210};//81
{-0.000330456715070938,-0.000629676581964014,-0.000944226794009999,-0.001196005513387744,-0.001305223451308854,-0.001217097217841885,-0.000927408331000686,-0.000498335198943988,-0.000057197159445466,0.000225444888657611,0.000176215947604284,-0.000330362848450619,-0.001323929333614326,-0.002707937633195892,-0.004259463736792241,-0.005665303208153643,-0.006591161622690587,-0.006770665800048038,-0.006092891181813417,-0.004663721731594963,-0.002819327223663095,-0.001079524908284746,-0.000043168385096691,-0.000243775444103532,-0.001997255249878086,-0.005280798286712627,-0.009679911182067326,-0.014428469186867566,-0.018546326251505031,-0.021054646949826613,-0.021226446072524392,-0.018814829071269499,-0.014198845961734305,-0.008398829975210813,-0.002938316013820244,0.000436567879004950,0.000134235057534853,-0.004882835459288676,-0.014764120775433763,-0.028585437454559395,-0.044369976428085579,-0.059334379228746646,-0.070330873139858391,-0.074411804700078882,-0.069411116355629562,-0.054426250097568685,-0.030097218494968280,0.001384539202537917,0.036553204326131232,0.071190257839413226,0.100999326286767013,0.122310156625448460,0.132679955424937740,0.131279384822697437,0.118992512365188166,0.098216174881270546,0.072402731123178785,0.045438831037726439,0.020981685909144676,0.001877868694456823,-0.010232066730356001,-0.015061461524425323,-0.013568226225339670,-0.007629675262473124,0.000417596779578971,0.008271539908183079,0.014092762093242606,0.016789691153418308,0.016119879683140576,0.012608228480696405,0.007320589309795776,0.001557143265667508,-0.003460414668089832,-0.006841092910982887,-0.008170322330641196,-0.007531852784952046,-0.005417635820073762,-0.002560636361189398,0.000261883624054146,0.002406663595505859,0.003486861999460121,0.003418818405292588,0.002393338293506157,0.000788989142954827,-0.000944148149325049,-0.002398997243076659,-0.003297913079246960,-0.003535131120823293,-0.003172135834857631,-0.002394540511431994,-0.001446987945183210,-0.000565313024222397,0.000077183286844176,0.000398683570518787,0.000410241051441399,0.000194157039759913,-0.000131080782382850,-0.000447964097160471,-0.000669342652794807,-0.000753902990648886,-0.000706386452495882};//250-3700 Hz
static const float32_t FIR_HILB_I_coeffs_rx[IQ_HILBERT_TAPS_RX] =
//{1.184916684511330E-6,5.495187851192830E-6,0.000033840379282765,0.000131756987082493,0.000346610446249087,0.000686212071331583,0.001080605783388535,0.001377552373787196,0.001394469069795626,0.001023718549878922,0.000353056290896726,-0.000263867482074702,-0.000252182117595157,0.000995567718526529,0.003824038292443482,0.008020781513327347,0.012671228801095511,0.016291703631703871,0.017281600304893549,0.014602504124454760,0.008462390387394530,0.000716546420931058,-0.005262344892040617,-0.005338445681782295,0.004140778180062659,0.024955620998331700,0.055953014535124364,0.092744251946678791,0.128386567929371614,0.154958903256806030,0.165625340599038717,0.156577648180865114,0.128243450679993098,0.085352373172894513,0.035805263058504240,-0.011328593299906053,-0.048086624492370562,-0.069486353007591969,-0.074471271884586368,-0.065717656838996275,-0.048456557469197976,-0.028755507153804018,-0.011826169645826008,-0.000850063052109614,0.003411293934928160,0.002239659354787342,-0.001926794263410410,-0.006516625440889521,-0.009637173648367584,-0.010466629248143317,-0.009200409429964055,-0.006681314536909944,-0.003920158431248482,-0.001700621211114497,-0.000382670153832524,0.000082954298431821,-2.421702968013570E-6,-0.000282830558177374,-0.000497504547389206,-0.000540377608401341,-0.000435993654001571,-0.000270915868650005,-0.000125961068157200,-0.000039219921881752,-5.702029823285370E-6};
//{-0.001575352255390028,-0.002170959557198218,-0.002121335632081610,-0.001268321890269710,0.000214082066801776,0.001820087374506654,0.002868988455970804,0.002778527436608244,0.001352354253344376,-0.001047394653956560,-0.003543633476232026,-0.005026435107134432,-0.004593311474413224,-0.001982425346539827,0.002192673187639309,0.006544680069107512,0.009365997486806154,0.009300464982412240,0.005984259435757442,0.000379163288265683,-0.005393673114904896,-0.008733018170279480,-0.007552565090313074,-0.001233382215297248,0.008862751615296292,0.019599218813276351,0.027024828175798637,0.027831066085513685,0.020817632108399264,0.007804754770231617,-0.006437304884447034,-0.015362058941536945,-0.012655542237511799,0.005520744875658147,0.038802510871867001,0.082057108217332572,0.126287126737588212,0.160840312780322653,0.176317860326866860,0.167308709870542360,0.134092560913853104,0.082753613229871390,0.023637018523556173,-0.031400414758961118,-0.072117656807029001,-0.092459720888042607,-0.091829370376429909,-0.074745234377851216,-0.049083725615971727,-0.023529195508694784,-0.005061565589381637,0.002763078815581557,0.000295407917021287,-0.008972704221280950,-0.020034947469400457,-0.028235070569271048,-0.030737968455383982,-0.027179330586382750,-0.019390807326255293,-0.010421351044627882,-0.003286497848941252,0.000085258525755840,-0.000629976486755427,-0.004276117992893148,-0.008848943344777120,-0.012337971740777083,-0.013446543902637951,-0.011947971251870309,-0.008601414104673610,-0.004722567730170091,-0.001617352778616832,-0.000107318065114008,-0.000308042508314678,-0.001703636649113965,-0.003443043258865530,-0.004711671322298500,-0.005026144284125118,-0.004353314029306347,-0.003037976842447318,-0.001600113977710432,-0.000503060824434570};//81
{-0.000706386452495840,-0.000753902990648699,-0.000669342652794469,-0.000447964097160023,-0.000131080782382383, 0.000194157039760269, 0.000410241051441508, 0.000398683570518545, 0.000077183286843554,-0.000565313024223326,-0.001446987945184264,-0.002394540511432908,-0.003172135834858114,-0.003535131120823101,-0.003297913079245978,-0.002398997243074961,-0.000944148149322918, 0.000788989142956938, 0.002393338293507706, 0.003418818405293079, 0.003486861999459243, 0.002406663595503608, 0.000261883624050884,-0.002560636361192970,-0.005417635820076722,-0.007531852784953451,-0.008170322330640309,-0.006841092910979416,-0.003460414668084072, 0.001557143265674648, 0.007320589309802891, 0.012608228480701868, 0.016119879683142886, 0.016789691153416508, 0.014092762093236587, 0.008271539908173758, 0.000417596779568302,-0.007629675262482445,-0.013568226225344662,-0.015061461524423307,-0.010232066730345197, 0.001877868694476787, 0.020981685909172505, 0.045438831037759232, 0.072402731123212327, 0.098216174881300050, 0.118992512365208913, 0.131279384822705708, 0.132679955424931495, 0.122310156625427616, 0.100999326286733720, 0.071190257839371385, 0.036553204326085928, 0.001384539202494616,-0.030097218495004661,-0.054426250097594497,-0.069411116355642996,-0.074411804700080061,-0.070330873139849259,-0.059334379228730430,-0.044369976428066192,-0.028585437454540653,-0.014764120775418766,-0.004882835459279336, 0.000134235057537974, 0.000436567879002562,-0.002938316013826486,-0.008398829975218776,-0.014198845961741858,-0.018814829071274956,-0.021226446072526769,-0.021054646949825749,-0.018546326251501485,-0.014428469186862395,-0.009679911182061778,-0.005280798286707850,-0.001997255249874896,-0.000243775444102278,-0.000043168385097257,-0.001079524908286644,-0.002819327223665629,-0.004663721731597417,-0.006092891181815217,-0.006770665800048853,-0.006591161622690369,-0.005665303208152581,-0.004259463736790689,-0.002707937633194249,-0.001323929333612945,-0.000330362848449730,0.000176215947604601,0.000225444888657421,-0.000057197159446002,-0.000498335198944665,-0.000927408331001314,-0.001217097217842328,-0.001305223451309055,-0.001196005513387714,-0.000944226794009803,-0.000629676581963740,-0.000330456715070669};//250-3700 Hz
static const float32_t FIR_HILB_I_coeffs_tx[IQ_HILBERT_TAPS_TX] = {0.000000000000000000, 0.000348718040684899, 0.000000000000000000, 0.000430833440231578, 0.000000000000000000, 0.000522908939129710, 0.000000000000000000, 0.000625643170080525, 0.000000000000000000, 0.000739763696285730, 0.000000000000000000, 0.000866029072658519, 0.000000000000000000, 0.001005231378692548, 0.000000000000000000, 0.001158199311056187, 0.000000000000000000, 0.001325801939712967, 0.000000000000000000, 0.001508953250504772, 0.000000000000000000, 0.001708617620559288, 0.000000000000000000, 0.001925816401721571, 0.000000000000000000, 0.002161635822912572, 0.000000000000000000, 0.002417236466741860, 0.000000000000000000, 0.002693864631427011, 0.000000000000000000, 0.002992865959230020, 0.000000000000000000, 0.003315701801645692, 0.000000000000000000, 0.003663968905292113, 0.000000000000000000, 0.004039423148679463, 0.000000000000000000, 0.004444008249195281, 0.000000000000000000, 0.004879890607273629, 0.000000000000000000, 0.005349501779412148, 0.000000000000000000, 0.005855590504225607, 0.000000000000000000, 0.006401286783911277, 0.000000000000000000, 0.006990181306750123, 0.000000000000000000, 0.007626424567085178, 0.000000000000000000, 0.008314851520255883, 0.000000000000000000, 0.009061139683747135, 0.000000000000000000, 0.009872011537848968, 0.000000000000000000, 0.010755496313062237, 0.000000000000000000, 0.011721272439718031, 0.000000000000000000, 0.012781121134483500, 0.000000000000000000, 0.013949535528809384, 0.000000000000000000, 0.015244551273554119, 0.000000000000000000, 0.016688898584430931, 0.000000000000000000, 0.018311630846033072, 0.000000000000000000, 0.020150476814457717, 0.000000000000000000, 0.022255321565352600, 0.000000000000000000, 0.024693503177301100, 0.000000000000000000, 0.027558135563807963, 0.000000000000000000, 0.030981687165876175, 0.000000000000000000, 0.035159143774044777, 0.000000000000000000, 0.040389700574458606, 0.000000000000000000, 0.047156937867897229, 0.000000000000000000, 0.056296459573201306, 0.000000000000000000, 0.069387047614511754, 0.000000000000000000, 0.089812363821891061, 0.000000000000000000, 0.126370732214445475, 0.000000000000000000, 0.211324043214114715, 0.000000000000000000, 0.635033486245172751, 0.000000000000000000, -0.635033486245172751, 0.000000000000000000, -0.211324043214114715, 0.000000000000000000, -0.126370732214445475, 0.000000000000000000, -0.089812363821891061, 0.000000000000000000, -0.069387047614511754, 0.000000000000000000, -0.056296459573201306, 0.000000000000000000, -0.047156937867897229, 0.000000000000000000, -0.040389700574458606, 0.000000000000000000, -0.035159143774044777, 0.000000000000000000, -0.030981687165876175, 0.000000000000000000, -0.027558135563807963, 0.000000000000000000, -0.024693503177301100, 0.000000000000000000, -0.022255321565352600, 0.000000000000000000, -0.020150476814457717, 0.000000000000000000, -0.018311630846033072, 0.000000000000000000, -0.016688898584430931, 0.000000000000000000, -0.015244551273554119, 0.000000000000000000, -0.013949535528809384, 0.000000000000000000, -0.012781121134483500, 0.000000000000000000, -0.011721272439718031, 0.000000000000000000, -0.010755496313062237, 0.000000000000000000, -0.009872011537848968, 0.000000000000000000, -0.009061139683747135, 0.000000000000000000, -0.008314851520255883, 0.000000000000000000, -0.007626424567085178, 0.000000000000000000, -0.006990181306750123, 0.000000000000000000, -0.006401286783911277, 0.000000000000000000, -0.005855590504225607, 0.000000000000000000, -0.005349501779412148, 0.000000000000000000, -0.004879890607273629, 0.000000000000000000, -0.004444008249195281, 0.000000000000000000, -0.004039423148679463, 0.000000000000000000, -0.003663968905292113, 0.000000000000000000, -0.003315701801645692, 0.000000000000000000, -0.002992865959230020, 0.000000000000000000, -0.002693864631427011, 0.000000000000000000, -0.002417236466741860, 0.000000000000000000, -0.002161635822912572, 0.000000000000000000, -0.001925816401721571, 0.000000000000000000, -0.001708617620559288, 0.000000000000000000, -0.001508953250504772, 0.000000000000000000, -0.001325801939712967, 0.000000000000000000, -0.001158199311056187, 0.000000000000000000, -0.001005231378692548, 0.000000000000000000, -0.000866029072658519, 0.000000000000000000, -0.000739763696285730, 0.000000000000000000, -0.000625643170080525, 0.000000000000000000, -0.000522908939129710, 0.000000000000000000, -0.000430833440231578, 0.000000000000000000, -0.000348718040684899, 0.000000000000000000};
static const float32_t FIR_HILB_Q_coeffs_tx[IQ_HILBERT_TAPS_TX] = {-0.000056786545255326, 263.1346287525080E-18, -0.000071793697491707, 391.3417109364890E-18, -0.000088874802368221, 336.4125900077540E-18, -0.000108170884956264, 392.7791496728210E-18, -0.000129819032785321, 590.4838201243310E-18, -0.000153950719729993, 596.8112038672230E-18, -0.000180690067531663, 746.3322026715040E-18, -0.000210152062867355, 1.093346048537350E-15, -0.000242440749545727, 1.065677310743770E-15, -0.000277647416860387, 1.039585124576320E-15, -0.000315848806349421, 1.538815826232670E-15, -0.000357105360160803, 1.666207014701170E-15, -0.000401459534874215, 1.539685561133540E-15, -0.000448934204947304, 2.660369443631100E-15, -0.000499531179987328, 3.040479628793550E-15, -0.000553229859656923, 1.044067344343770E-15, -0.000609986049322792, 2.032026148997660E-15, -0.000669730958505527, 6.994036442534390E-15, -0.000732370402749788, 7.411458451156190E-15, -0.000797784227648926, 3.101364677149160E-15, -0.000865825971964948, 2.594164153512510E-15, -0.000936322783811445, 5.348323407953660E-15, -0.001009075601815882, 5.884744611617880E-15, -0.001083859609627728, 5.492731038694370E-15, -0.001160424969305250, 6.445309139376350E-15, -0.001238497835651963, 6.872918232978370E-15, -0.001317781650032627, 6.663418858584270E-15, -0.001397958708679671, 8.133197857946460E-15, -0.001478691996873688, 9.905768905631310E-15, -0.001559627276797271, 10.20890941488510E-15, -0.001640395413295664, 11.20755554836600E-15, -0.001720614918466468, 12.64985408146260E-15, -0.001799894692718967, 12.97295013621260E-15, -0.001877836936972348, 14.24353199778040E-15, -0.001954040207976172, 16.47390711328630E-15, -0.002028102586337237, 18.06444101550620E-15, -0.002099624924798889, 19.78135011594340E-15, -0.002168214142707746, 21.50931561512560E-15, -0.002233486531418778, 23.52243144574740E-15, -0.002295071034610703, 26.83685625665210E-15, -0.002352612467220998, 30.78295485673010E-15, -0.002405774636936983, 35.50722610113330E-15, -0.002454243332825246, 40.92479516392550E-15, -0.002497729146841703, 46.97877831911210E-15, -0.002535970095673103, 56.20264720417670E-15, -0.002568734012302652, 69.94947997469540E-15, -0.002595820679318180, 90.43954876597660E-15, -0.002617063678801859, 127.2729571918730E-15, -0.002632331936897800, 212.5921889885520E-15, -0.002641530944731846, 638.3507757132560E-15, 0.997207486382091335, 638.3507757132560E-15, -0.002641530944731846, 212.5921889885520E-15, -0.002632331936897800, 127.2729571918730E-15, -0.002617063678801859, 90.43954876597660E-15, -0.002595820679318180, 69.94947997469540E-15, -0.002568734012302652, 56.20264720417670E-15, -0.002535970095673103, 46.97877831911210E-15, -0.002497729146841703, 40.92479516392550E-15, -0.002454243332825246, 35.50722610113330E-15, -0.002405774636936983, 30.78295485673010E-15, -0.002352612467220998, 26.83685625665210E-15, -0.002295071034610703, 23.52243144574740E-15, -0.002233486531418778, 21.50931561512560E-15, -0.002168214142707746, 19.78135011594340E-15, -0.002099624924798889, 18.06444101550620E-15, -0.002028102586337237, 16.47390711328630E-15, -0.001954040207976172, 14.24353199778040E-15, -0.001877836936972348, 12.97295013621260E-15, -0.001799894692718967, 12.64985408146260E-15, -0.001720614918466468, 11.20755554836600E-15, -0.001640395413295664, 10.20890941488510E-15, -0.001559627276797271, 9.905768905631310E-15, -0.001478691996873688, 8.133197857946460E-15, -0.001397958708679671, 6.663418858584270E-15, -0.001317781650032627, 6.872918232978370E-15, -0.001238497835651963, 6.445309139376350E-15, -0.001160424969305250, 5.492731038694370E-15, -0.001083859609627728, 5.884744611617880E-15, -0.001009075601815882, 5.348323407953660E-15, -0.000936322783811445, 2.594164153512510E-15, -0.000865825971964948, 3.101364677149160E-15, -0.000797784227648926, 7.411458451156190E-15, -0.000732370402749788, 6.994036442534390E-15, -0.000669730958505527, 2.032026148997660E-15, -0.000609986049322792, 1.044067344343770E-15, -0.000553229859656923, 3.040479628793550E-15, -0.000499531179987328, 2.660369443631100E-15, -0.000448934204947304, 1.539685561133540E-15, -0.000401459534874215, 1.666207014701170E-15, -0.000357105360160803, 1.538815826232670E-15, -0.000315848806349421, 1.039585124576320E-15, -0.000277647416860387, 1.065677310743770E-15, -0.000242440749545727, 1.093346048537350E-15, -0.000210152062867355, 746.3322026715040E-18, -0.000180690067531663, 596.8112038672230E-18, -0.000153950719729993, 590.4838201243310E-18, -0.000129819032785321, 392.7791496728210E-18, -0.000108170884956264, 336.4125900077540E-18, -0.000088874802368221, 391.3417109364890E-18, -0.000071793697491707, 263.1346287525080E-18, -0.000056786545255326};
static const IIR_BIQUAD_FILTER IIR_Biquad_Filters[IIR_FILTERS_COUNT] = (const IIR_BIQUAD_FILTER[]){
//IIR RX/TX IIR Highpass Fs=48000 Apass=1 Astop=120 // coefficients converted to Direct-Form II Transposed by MATLAB // https://ua3reo.ru/services/matlab_to_arm_biquad.php
{
.width = 60,
.type = IIR_BIQUAD_HPF,
.stages = 15,
.coeffs = (float32_t[]){0.9998945186242, 0, 0, 0, 0, 1, -2, 1, 1.999758132887, -0.99981994161, 0.9996889367649, 0, 0, 0, 0, 1, -2, 1, 1.999343665899, -0.9994120811608, 0.9993922022251, 0, 0, 0, 0, 1, -2, 1, 1.99874202768, -0.9988267812205, 0.9988594148129, 0, 0, 0, 0, 1, -2, 1, 1.997658474509, -0.9977791847428, 0.9976379235525, 0, 0, 0, 0, 1, -2, 1, 1.995171008271, -0.9953806859393, 0.993575273017, 0, 0, 0, 0, 1, -2, 1, 1.9868941568, -0.9874069352679, 0.9658298859242, 0, 0, 0, 0, 1, -2, 1, 1.930363237657, -0.9329563060393, 0.8912509381337, 0, 0, 0, 0},
},
{
.width = 100,
.type = IIR_BIQUAD_HPF,
.stages = 15,
.coeffs = (float32_t[]){0.9998070433437, 0, 0, 0, 0, 1, -2, 1, 1.99952824718, -0.9996999261949, 0.9994626733323, 0, 0, 0, 0, 1, -2, 1, 1.998830345237, -0.9990203480919, 0.998963895279, 0, 0, 0, 0, 1, -2, 1, 1.997810125605, -0.9980454555113, 0.9980670102991, 0, 0, 0, 0, 1, -2, 1, 1.995966497435, -0.9963015437617, 0.9960114376034, 0, 0, 0, 0, 1, -2, 1, 1.991732125694, -0.99231362472, 0.9891973898471, 0, 0, 0, 0, 1, -2, 1, 1.977685712474, -0.9791038469146, 0.9436531717078, 0, 0, 0, 0, 1, -2, 1, 1.883787490005, -0.8908251968259, 0.8912509381337, 0, 0, 0, 0},
},
{
.width = 200,
.type = IIR_BIQUAD_HPF,
.stages = 15,
.coeffs = (float32_t[]){0.9995283511221, 0, 0, 0, 0, 1, -2, 1, 1.998713410513, -0.9993999939754, 0.9988310262326, 0, 0, 0, 0, 1, -2, 1, 1.997282254376, -0.9980418505545, 0.9978125457543, 0, 0, 0, 0, 1, -2, 1, 1.995154933871, -0.9960952491464, 0.9959747660947, 0, 0, 0, 0, 1, -2, 1, 1.991280786954, -0.9926182774253, 0.9917669813622, 0, 0, 0, 0, 1, -2, 1, 1.98237582151, -0.9846921039384, 0.9779386809936, 0, 0, 0, 0, 1, -2, 1, 1.953073134305, -0.9586815896694, 0.8903472269478, 0, 0, 0, 0, 1, -2, 1, 1.767413007236, -0.7939759005556, 0.8912509381337, 0, 0, 0, 0},
},
{
.width = 300,
.type = IIR_BIQUAD_HPF,
.stages = 15,
.coeffs = (float32_t[]){0.9991640098344, 0, 0, 0, 0, 1, -2, 1, 1.997555784552, -0.9991002547852, 0.998105326748, 0, 0, 0, 0, 1, -2, 1, 1.995356606708, -0.9970647002838, 0.9965466117696, 0, 0, 0, 0, 1, -2, 1, 1.992036560075, -0.9941498870033, 0.9937250727065, 0, 0, 0, 0, 1, -2, 1, 1.985948652965, -0.9889516378612, 0.9872730937592, 0, 0, 0, 0, 1, -2, 1, 1.971951806778, -0.9771405682585, 0.9662614994334, 0, 0, 0, 0, 1, -2, 1, 1.926287935636, -0.9387580620975, 0.8400927948412, 0, 0, 0, 0, 1, -2, 1, 1.651985027197, -0.7083861521682, 0.8912509381337, 0, 0, 0, 0},
},
{
.width = 400,
.type = IIR_BIQUAD_HPF,
.stages = 15,
.coeffs = (float32_t[]){0.9987141206486, 0, 0, 0, 0, 1, -2, 1, 1.996055722606, -0.9988007599883, 0.997285863546, 0, 0, 0, 0, 1, -2, 1, 1.993054364875, -0.9960890893095, 0.9951667918349, 0, 0, 0, 0, 1, -2, 1, 1.988457296701, -0.9922098706388, 0.9913198227663, 0, 0, 0, 0, 1, -2, 1, 1.979976254042, -0.9853030370226, 0.982536466246, 0, 0, 0, 0, 1, -2, 1, 1.960481910207, -0.9696639547771, 0.9542033020911, 0, 0, 0, 0, 1, -2, 1, 1.897458185064, -0.9193550233007, 0.7928443133024, 0, 0, 0, 0, 1, -2, 1, 1.538364485671, -0.6330127675387, 0.8912509381337, 0, 0, 0, 0},
},
{
.width = 500,
.type = IIR_BIQUAD_HPF,
.stages = 15,
.coeffs = (float32_t[]){0.9981787993571, 0, 0, 0, 0, 1, -2, 1, 1.994213636568, -0.9985015608603, 0.9963729457258, 0, 0, 0, 0, 1, -2, 1, 1.990376574159, -0.9951152087441, 0.9936738219286, 0, 0, 0, 0, 1, -2, 1, 1.98441959088, -0.9902756968342, 0.9887609930392, 0, 0, 0, 0, 1, -2, 1, 1.973370111394, -0.9816738607631, 0.9775639982538, 0, 0, 0, 0, 1, -2, 1, 1.947988992653, -0.9622670003627, 0.9418011512827, 0, 0, 0, 0, 1, -2, 1, 1.866713400754, -0.9004912043762, 0.748515491982, 0, 0, 0, 0, 1, -2, 1, 1.427203352458, -0.5668586154696, 0.8912509381337, 0, 0, 0, 0},
},
//used for the FM noise squelch
{
.width = 15000,
.type = IIR_BIQUAD_HPF,
.stages = 15,
.coeffs = (float32_t[]){0.3049851455408, 0, 0, 0, 0, 1, -2, 1, -0.7591287465444, -0.9790693287075, 0.2780078711753, 0, 0, 0, 0, 1, -2, 1, -0.8256589275237, -0.9376904122248, 0.2323960275367, 0, 0, 0, 0, 1, -2, 1, -0.9664437350711, -0.8960278452179, 0.1720665990118, 0, 0, 0, 0, 1, -2, 1, -1.165936151782, -0.8542025478295, 0.1051104068231, 0, 0, 0, 0, 1, -2, 1, -1.394079028152, -0.8145206554444, 0.04513708899945, 0, 0, 0, 0, 1, -2, 1, -1.601425033622, -0.78197338962, 0.008951452064989, 0, 0, 0, 0, 1, -2, 1, -1.727386349532, -0.7631921577923, 0.8912509381337, 0, 0, 0, 0},
},
{
.width = 20000,
.type = IIR_BIQUAD_HPF,
.stages = 15,
.coeffs = (float32_t[]){0.0664759669061, 0, 0, 0, 0, 1, -2, 1, -1.722719616758, -0.9886234843822, 0.05976585969453, 0, 0, 0, 0, 1, -2, 1, -1.727533129144, -0.9665965679221, 0.04829462608705, 0, 0, 0, 0, 1, -2, 1, -1.752941532896, -0.9461200372446, 0.03407949397928, 0, 0, 0, 0, 1, -2, 1, -1.791673048598, -0.9279910245151, 0.0197409684492, 0, 0, 0, 0, 1, -2, 1, -1.834168405903, -0.9131322796994, 0.00809367952317, 0, 0, 0, 0, 1, -2, 1, -1.870134827536, -0.9025095456287, 0.001562021017125, 0, 0, 0, 0, 1, -2, 1, -1.890706281461, -0.8969543655294, 0.8912509381337, 0, 0, 0, 0},
},
//IIR RX/TX IIR Lowpass Fs=48000 Apass=1 Astop=120 // coefficients converted to Direct-Form II Transposed by MATLAB // https://ua3reo.ru/services/matlab_to_arm_biquad.php
{
.width = 100,
.type = IIR_BIQUAD_LPF,
.stages = 15,
.coeffs = (float32_t[]){0.7208249334091,0,0,0,0,1,-1.999778997495,1,1.999439781257,-0.9996040129205,0.7429805216488,0,0,0,0,1,-1.999754828728,1,1.999056772806,-0.9992054066203,0.6060753731942,0,0,0,0,1,-1.99969848302,1,1.998483224057,-0.9986051015077,0.4040649675117,0,0,0,0,1,-1.999550310328,1,1.997690564915,-0.9977738396473,0.1851242413914,0,0,0,0,1,-1.998994965209,1,1.996804854186,-0.9968443765289,0.03938043700753,0,0,0,0,1,-1.992011689511,1,1.996176352021,-0.9961846783158,0.00104216721092,0,0,0,0,1,-1.999788340031,1,1.999709903108,-0.9998811122444,1,0,0,0,0},
},
{
.width = 100, //gauss Q30
.type = IIR_BIQUAD_LPF_GAUSS,
.stages = 3,
.coeffs = (float32_t[]){0.0002143270359125,0,0,0,0,1,0,-1,1.999528518437,-0.9995713459282,1,0,0,0,0},
},
{
.width = 150,
.type = IIR_BIQUAD_LPF,
.stages = 15,
.coeffs = (float32_t[]){0.7207663679481,0,0,0,0,1,-1.999502760955,1,1.999036619167,-0.9994060980585,0.7428553682145,0,0,0,0,1,-1.99944838721,1,1.998474024666,-0.9988083807338,0.6058981026978,0,0,0,0,1,-1.9993216265,1,1.997634295991,-0.9979084240038,0.4038864514181,0,0,0,0,1,-1.998988304298,1,1.996475378457,-0.996662644194,0.185034119949,0,0,0,0,1,-1.997739301064,1,1.99518141299,-0.9952702702351,0.03944102586584,0,0,0,0,1,-1.982070421081,1,1.994263667199,-0.9942823841278,0.001042149410275,0,0,0,0,1,-1.99952377957,1,1.999436477776,-0.999821680025,1,0,0,0,0},
},
{
.width = 150, //gauss Q30
.type = IIR_BIQUAD_LPF_GAUSS,
.stages = 3,
.coeffs = (float32_t[]){0.0003214561070949,0,0,0,0,1,0,-1,1.999260736687,-0.9993570877858,1,0,0,0,0},
},
{
.width = 200,
.type = IIR_BIQUAD_LPF,
.stages = 15,
.coeffs = (float32_t[]){0.72071293336,0,0,0,0,1,-1.999116060767,1,1.998551474236,-0.9992082462229,0.74273923566,0,0,0,0,1,-1.999019411215,1,1.997817269575,-0.9984115533916,0.6057345646873,0,0,0,0,1,-1.998794101473,1,1.996725115572,-0.9972122828077,0.4037266243069,0,0,0,0,1,-1.998201693769,1,1.995219980663,-0.995552716956,0.1849664489646,0,0,0,0,1,-1.995982544993,1,1.993540763584,-0.9936986127449,0.03954071763951,0,0,0,0,1,-1.968234357343,1,1.992350363641,-0.992383608041,0.00104213688186,0,0,0,0,1,-1.999153421989,1,1.99907749239,-0.999762258967,1,0,0,0,0},
},
{
.width = 200, //gauss Q30
.type = IIR_BIQUAD_LPF_GAUSS,
.stages = 3,
.coeffs = (float32_t[]){0.0004285622244523,0,0,0,0,1,0,-1,1.998971604131,-0.9991428755511,1,0,0,0,0},
},
{
.width = 250,
.type = IIR_BIQUAD_LPF,
.stages = 15,
.coeffs = (float32_t[]){0.720664630314,0,0,0,0,1,-1.998618927893,1,1.997984389508,-0.999010465336,0.7426321228591,0,0,0,0,1,-1.998467942861,1,1.997086571898,-0.9980149380731,0.6055847496559,0,0,0,0,1,-1.998115982012,1,1.995755763839,-0.9965166942234,0.4035854587266,0,0,0,0,1,-1.99719067651,1,1.993924446042,-0.9944440666845,0.1849211788432,0,0,0,0,1,-1.993725868381,1,1.991882932514,-0.9921293880475,0.03967941092905,0,0,0,0,1,-1.950583777507,1,1.99043640762,-0.9904883056732,0.001042129625741,0,0,0,0,1,-1.998677294347,1,1.998632969917,-0.9997028516111,1,0,0,0,0},
},
{
.width = 250, //gauss Q30
.type = IIR_BIQUAD_LPF_GAUSS,
.stages = 3,
.coeffs = (float32_t[]){0.0005356453959978,0,0,0,0,1,0,-1,1.998661128432,-0.998928709208,1,0,0,0,0},
},
{
.width = 300,
.type = IIR_BIQUAD_LPF,
.stages = 15,
.coeffs = (float32_t[]){0.7206214592866,0,0,0,0,1,-1.998011402133,1,1.997335411073,-0.9988127633125,0.7425340284537,0,0,0,0,1,-1.997794036286,1,1.996281997835,-0.9976185482359,0.6054486480294,0,0,0,0,1,-1.997287363311,1,1.994726322031,-0.9958216745118,0.4034629277141,0,0,0,0,1,-1.995955506583,1,1.992588847953,-0.9933367020948,0.1848982613918,0,0,0,0,1,-1.990970773959,1,1.990207945175,-0.9905625802184,0.03985700780755,0,0,0,0,1,-1.929219894403,1,1.988521765331,-0.9885964329325,0.00104212764176,0,0,0,0,1,-1.998095431429,1,1.998102936976,-0.999643460497,1,0,0,0,0},
},
{
.width = 300, //gauss Q30
.type = IIR_BIQUAD_LPF_GAUSS,
.stages = 3,
.coeffs = (float32_t[]){0.0006427056297418,0,0,0,0,1,0,-1,1.99832931748,-0.9987145887405,1,0,0,0,0},
},
{
.width = 350,
.type = IIR_BIQUAD_LPF,
.stages = 15,
.coeffs = (float32_t[]){0.7205834205616,0,0,0,0,1,-1.997293532117,1,1.99660458806,-0.99861514806,0.7424449508537,0,0,0,0,1,-1.996997757633,1,1.99540361542,-0.9972223973154,0.6053262501675,0,0,0,0,1,-1.996308361653,1,1.993636871581,-0.9951272398908,0.4033590047953,0,0,0,0,1,-1.994496494189,1,1.991213258601,-0.992230631867,0.1848976498142,0,0,0,0,1,-1.987719093305,1,1.988515825824,-0.9889981734199,0.04007341379976,0,0,0,0,1,-1.90426342632,1,1.986606402888,-0.9867079460128,0.001042130929534,0,0,0,0,1,-1.997407875739,1,1.99748742383,-0.9995840881632,1,0,0,0,0},
},
{
.width = 350, //gauss Q30
.type = IIR_BIQUAD_LPF_GAUSS,
.stages = 3,
.coeffs = (float32_t[]){0.0007497429336899,0,0,0,0,1,0,-1,1.997976179388,-0.9985005141326,1,0,0,0,0},
},
{
.width = 400,
.type = IIR_BIQUAD_LPF,
.stages = 15,
.coeffs = (float32_t[]){0.7205505142308,0,0,0,0,1,-1.996465375298,1,1.995791972632,-0.9984176274778,0.7423648882386,0,0,0,0,1,-1.996079185037,1,1.994451494511,-0.9968264987251,0.6052175463649,0,0,0,0,1,-1.995179114375,1,1.992487494118,-0.9944334065369,0.4032736639842,0,0,0,0,1,-1.992814005477,1,1.989797749049,-0.9911258646493,0.1849192987046,0,0,0,0,1,-1.98397298382,1,1.986806597581,-0.9874361519016,0.04032853786182,0,0,0,0,1,-1.875852930095,1,1.984690286325,-0.98482280139,0.001042139488453,0,0,0,0,1,-1.996614677492,1,1.996786464388,-0.999524737147,1,0,0,0,0},
},
{
.width = 400, //gauss Q30
.type = IIR_BIQUAD_LPF_GAUSS,
.stages = 3,
.coeffs = (float32_t[]){0.0008567573158444,0,0,0,0,1,0,-1,1.997601722498,-0.9982864853683,1,0,0,0,0},
},
{
.width = 450,
.type = IIR_BIQUAD_LPF,
.stages = 15,
.coeffs = (float32_t[]){0.720522740194,0,0,0,0,1,-1.995526997943,1,1.994897619985,-0.9982202094577,0.7422938385575,0,0,0,0,1,-1.995038408611,1,1.993425706782,-0.9964308658566,0.6051225268525,0,0,0,0,1,-1.993899779815,1,1.991278271456,-0.9937401905854,0.4032068797833,0,0,0,0,1,-1.990908462318,1,1.988342389214,-0.9900224090586,0.1849631640421,0,0,0,0,1,-1.979734925169,1,1.985080282437,-0.9858765000009,0.04062229236161,0,0,0,0,1,-1.844142937358,1,1.982773381593,-0.9829409558176,0.001042153317685,0,0,0,0,1,-1.995715894613,1,1.9960000962,-0.9994654099842,1,0,0,0,0},
},
{
.width = 450, //gauss Q30
.type = IIR_BIQUAD_LPF_GAUSS,
.stages = 3,
.coeffs = (float32_t[]){0.0009637487842045,0,0,0,0,1,0,-1,1.997205955375,-0.9980725024316,1,0,0,0,0},
},
{
.width = 500,
.type = IIR_BIQUAD_LPF,
.stages = 15,
.coeffs = (float32_t[]){0.7205000981589,0,0,0,0,1,-1.994478475121,1,1.993921588337,-0.9980229018828,0.7422317995304,0,0,0,0,1,-1.99387553042,1,1.992326325722,-0.9960355120791,0.605041181799,0,0,0,0,1,-1.992470537271,1,1.990009285596,-0.9930476081313,0.4031586271833,0,0,0,0,1,-1.988780342047,1,1.986847247871,-0.9889202736833,0.1850292031848,0,0,0,0,1,-1.975007715206,1,1.983336901258,-0.9843192021433,0.04095459305977,0,0,0,0,1,-1.80930193913,1,1.980855654558,-0.9810623663232,0.001042172416172,0,0,0,0,1,-1.994711592723,1,1.995128360456,-0.9994061092093,1,0,0,0,0},
},
{
.width = 500, //gauss Q30
.type = IIR_BIQUAD_LPF_GAUSS,
.stages = 3,
.coeffs = (float32_t[]){0.001070717346765,0,0,0,0,1,0,-1,1.99678888681,-0.9978585653065,1,0,0,0,0},
},
{
.width = 550,
.type = IIR_BIQUAD_LPF,
.stages = 15,
.coeffs = (float32_t[]){0.720482587642,0,0,0,0,1,-1.993319890691,1,1.992863938922,-0.9978257126279,0.7421787686485,0,0,0,0,1,-1.992590664465,1,1.991153426622,-0.9956404507398,0.6049735013114,0,0,0,0,1,-1.99089158693,1,1.988680618721,-0.9923556752304,0.4031288816626,0,0,0,0,1,-1.986430177167,1,1.985312392662,-0.987819467085,0.1851173748647,0,0,0,0,1,-1.969794465394,1,1.981576473791,-0.9827642428434,0.04132535909133,0,0,0,0,1,-1.771510265592,1,1.978937070998,-0.979186990204,0.001042196782629,0,0,0,0,1,-1.993601845129,1,1.994171301981,-0.9993468373552,1,0,0,0,0},
},
{
.width = 550, //gauss Q30
.type = IIR_BIQUAD_LPF_GAUSS,
.stages = 3,
.coeffs = (float32_t[]){0.001177663011516,0,0,0,0,1,0,-1,1.99635052582,-0.997644673977,1,0,0,0,0},
},
{
.width = 600,
.type = IIR_BIQUAD_LPF,
.stages = 15,
.coeffs = (float32_t[]){0.7204702079685,0,0,0,0,1,-1.992051337287,1,1.991724735993,-0.9976286495591,0.7421347431752,0,0,0,0,1,-1.991183936653,1,1.989907086576,-0.9952456951636,0.604919475437,0,0,0,0,1,-1.98916314981,1,1.987292353191,-0.9916644078999,0.4031176191874,0,0,0,0,1,-1.983858555024,1,1.983737890091,-0.9867199977999,0.1852276391821,0,0,0,0,1,-1.964098595732,1,1.979799018669,-0.9812116067047,0.04173451294799,0,0,0,0,1,-1.730957907744,1,1.977017596602,-0.9773147850232,0.00104222641555,0,0,0,0,1,-1.992386732821,1,1.993128969233,-0.999287596953,1,0,0,0,0},
},
{
.width = 600, //gauss Q30
.type = IIR_BIQUAD_LPF_GAUSS,
.stages = 3,
.coeffs = (float32_t[]){0.001284585786447,0,0,0,0,1,0,-1,1.995890881647,-0.9974308284271,1,0,0,0,0},
},
{
.width = 650,
.type = IIR_BIQUAD_LPF,
.stages = 15,
.coeffs = (float32_t[]){0.7204629582723,0,0,0,0,1,-1.990672916305,1,1.990504046804,-0.9974317205332,0.7420997201468,0,0,0,0,1,-1.989655484775,1,1.988587384469,-0.9948512586532,0.6048790941635,0,0,0,0,1,-1.987285467683,1,1.985844571543,-0.9909738221192,0.4031248162113,0,0,0,0,1,-1.98106611745,1,1.982123805535,-0.9856218743413,0.1853599576003,0,0,0,0,1,-1.957923829211,1,1.978004553417,-0.9796612784204,0.04218198046103,0,0,0,0,1,-1.687842326134,1,1.975097196968,-0.975445708606,0.001042261313204,0,0,0,0,1,-1.991066344448,1,1.992001414299,-0.9992283905322,1,0,0,0,0},
},
{
.width = 650, //gauss Q30
.type = IIR_BIQUAD_LPF_GAUSS,
.stages = 3,
.coeffs = (float32_t[]){0.001391485679541,0,0,0,0,1,0,-1,1.995409963756,-0.9972170286409,1,0,0,0,0},
},
{
.width = 700,
.type = IIR_BIQUAD_LPF,
.stages = 15,
.coeffs = (float32_t[]){0.7204608374967,0,0,0,0,1,-1.989184737884,1,1.989201941615,-0.997234933398,0.7420736963727,0,0,0,0,1,-1.988005458472,1,1.987194400975,-0.9944571544889,0.6048523474207,0,0,0,0,1,-1.985258802999,1,1.984337356487,-0.9902839338306,0.403150449675,0,0,0,0,1,-1.978053560366,1,1.980470203241,-0.9845251052012,0.1855142929409,0,0,0,0,1,-1.951274185804,1,1.976193094456,-0.9781132427738,0.04266769078477,0,0,0,0,1,-1.642366288879,1,1.9731758376,-0.9735797190357,0.001042301473633,0,0,0,0,1,-1.989640776319,1,1.990788692891,-0.9991692206202,1,0,0,0,0},
},
{
.width = 700, //gauss Q30
.type = IIR_BIQUAD_LPF_GAUSS,
.stages = 3,
.coeffs = (float32_t[]){0.001498362698778,0,0,0,0,1,0,-1,1.99490778184,-0.9970032746024,1,0,0,0,0},
},
{
.width = 750,
.type = IIR_BIQUAD_LPF,
.stages = 15,
.coeffs = (float32_t[]){0.7204638443945,0,0,0,0,1,-1.987586920891,1,1.987818493681,-0.9970382959918,0.7420566684368,0,0,0,0,1,-1.986234019206,1,1.985728218548,-0.9940633959286,0.6048392250815,0,0,0,0,1,-1.983083438794,1,1.982770790904,-0.9895947589406,0.4031944970061,0,0,0,0,1,-1.974821633363,1,1.978777146333,-0.9834296988519,0.1856906093788,0,0,0,0,1,-1.944153976023,1,1.974364657107,-0.976567484639,0.04319157638077,0,0,0,0,1,-1.594735777206,1,1.971253483906,-0.9717167746503,0.001042346894657,0,0,0,0,1,-1.988110132376,1,1.989490864345,-0.9991100897426,1,0,0,0,0},
},
{
.width = 750, //gauss Q30
.type = IIR_BIQUAD_LPF_GAUSS,
.stages = 3,
.coeffs = (float32_t[]){0.001605216852135,0,0,0,0,1,0,-1,1.994384345814,-0.9967895662957,1,0,0,0,0},
},
{
.width = 800,
.type = IIR_BIQUAD_LPF,
.stages = 15,
.coeffs = (float32_t[]){0.720471977528,0,0,0,0,1,-1.985879592896,1,1.986353779246,-0.9968418161432,0.7420486326976,0,0,0,0,1,-1.984341340221,1,1.984188921422,-0.9936699962079,0.6048397169624,0,0,0,0,1,-1.980759678604,1,1.981144957841,-0.9889063133199,0.4032569361186,0,0,0,0,1,-1.971371139242,1,1.977044696816,-0.9823356637484,0.1858888724372,0,0,0,0,1,-1.93656779404,1,1.972519255598,-0.9750239889809,0.0437535730025,0,0,0,0,1,-1.545157991834,1,1.969330101199,-0.9698568340382,0.001042397573873,0,0,0,0,1,-1.986474524189,1,1.988107991613,-0.9990510004227,1,0,0,0,0},
},
{
.width = 800, //gauss Q30
.type = IIR_BIQUAD_LPF_GAUSS,
.stages = 3,
.coeffs = (float32_t[]){0.001712048147584,0,0,0,0,1,0,-1,1.993839665819,-0.9965759037048,1,0,0,0,0},
},
{
.width = 850,
.type = IIR_BIQUAD_LPF,
.stages = 15,
.coeffs = (float32_t[]){0.7204852352697,0,0,0,0,1,-1.984062890156,1,1.98480787754,-0.9966455016707,0.7420495852893,0,0,0,0,1,-1.98232760651,1,1.982576595597,-0.9932769685399,0.6048538128248,0,0,0,0,1,-1.97828784636,1,1.979459940513,-0.9882186128049,0.4033377454126,0,0,0,0,1,-1.967702933531,1,1.975272915576,-0.9812430083297,0.1861090489832,0,0,0,0,1,-1.928520510423,1,1.970656903068,-0.9734827408562,0.0443536196807,0,0,0,0,1,-1.493839488122,1,1.967405654688,-0.9679998560349,0.001042453508653,0,0,0,0,1,-1.984734070936,1,1.986640141262,-0.9989919551816,1,0,0,0,0},
},
{
.width = 850, //gauss Q30
.type = IIR_BIQUAD_LPF_GAUSS,
.stages = 3,
.coeffs = (float32_t[]){0.001818856593095,0,0,0,0,1,0,-1,1.993273752219,-0.9963622868138,1,0,0,0,0},
},
{
.width = 900,
.type = IIR_BIQUAD_LPF,
.stages = 15,
.coeffs = (float32_t[]){0.7205036158022,0,0,0,0,1,-1.98213695759,1,1.983180870771,-0.9964493603827,0.7420595221218,0,0,0,0,1,-1.980193014772,1,1.980891328841,-0.9928843261151,0.6048815023758,0,0,0,0,1,-1.975668286282,1,1.977715822298,-0.9875316731982,0.403436903774,0,0,0,0,1,-1.963817923963,1,1.973461862386,-0.9801517410209,0.1863511072234,0,0,0,0,1,-1.920017264481,1,1.968777611568,-0.9719437254133,0.0449916587093,0,0,0,0,1,-1.440984462172,1,1.965480109483,-0.9661457997193,0.001042514696144,0,0,0,0,1,-1.982888899384,1,1.985087383472,-0.9989329565383,1,0,0,0,0},
},
{
.width = 900, //gauss Q30
.type = IIR_BIQUAD_LPF_GAUSS,
.stages = 3,
.coeffs = (float32_t[]){0.001925642196633,0,0,0,0,1,0,-1,1.992686615605,-0.9961487156067,1,0,0,0,0},
},
{
.width = 950,
.type = IIR_BIQUAD_LPF,
.stages = 15,
.coeffs = (float32_t[]){0.7205271171187,0,0,0,0,1,-1.980101948756,1,1.981472844121,-0.9962534000772,0.7420784388822,0,0,0,0,1,-1.977937773369,1,1.979133210681,-0.9924920821014,0.6049227752688,0,0,0,0,1,-1.972901362771,1,1.975912686735,-0.9868455102693,0.403554390574,0,0,0,0,1,-1.959717069935,1,1.971611595912,-0.979061870235,0.1866150166993,0,0,0,0,1,-1.911063456245,1,1.966881392071,-0.9704069278933,0.04566763563196,0,0,0,0,1,-1.386793204296,1,1.96355343059,-0.96429462441,0.001042581133273,0,0,0,0,1,-1.980939143872,1,1.983449792026,-0.9988740070091,1,0,0,0,0},
},
{
.width = 950, //gauss Q30
.type = IIR_BIQUAD_LPF_GAUSS,
.stages = 3,
.coeffs = (float32_t[]){0.00203240496616,0,0,0,0,1,0,-1,1.992078266787,-0.9959351900677,1,0,0,0,0},
},
{
.width = 1000,
.type = IIR_BIQUAD_LPF,
.stages = 15,
.coeffs = (float32_t[]){0.7205557370232,0,0,0,0,1,-1.977958025827,1,1.979683885735,-0.9960576285415,0.7421063310346,0,0,0,0,1,-1.975562102286,1,1.977302332398,-0.9921002496442,0.6049776211049,0,0,0,0,1,-1.969987460285,1,1.974050617525,-0.9861601397558,0.4036901856686,0,0,0,0,1,-1.955401381923,1,1.96972217371,-0.9779734043745,0.1869007482833,0,0,0,0,1,-1.90166473813,1,1.964968254472,-0.9688723336301,0.04638149922917,0,0,0,0,1,-1.331460730689,1,1.961625582906,-0.9624462896615,0.001042652816742,0,0,0,0,1,-1.978884946296,1,1.981727444308,-0.998815109108,1,0,0,0,0},
},
{
.width = 1000, //gauss Q30
.type = IIR_BIQUAD_LPF_GAUSS,
.stages = 3,
.coeffs = (float32_t[]){0.002139144909634,0,0,0,0,1,0,-1,1.991448716805,-0.9957217101807,1,0,0,0,0},
},
{
.width = 1400,
.type = IIR_BIQUAD_LPF,
.stages = 15,
.coeffs = (float32_t[]){0.008337759067718, 0, 0, 0, 0, 1, 2, 1, 1.962488019523, -0.9958390557937, 0.007506676076303, 0, 0, 0, 0, 1, 2, 1, 1.957738871263, -0.9877655755683, 0.006043957858058, 0, 0, 0, 0, 1, 2, 1, 1.956161255776, -0.9803370872084, 0.004235277493261, 0, 0, 0, 0, 1, 2, 1, 1.956962928023, -0.9739040379958, 0.002433354390642, 0, 0, 0, 0, 1, 2, 1, 1.959042241511, -0.9687756590733, 0.0009906129953076, 0, 0, 0, 0, 1, 2, 1, 1.961242450501, -0.9652049024823, 0.00019040061388, 0, 0, 0, 0, 1, 2, 1, 1.962610750926, -0.9633723533813, 0.8912509381337, 0, 0, 0, 0},
},
{
.width = 1600,
.type = IIR_BIQUAD_LPF,
.stages = 15,
.coeffs = (float32_t[]){0.01087767183753, 0, 0, 0, 0, 1, 2, 1, 1.951743475923, -0.9952541632731, 0.009790251369373, 0, 0, 0, 0, 1, 2, 1, 1.946889322437, -0.9860503279146, 0.007881911933017, 0, 0, 0, 0, 1, 2, 1, 1.946054588275, -0.9775822360066, 0.005523739386766, 0, 0, 0, 0, 1, 2, 1, 1.948150114001, -0.9702450715483, 0.003174223932421, 0, 0, 0, 0, 1, 2, 1, 1.951694105105, -0.9643910008345, 0.001292461661961, 0, 0, 0, 0, 1, 2, 1, 1.955141533597, -0.9603113802446, 0.0002484458717897, 0, 0, 0, 0, 1, 2, 1, 1.957222530892, -0.9582163143789, 0.8912509381337, 0, 0, 0, 0},
},
{
.width = 1800,
.type = IIR_BIQUAD_LPF,
.stages = 15,
.coeffs = (float32_t[]){0.01374975760108, 0, 0, 0, 0, 1, 2, 1, 1.939673816033, -0.9946728464377, 0.01237165909396, 0, 0, 0, 0, 1, 2, 1, 1.934859504021, -0.9843461403965, 0.00995992424776, 0, 0, 0, 0, 1, 2, 1, 1.935004390016, -0.9748440870071, 0.006981215584571, 0, 0, 0, 0, 1, 2, 1, 1.938680240252, -0.96660510259, 0.004012807567963, 0, 0, 0, 0, 1, 2, 1, 1.943973272573, -0.960024502845, 0.001634314057146, 0, 0, 0, 0, 1, 2, 1, 1.948896382515, -0.9554336387438, 0.0003142054006989, 0, 0, 0, 0, 1, 2, 1, 1.951817350883, -0.9530741724857, 0.8912509381337, 0, 0, 0, 0},
},
{
.width = 2100,
.type = IIR_BIQUAD_LPF,
.stages = 15,
.coeffs = (float32_t[]){0.0186757712085, 0, 0, 0, 0, 1, 2, 1, 1.919105345061, -0.9938084298953, 0.01679782577699, 0, 0, 0, 0, 1, 2, 1, 1.914621379821, -0.9818126829289, 0.01352433909839, 0, 0, 0, 0, 1, 2, 1, 1.916673090488, -0.9707704468821, 0.009483344041549, 0, 0, 0, 0, 1, 2, 1, 1.923248669381, -0.9611820455475, 0.005453911681508, 0, 0, 0, 0, 1, 2, 1, 1.931692622294, -0.9535082690199, 0.002222306584324, 0, 0, 0, 0, 1, 2, 1, 1.939254929475, -0.948144155812, 0.0004273708029279, 0, 0, 0, 0, 1, 2, 1, 1.943673846642, -0.9453833298533, 0.8912509381337, 0, 0, 0, 0},
},
{
.width = 2300,
.type = IIR_BIQUAD_LPF,
.stages = 15,
.coeffs = (float32_t[]){0.02236805492097, 0, 0, 0, 0, 1, 2, 1, 1.903765535654, -0.9932377553382, 0.02011484257157, 0, 0, 0, 0, 1, 2, 1, 1.899680932944, -0.9801403032298, 0.01619704186404, 0, 0, 0, 0, 1, 2, 1, 1.903290409888, -0.9680785773444, 0.01136147999554, 0, 0, 0, 0, 1, 2, 1, 1.91214621026, -0.9575921302427, 0.006536937451987, 0, 0, 0, 0, 1, 2, 1, 1.92303837058, -0.9491861203884, 0.002664657794376, 0, 0, 0, 0, 1, 2, 1, 1.932642344124, -0.9433009753017, 0.0005125568415544, 0, 0, 0, 0, 1, 2, 1, 1.938218356086, -0.9402685834517, 0.8912509381337, 0, 0, 0, 0},
},
{
.width = 2500,
.type = IIR_BIQUAD_LPF,
.stages = 15,
.coeffs = (float32_t[]){0.02638375826711, 0, 0, 0, 0, 1, 2, 1, 1.887136976642, -0.9926720097103, 0.023722179526, 0, 0, 0, 0, 1, 2, 1, 1.883593567933, -0.9784822860373, 0.01910539136227, 0, 0, 0, 0, 1, 2, 1, 1.888985449532, -0.9654070149807, 0.0134072873595, 0, 0, 0, 0, 1, 2, 1, 1.900394125441, -0.9540232748791, 0.007718006483406, 0, 0, 0, 0, 1, 2, 1, 1.914009303952, -0.9448813298853, 0.003147525588083, 0, 0, 0, 0, 1, 2, 1, 1.925879604901, -0.9384697072535, 0.0006055973457388, 0, 0, 0, 0, 1, 2, 1, 1.932739506253, -0.9351618956361, 0.8912509381337, 0, 0, 0, 0},
},
{
.width = 2700,
.type = IIR_BIQUAD_LPF,
.stages = 15,
.coeffs = (float32_t[]){0.03071990044993, 0, 0, 0, 0, 1, 2, 1, 1.869231969467, -0.9921115712663, 0.02761740656234, 0, 0, 0, 0, 1, 2, 1, 1.866369928111, -0.9768395543603, 0.02224808606729, 0, 0, 0, 0, 1, 2, 1, 1.873764434848, -0.9627567791176, 0.01562051628912, 0, 0, 0, 0, 1, 2, 1, 1.887994019063, -0.9504760842192, 0.008997387142466, 0, 0, 0, 0, 1, 2, 1, 1.904604155312, -0.9405937038814, 0.003671160986692, 0, 0, 0, 0, 1, 2, 1, 1.918964639434, -0.9336492833803, 0.0007065561783843, 0, 0, 0, 0, 1, 2, 1, 1.927235402943, -0.9300616276564, 0.8912509381337, 0, 0, 0, 0},
},
{
.width = 2900,
.type = IIR_BIQUAD_LPF,
.stages = 15,
.coeffs = (float32_t[]){0.03537329213245, 0, 0, 0, 0, 1, 2, 1, 1.850063645572, -0.9915568141019, 0.03179797016664, 0, 0, 0, 0, 1, 2, 1, 1.848021141171, -0.9752130218375, 0.02562380547135, 0, 0, 0, 0, 1, 2, 1, 1.857633663767, -0.9601288856525, 0.01800097496312, 0, 0, 0, 0, 1, 2, 1, 1.874947272759, -0.9469511726113, 0.01037542521106, 0, 0, 0, 0, 1, 2, 1, 1.894821365712, -0.9363230665567, 0.004235862132326, 0, 0, 0, 0, 1, 2, 1, 1.911895202355, -0.9288386508847, 0.0008155080256104, 0, 0, 0, 0, 1, 2, 1, 1.92170411798, -0.9249661500829, 0.8912509381337, 0, 0, 0, 0},
},
{
.width = 3000,
.type = IIR_BIQUAD_LPF,
.stages = 15,
.coeffs = (float32_t[]){0.0378179035225, 0, 0, 0, 0, 1, 2, 1, 1.840010067621, -0.991281681711, 0.03399442178565, 0, 0, 0, 0, 1, 2, 1, 1.838428426034, -0.9744061131769, 0.02739863142844, 0, 0, 0, 0, 1, 2, 1, 1.849229108307, -0.9588236340205, 0.01925387115406, 0, 0, 0, 0, 1, 2, 1, 1.868181781801, -0.9451972664171, 0.01110157002227, 0, 0, 0, 0, 1, 2, 1, 1.889787788767, -0.9341940688557, 0.004533718545948, 0, 0, 0, 0, 1, 2, 1, 1.908301807349, -0.9264366815325, 0.0008730076728553, 0, 0, 0, 0, 1, 2, 1, 1.918927669868, -0.9224197005598, 0.8912509381337, 0, 0, 0, 0},
},
{
.width = 3200,
.type = IIR_BIQUAD_LPF,
.stages = 15,
.coeffs = (float32_t[]){0.04294074008438, 0, 0, 0, 0, 1, 2, 1, 1.818973177899, -0.9907361382365, 0.03859793564407, 0, 0, 0, 0, 1, 2, 1, 1.818413829065, -0.9728055716408, 0.03112136875327, 0, 0, 0, 0, 1, 2, 1, 1.831745678148, -0.9562311531615, 0.0218849394564, 0, 0, 0, 0, 1, 2, 1, 1.854167192034, -0.9417069498599, 0.01262841216123, 0, 0, 0, 0, 1, 2, 1, 1.879434978023, -0.9299486266681, 0.005160681770831, 0, 0, 0, 0, 1, 2, 1, 1.900996067857, -0.9216387949399, 0.0009941132114779, 0, 0, 0, 0, 1, 2, 1, 1.913351916063, -0.9173283689091, 0.8912509381337, 0, 0, 0, 0},
},
{
.width = 3400,
.type = IIR_BIQUAD_LPF,
.stages = 15,
.coeffs = (float32_t[]){0.04837195881699, 0, 0, 0, 0, 1, 2, 1, 1.796709356328, -0.9901971915964, 0.04347987080713, 0, 0, 0, 0, 1, 2, 1, 1.797303988281, -0.9712234715099, 0.03507374176562, 0, 0, 0, 0, 1, 2, 1, 1.813368576892, -0.9536635439548, 0.02468300567677, 0, 0, 0, 0, 1, 2, 1, 1.839508477053, -0.93824049976, 0.01425511571928, 0, 0, 0, 0, 1, 2, 1, 1.868699356243, -0.9257198191201, 0.005829666089407, 0, 0, 0, 0, 1, 2, 1, 1.893529468422, -0.9168481327797, 0.001123447109388, 0, 0, 0, 0, 1, 2, 1, 1.90774399342, -0.9122377818571, 0.8912509381337, 0, 0, 0, 0},
},
{
.width = 3600,
.type = IIR_BIQUAD_LPF,
.stages = 15,
.coeffs = (float32_t[]){0.05410766292916, 0, 0, 0, 0, 1, 2, 1, 1.773234547842, -0.9896651995582, 0.04863725173841, 0, 0, 0, 0, 1, 2, 1, 1.775111685656, -0.9696606926092, 0.03925435731034, 0, 0, 0, 0, 1, 2, 1, 1.794104386414, -0.9511218156552, 0.02764807346692, 0, 0, 0, 0, 1, 2, 1, 1.824206281656, -0.9347985755237, 0.01598229875604, 0, 0, 0, 0, 1, 2, 1, 1.857578346955, -0.9215075419793, 0.006541139568672, 0, 0, 0, 0, 1, 2, 1, 1.885899135105, -0.9120636933801, 0.00126112358591, 0, 0, 0, 0, 1, 2, 1, 1.902101832716, -0.9071463270599, 0.8912509381337, 0, 0, 0, 0},
},
{
.width = 3800,
.type = IIR_BIQUAD_LPF,
.stages = 15,
.coeffs = (float32_t[]){0.06014376034101, 0, 0, 0, 0, 1, 2, 1, 1.748565473372, -0.9891405147361, 0.05406698488614, 0, 0, 0, 0, 1, 2, 1, 1.75185016527, -0.9681181048143, 0.04366179904764, 0, 0, 0, 0, 1, 2, 1, 1.773959780893, -0.9486069770836, 0.03078019985087, 0, 0, 0, 0, 1, 2, 1, 1.808261053311, -0.9313818527144, 0.01781065782937, 0, 0, 0, 0, 1, 2, 1, 1.846069082969, -0.9173117142862, 0.007295620714451, 0, 0, 0, 0, 1, 2, 1, 1.878102006143, -0.9072844890005, 0.001407268766049, 0, 0, 0, 0, 1, 2, 1, 1.896423317628, -0.9020523926923, 0.8912509381337, 0, 0, 0, 0},
},
{
.width = 4000,
.type = IIR_BIQUAD_LPF,
.stages = 15,
.coeffs = (float32_t[]){0.0664759669061, 0, 0, 0, 0, 1, 2, 1, 1.722719616758, -0.9886234843822, 0.05976585969453, 0, 0, 0, 0, 1, 2, 1, 1.727533129144, -0.9665965679221, 0.04829462608705, 0, 0, 0, 0, 1, 2, 1, 1.752941532896, -0.9461200372446, 0.03407949397928, 0, 0, 0, 0, 1, 2, 1, 1.791673048598, -0.9279910245151, 0.0197409684492, 0, 0, 0, 0, 1, 2, 1, 1.834168405903, -0.9131322796994, 0.00809367952317, 0, 0, 0, 0, 1, 2, 1, 1.870134827536, -0.9025095456287, 0.001562021017125, 0, 0, 0, 0, 1, 2, 1, 1.890706281461, -0.8969543655294, 0.8912509381337, 0, 0, 0, 0},
},
{
.width = 4500,
.type = IIR_BIQUAD_LPF,
.stages = 15,
.coeffs = (float32_t[]){0.08357215221717, 0, 0, 0, 0, 1, 2, 1, 1.653078015998, -0.987366624867, 0.07516842731719, 0, 0, 0, 0, 1, 2, 1, 1.662216664048, -0.9628903733163, 0.06085305871942, 0, 0, 0, 0, 1, 2, 1, 1.696619139932, -0.9400313748092, 0.043060258968, 0, 0, 0, 0, 1, 2, 1, 1.747390932282, -0.9196319681538, 0.02501859112256, 0, 0, 0, 0, 1, 2, 1, 1.802680917653, -0.9027552821436, 0.01028369816962, 0, 0, 0, 0, 1, 2, 1, 1.849449766852, -0.8905845595302, 0.001987580597066, 0, 0, 0, 0, 1, 2, 1, 1.876230447368, -0.8841807697568, 0.8912509381337, 0, 0, 0, 0},
},
{
.width = 5000,
.type = IIR_BIQUAD_LPF,
.stages = 15,
.coeffs = (float32_t[]){0.1024156725791, 0, 0, 0, 0, 1, 2, 1, 1.576502212425, -0.9861649027415, 0.09217691252119, 0, 0, 0, 0, 1, 2, 1, 1.590626367525, -0.9593340176097, 0.07478718663087, 0, 0, 0, 0, 1, 2, 1, 1.63499047411, -0.9341392206335, 0.0530907744763, 0, 0, 0, 0, 1, 2, 1, 1.699087884799, -0.9114509827042, 0.03095453675841, 0, 0, 0, 0, 1, 2, 1, 1.768662790286, -0.8924809373192, 0.01276135116726, 0, 0, 0, 0, 1, 2, 1, 1.827620197021, -0.8786656016897, 0.002470638805861, 0, 0, 0, 0, 1, 2, 1, 1.861463480239, -0.8713460354626, 0.8912509381337, 0, 0, 0, 0},
},
{
.width = 6000,
.type = IIR_BIQUAD_LPF,
.stages = 15,
.coeffs = (float32_t[]){0.1450110967848, 0, 0, 0, 0, 1, 2, 1, 1.403901955866, -0.9839463430048, 0.1307691226309, 0, 0, 0, 0, 1, 2, 1, 1.429644184424, -0.9527206749475, 0.1066810357534, 0, 0, 0, 0, 1, 2, 1, 1.496284169193, -0.9230083122063, 0.07632499046678, 0, 0, 0, 0, 1, 2, 1, 1.590375038731, -0.8956750005979, 0.04487973895608, 0, 0, 0, 0, 1, 2, 1, 1.692728831788, -0.8722477876128, 0.01863599384496, 0, 0, 0, 0, 1, 2, 1, 1.780245937312, -0.8547899126915, 0.003623004541629, 0, 0, 0, 0, 1, 2, 1, 1.830897212635, -0.8453892308013, 0.8912509381337, 0, 0, 0, 0},
},
{
.width = 7000,
.type = IIR_BIQUAD_LPF,
.stages = 15,
.coeffs = (float32_t[]){0.1935320872064, 0, 0, 0, 0, 1, 2, 1, 1.207875690811, -0.9820040396369, 0.1750141161592, 0, 0, 0, 0, 1, 2, 1, 1.246795349816, -0.9468518144529, 0.1437565297358, 0, 0, 0, 0, 1, 2, 1, 1.337830681316, -0.9128568002589, 0.1038445422874, 0, 0, 0, 0, 1, 2, 1, 1.465400321994, -0.8807784911441, 0.06170673134055, 0, 0, 0, 0, 1, 2, 1, 1.605636412052, -0.8524633374146, 0.02585632577245, 0, 0, 0, 0, 1, 2, 1, 1.727351325001, -0.8307766280909, 0.005053269625901, 0, 0, 0, 0, 1, 2, 1, 1.798655982283, -0.8188690607867, 0.8912509381337, 0, 0, 0, 0},
},
{
.width = 8000,
.type = IIR_BIQUAD_LPF,
.stages = 15,
.coeffs = (float32_t[]){0.2471567962157, 0, 0, 0, 0, 1, 2, 1, 0.9917423657721, -0.9803695506349, 0.224315091642, 0, 0, 0, 0, 1, 2, 1, 1.044554840447, -0.9418152070148, 0.1857606943562, 0, 0, 0, 0, 1, 2, 1, 1.160774872447, -0.9038176498723, 0.1357293808017, 0, 0, 0, 0, 1, 2, 1, 1.323981745373, -0.8668992685794, 0.0816816657689, 0, 0, 0, 0, 1, 2, 1, 1.506461203918, -0.8331878669936, 0.0346084620725, 0, 0, 0, 0, 1, 2, 1, 1.668097114322, -0.8065309626121, 0.006808262659746, 0, 0, 0, 0, 1, 2, 1, 1.764321649588, -0.7915547002269, 0.8912509381337, 0, 0, 0, 0},
},
{
.width = 9000,
.type = IIR_BIQUAD_LPF,
.stages = 15,
.coeffs = (float32_t[]){0.3049851455408, 0, 0, 0, 0, 1, 2, 1, 0.7591287465444, -0.9790693287075, 0.2780078711753, 0, 0, 0, 0, 1, 2, 1, 0.8256589275237, -0.9376904122248, 0.2323960275367, 0, 0, 0, 0, 1, 2, 1, 0.9664437350711, -0.8960278452179, 0.1720665990118, 0, 0, 0, 0, 1, 2, 1, 1.165936151782, -0.8542025478295, 0.1051104068231, 0, 0, 0, 0, 1, 2, 1, 1.394079028152, -0.8145206554444, 0.04513708899945, 0, 0, 0, 0, 1, 2, 1, 1.601425033622, -0.78197338962, 0.008951452064989, 0, 0, 0, 0, 1, 2, 1, 1.727386349532, -0.7631921577923, 0.8912509381337, 0, 0, 0, 0},
},
{
.width = 10000,
.type = IIR_BIQUAD_LPF,
.stages = 15,
.coeffs = (float32_t[]){0.3660530366546, 0, 0, 0, 0, 1, 2, 1, 0.5139122219498, -0.9781243685681, 0.3353618895079, 0, 0, 0, 0, 1, 2, 1, 0.5931003386238, -0.9345478966556, 0.2833072224337, 0, 0, 0, 0, 1, 2, 1, 0.7563993155832, -0.889628205318, 0.2129361875021, 0, 0, 0, 0, 1, 2, 1, 0.9911412275405, -0.8428859775489, 0.1323619182589, 0, 0, 0, 0, 1, 2, 1, 1.267164478707, -0.7966121517422, 0.0577608794396, 0, 0, 0, 0, 1, 2, 1, 1.526003705736, -0.7570472234945, 0.01156881757925, 0, 0, 0, 0, 1, 2, 1, 1.687220763409, -0.7334960337262, 0.8912509381337, 0, 0, 0, 0},
},
{
.width = 15000,
.type = IIR_BIQUAD_LPF,
.stages = 15,
.coeffs = (float32_t[]){0.6836575636023, 0, 0, 0, 0, 1, 2, 1, -0.7555775647369, -0.9790526896722, 0.647099990577, 0, 0, 0, 0, 1, 2, 1, -0.6531521361674, -0.9352478261406, 0.5835442055703, 0, 0, 0, 0, 1, 2, 1, -0.4507362158414, -0.8834406064397, 0.4845398400426, 0, 0, 0, 0, 1, 2, 1, -0.1214617070015, -0.816697653169, 0.343041904988, 0, 0, 0, 0, 1, 2, 1, 0.3575721235141, -0.729739743466, 0.1720099445637, 0, 0, 0, 0, 1, 2, 1, 0.9410108109328, -0.6290505891876, 0.03796886246342, 0, 0, 0, 0, 1, 2, 1, 1.399673185533, -0.5515486353869, 0.8912509381337, 0, 0, 0, 0},
},
{
.width = 20000,
.type = IIR_BIQUAD_LPF,
.stages = 15,
.coeffs = (float32_t[]){0.9275653605469, 0, 0, 0, 0, 1, 2, 1, -1.721658533587, -0.9886029086012, 0.9093240243363, 0, 0, 0, 0, 1, 2, 1, -1.673785057778, -0.9635110395671, 0.8781513561579, 0, 0, 0, 0, 1, 2, 1, -1.582945488801, -0.9296599358312, 0.8220243799729, 0, 0, 0, 0, 1, 2, 1, -1.41280229903, -0.8752952208621, 0.712966251766, 0, 0, 0, 0, 1, 2, 1, -1.07711451342, -0.7747504936445, 0.4918611014088, 0, 0, 0, 0, 1, 2, 1, -0.3928110912436, -0.5746333143917, 0.1540100983629, 0, 0, 0, 0, 1, 2, 1, 0.6545074245328, -0.2705478179843, 0.8912509381337, 0, 0, 0, 0},
},
};
//Public variables
const uint32_t AUTIO_FILTERS_HPF_CW_LIST[CW_HPF_COUNT] = {0, 60, 100};
const uint32_t AUTIO_FILTERS_HPF_SSB_LIST[SSB_HPF_COUNT] = {0, 60, 100, 200, 300, 400, 500};
const uint32_t AUTIO_FILTERS_LPF_CW_LIST[CW_LPF_COUNT] = {100, 150, 200, 250, 300, 350, 400, 450, 500, 550, 600, 650, 700, 750, 800, 850, 900, 950, 1000};
const uint32_t AUTIO_FILTERS_LPF_SSB_LIST[SSB_LPF_COUNT] = {1400, 1600, 1800, 2100, 2300, 2500, 2700, 2900, 3000, 3200, 3400};
const uint32_t AUTIO_FILTERS_LPF_AM_LIST[AM_LPF_COUNT] = {2100, 2300, 2500, 2700, 2900, 3000, 3200, 3400, 3600, 3800, 4000, 4500, 5000, 6000, 7000, 8000, 9000, 10000};
const uint32_t AUTIO_FILTERS_LPF_NFM_LIST[NFM_LPF_COUNT] = {5000, 6000, 7000, 8000, 9000, 10000, 15000, 20000};
arm_fir_instance_f32 FIR_RX_Hilbert_I; // filter instances
arm_fir_instance_f32 FIR_RX_Hilbert_Q;
arm_fir_instance_f32 FIR_TX_Hilbert_I;
arm_fir_instance_f32 FIR_TX_Hilbert_Q;
arm_biquad_cascade_df2T_instance_f32 IIR_RX_LPF_I;
arm_biquad_cascade_df2T_instance_f32 IIR_RX_LPF_Q;
arm_biquad_cascade_df2T_instance_f32 IIR_RX_GAUSS;
arm_biquad_cascade_df2T_instance_f32 IIR_TX_LPF_I;
arm_biquad_cascade_df2T_instance_f32 IIR_RX_HPF_I;
arm_biquad_cascade_df2T_instance_f32 IIR_TX_HPF_I;
arm_biquad_cascade_df2T_instance_f32 IIR_RX_Squelch_HPF;
arm_biquad_cascade_df2T_instance_f32 EQ_RX_LOW_FILTER = {EQ_STAGES, EQ_RX_LOW_FILTER_State, EQ_RX_LOW_FILTER_Coeffs};
arm_biquad_cascade_df2T_instance_f32 EQ_RX_MID_FILTER = {EQ_STAGES, EQ_RX_MID_FILTER_State, EQ_RX_MID_FILTER_Coeffs};
arm_biquad_cascade_df2T_instance_f32 EQ_RX_HIG_FILTER = {EQ_STAGES, EQ_RX_HIG_FILTER_State, EQ_RX_HIG_FILTER_Coeffs};
arm_biquad_cascade_df2T_instance_f32 EQ_MIC_LOW_FILTER = {EQ_STAGES, EQ_MIC_LOW_FILTER_State, EQ_MIC_LOW_FILTER_Coeffs};
arm_biquad_cascade_df2T_instance_f32 EQ_MIC_MID_FILTER = {EQ_STAGES, EQ_MIC_MID_FILTER_State, EQ_MIC_MID_FILTER_Coeffs};
arm_biquad_cascade_df2T_instance_f32 EQ_MIC_HIG_FILTER = {EQ_STAGES, EQ_MIC_HIG_FILTER_State, EQ_MIC_HIG_FILTER_Coeffs};
arm_biquad_cascade_df2T_instance_f32 AGC_RX_KW_HSHELF_FILTER = {EQ_STAGES, AGC_RX_KW_HSHELF_FILTER_State, AGC_RX_KW_HSHELF_FILTER_Coeffs};
arm_biquad_cascade_df2T_instance_f32 AGC_RX_KW_HPASS_FILTER = {EQ_STAGES, AGC_RX_KW_HPASS_FILTER_State, AGC_RX_KW_HPASS_FILTER_Coeffs};
volatile bool NeedReinitNotch = false; // need to re-initialize the manual Notch filter
volatile bool NeedReinitAudioFilters = false; // need to re-initialize Audio filters
volatile bool NeedReinitAudioFiltersClean = false; //also clean state
// Prototypes
static void calcBiquad(BIQUAD_TYPE type, uint32_t Fc, uint32_t Fs, float32_t Q, float32_t peakGain, float32_t *outCoeffs); // automatic calculation of the Biquad filter for Notch
static IIR_BIQUAD_FILTER *getIIRFilter(IIR_BIQUAD_FILTER_TYPE type, uint_fast16_t width); // get filter from collection
static void arm_biquad_cascade_df2T_initNoClean_f32(arm_biquad_cascade_df2T_instance_f32 * S, uint8_t numStages, const float32_t * pCoeffs, float32_t * pState); //init without state-clean version
// initialize audio filters
void InitAudioFilters(void)
{
arm_fir_init_f32(&FIR_RX_Hilbert_I, IQ_HILBERT_TAPS_RX, (float32_t *)&FIR_HILB_I_coeffs_rx, (float32_t *)&Fir_RX_Hilbert_State_I[0], AUDIO_BUFFER_HALF_SIZE);
arm_fir_init_f32(&FIR_RX_Hilbert_Q, IQ_HILBERT_TAPS_RX, (float32_t *)&FIR_HILB_Q_coeffs_rx, (float32_t *)&Fir_RX_Hilbert_State_Q[0], AUDIO_BUFFER_HALF_SIZE);
arm_fir_init_f32(&FIR_TX_Hilbert_I, IQ_HILBERT_TAPS_TX, (float32_t *)&FIR_HILB_I_coeffs_tx, (float32_t *)&Fir_Tx_Hilbert_State_I[0], AUDIO_BUFFER_HALF_SIZE);
arm_fir_init_f32(&FIR_TX_Hilbert_Q, IQ_HILBERT_TAPS_TX, (float32_t *)&FIR_HILB_Q_coeffs_tx, (float32_t *)&Fir_Tx_Hilbert_State_Q[0], AUDIO_BUFFER_HALF_SIZE);
//AGC K-Weight LKFS BS.1770
calcBiquad(BIQUAD_highShelf, 1500, TRX_SAMPLERATE, 1.0f / sqrtf(2), 4.0f, AGC_RX_KW_HSHELF_FILTER_Coeffs);
calcBiquad(BIQUAD_highpass, 38, TRX_SAMPLERATE, 0.5f, 0.0f, AGC_RX_KW_HPASS_FILTER_Coeffs);
//Other
InitAutoNotchReduction();
ReinitAudioFilters();
}
// reinitialize audio filters
void ReinitAudioFilters(void)
{
//LPF
uint32_t lpf1_width = 2700; //default settings
if (CurrentVFO()->RX_LPF_Filter_Width > 0)
lpf1_width = CurrentVFO()->RX_LPF_Filter_Width;
IIR_BIQUAD_FILTER *lpf_filter = getIIRFilter(IIR_BIQUAD_LPF, lpf1_width);
arm_biquad_cascade_df2T_initNoClean_f32(&IIR_RX_LPF_I, lpf_filter->stages, (float32_t *)lpf_filter->coeffs, (float32_t *)&IIR_RX_LPF_I_State[0]);
arm_biquad_cascade_df2T_initNoClean_f32(&IIR_RX_LPF_Q, lpf_filter->stages, (float32_t *)lpf_filter->coeffs, (float32_t *)&IIR_RX_LPF_Q_State[0]);
if (CurrentVFO()->TX_LPF_Filter_Width > 0)
lpf1_width = CurrentVFO()->TX_LPF_Filter_Width;
lpf_filter = getIIRFilter(IIR_BIQUAD_LPF, lpf1_width);
arm_biquad_cascade_df2T_initNoClean_f32(&IIR_TX_LPF_I, lpf_filter->stages, (float32_t *)lpf_filter->coeffs, (float32_t *)&IIR_TX_LPF_I_State[0]);
//RX GAUSS
IIR_BIQUAD_FILTER *gauss_filter = getIIRFilter(IIR_BIQUAD_LPF_GAUSS, 1000);
if (CurrentVFO()->Mode == TRX_MODE_CW_L || CurrentVFO()->Mode == TRX_MODE_CW_U)
gauss_filter = getIIRFilter(IIR_BIQUAD_LPF_GAUSS, lpf1_width);
arm_biquad_cascade_df2T_initNoClean_f32(&IIR_RX_GAUSS, gauss_filter->stages, (float32_t *)gauss_filter->coeffs, (float32_t *)&IIR_RX_GAUSS_State[0]);
//HPF
uint32_t hpf1_width = 300; //default settings
if (CurrentVFO()->HPF_Filter_Width > 0)
hpf1_width = CurrentVFO()->HPF_Filter_Width;
IIR_BIQUAD_FILTER *hpf_filter = getIIRFilter(IIR_BIQUAD_HPF, hpf1_width);
arm_biquad_cascade_df2T_initNoClean_f32(&IIR_RX_HPF_I, hpf_filter->stages, (float32_t *)hpf_filter->coeffs, (float32_t *)&IIR_RX_HPF_I_State[0]);
arm_biquad_cascade_df2T_initNoClean_f32(&IIR_TX_HPF_I, hpf_filter->stages, (float32_t *)hpf_filter->coeffs, (float32_t *)&IIR_TX_HPF_I_State[0]);
//FM Squelch
IIR_BIQUAD_FILTER *fm_sql_hpf_filter;
if (CurrentVFO()->RX_LPF_Filter_Width > 15000 || CurrentVFO()->RX_LPF_Filter_Width == 0)
fm_sql_hpf_filter = getIIRFilter(IIR_BIQUAD_HPF, 20000);
else
fm_sql_hpf_filter = getIIRFilter(IIR_BIQUAD_HPF, 15000);
arm_biquad_cascade_df2T_initNoClean_f32(&IIR_RX_Squelch_HPF, fm_sql_hpf_filter->stages, (float32_t *)fm_sql_hpf_filter->coeffs, (float32_t *)&IIR_RX_HPF_SQL_State[0]);
//RX Equalizer
calcBiquad(BIQUAD_peak, 400, TRX_SAMPLERATE, 0.5f, TRX.RX_EQ_LOW, EQ_RX_LOW_FILTER_Coeffs);
calcBiquad(BIQUAD_peak, 1000, TRX_SAMPLERATE, 1.0f, TRX.RX_EQ_MID, EQ_RX_MID_FILTER_Coeffs);
calcBiquad(BIQUAD_peak, 2000, TRX_SAMPLERATE, 1.5f, TRX.RX_EQ_HIG, EQ_RX_HIG_FILTER_Coeffs);
//MIC Equalizer
calcBiquad(BIQUAD_peak, 400, TRX_SAMPLERATE, 0.5f, TRX.MIC_EQ_LOW, EQ_MIC_LOW_FILTER_Coeffs);
calcBiquad(BIQUAD_peak, 1000, TRX_SAMPLERATE, 1.0f, TRX.MIC_EQ_MID, EQ_MIC_MID_FILTER_Coeffs);
calcBiquad(BIQUAD_peak, 2000, TRX_SAMPLERATE, 1.5f, TRX.MIC_EQ_HIG, EQ_MIC_HIG_FILTER_Coeffs);
//All done
NeedReinitAudioFilters = false;
NeedReinitAudioFiltersClean = false;
}
// start DC corrector
void dc_filter(float32_t *Buffer, int16_t blockSize, DC_FILTER_STATE stateNum) // removes the constant component of the signal
{
static const float32_t A1 = (1.0f - 0.00048828125f); // (1-2^(-11))
for (uint16_t i = 0; i < blockSize; i++)
{
float32_t sampleIn = Buffer[i];
float32_t sampleOut = 0;
float32_t delta_x = sampleIn - DC_Filter_State[stateNum].x_prev;
float32_t a1_y_prev = A1 * DC_Filter_State[stateNum].y_prev;
sampleOut = delta_x + a1_y_prev;
DC_Filter_State[stateNum].x_prev = sampleIn;
DC_Filter_State[stateNum].y_prev = sampleOut;
Buffer[i] = sampleOut;
}
}
// get filter from collection
static IIR_BIQUAD_FILTER *getIIRFilter(IIR_BIQUAD_FILTER_TYPE type, uint_fast16_t width)
{
for (uint16_t i = 0; i < IIR_FILTERS_COUNT; i++)
if (IIR_Biquad_Filters[i].type == type && IIR_Biquad_Filters[i].width == width)
return (IIR_BIQUAD_FILTER *)&IIR_Biquad_Filters[i];
sendToDebug_strln("Wrong filter length");
sendToDebug_uint16(type, false);
sendToDebug_uint16((uint16_t)width, false);
return (IIR_BIQUAD_FILTER *)&IIR_Biquad_Filters[0];
}
// automatic calculation of the Biquad filter
static void calcBiquad(BIQUAD_TYPE type, uint32_t Fc, uint32_t Fs, float32_t Q, float32_t peakGain, float32_t *outCoeffs)
{
float32_t a0, a1, a2, b1, b2, norm;
float32_t V = powf(10.0f, fabsf(peakGain) / 20.0f);
float32_t K = tanf(PI * Fc / Fs);
switch (type)
{
case BIQUAD_onepolelp:
b1 = expf(-2.0f * PI * (Fc / Fs));
a0 = 1.0f - b1;
b1 = -b1;
a1 = a2 = b2 = 0.0f;
break;
case BIQUAD_onepolehp:
b1 = -expf(-2.0f * PI * (0.5f - Fc / Fs));
a0 = 1.0f + b1;
b1 = -b1;
a1 = a2 = b2 = 0.0f;
break;
case BIQUAD_lowpass:
norm = 1.0f / (1.0f + K / Q + K * K);
a0 = K * K * norm;
a1 = 2.0f * a0;
a2 = a0;
b1 = 2.0f * (K * K - 1.0f) * norm;
b2 = (1.0f - K / Q + K * K) * norm;
break;
case BIQUAD_highpass:
norm = 1.0f / (1.0f + K / Q + K * K);
a0 = 1.0f * norm;
a1 = -2.0f * a0;
a2 = a0;
b1 = 2.0f * (K * K - 1.0f) * norm;
b2 = (1.0f - K / Q + K * K) * norm;
break;
case BIQUAD_bandpass:
norm = 1.0f / (1.0f + K / Q + K * K);
a0 = K / Q * norm;
a1 = 0.0f;
a2 = -a0;
b1 = 2.0f * (K * K - 1.0f) * norm;
b2 = (1.0f - K / Q + K * K) * norm;
break;
case BIQUAD_notch:
norm = 1.0f / (1.0f + K / Q + K * K);
a0 = (1.0f + K * K) * norm;
a1 = 2.0f * (K * K - 1.0f) * norm;
a2 = a0;
b1 = a1;
b2 = (1.0f - K / Q + K * K) * norm;
break;
case BIQUAD_peak:
if (peakGain >= 0.0f)
{
norm = 1.0f / (1.0f + 1.0f / Q * K + K * K);
a0 = (1.0f + V / Q * K + K * K) * norm;
a1 = 2.0f * (K * K - 1.0f) * norm;
a2 = (1.0f - V / Q * K + K * K) * norm;
b1 = a1;
b2 = (1.0f - 1.0f / Q * K + K * K) * norm;
}
else
{
norm = 1.0f / (1.0f + V / Q * K + K * K);
a0 = (1.0f + 1.0f / Q * K + K * K) * norm;
a1 = 2.0f * (K * K - 1.0f) * norm;
a2 = (1.0f - 1.0f / Q * K + K * K) * norm;
b1 = a1;
b2 = (1.0f - V / Q * K + K * K) * norm;
}
break;
case BIQUAD_lowShelf:
if (peakGain >= 0.0f)
{
norm = 1.0f / (1.0f + SQRT2 * K + K * K);
a0 = (1.0f + sqrtf(2.0f * V) * K + V * K * K) * norm;
a1 = 2.0f * (V * K * K - 1.0f) * norm;
a2 = (1.0f - sqrtf(2.0f * V) * K + V * K * K) * norm;
b1 = 2.0f * (K * K - 1.0f) * norm;
b2 = (1.0f - SQRT2 * K + K * K) * norm;
}
else
{
norm = 1.0f / (1.0f + sqrtf(2.0f * V) * K + V * K * K);
a0 = (1.0f + SQRT2 * K + K * K) * norm;
a1 = 2.0f * (K * K - 1.0f) * norm;
a2 = (1.0f - SQRT2 * K + K * K) * norm;
b1 = 2.0f * (V * K * K - 1.0f) * norm;
b2 = (1.0f - sqrtf(2.0f * V) * K + V * K * K) * norm;
}
break;
case BIQUAD_highShelf:
if (peakGain >= 0.0f)
{
norm = 1.0f / (1.0f + SQRT2 * K + K * K);
a0 = (V + sqrtf(2.0f * V) * K + K * K) * norm;
a1 = 2.0f * (K * K - V) * norm;
a2 = (V - sqrtf(2.0f * V) * K + K * K) * norm;
b1 = 2.0f * (K * K - 1.0f) * norm;
b2 = (1.0f - SQRT2 * K + K * K) * norm;
}
else
{
norm = 1.0f / (V + sqrtf(2.0f * V) * K + K * K);
a0 = (1.0f + SQRT2 * K + K * K) * norm;
a1 = 2.0f * (K * K - 1.0f) * norm;
a2 = (1.0f - SQRT2 * K + K * K) * norm;
b1 = 2.0f * (K * K - V) * norm;
b2 = (V - sqrtf(2.0f * V) * K + K * K) * norm;
}
break;
}
//save coefficients
outCoeffs[0] = a0;
outCoeffs[1] = a1;
outCoeffs[2] = a2;
outCoeffs[3] = -b1;
outCoeffs[4] = -b2;
}
static void arm_biquad_cascade_df2T_initNoClean_f32(arm_biquad_cascade_df2T_instance_f32 * S, uint8_t numStages, const float32_t * pCoeffs, float32_t * pState)
{
if(NeedReinitAudioFiltersClean) //original func
{
arm_biquad_cascade_df2T_init_f32(S, numStages, pCoeffs, pState);
return;
}
/* Assign filter stages */
S->numStages = numStages;
/* Assign coefficient pointer */
S->pCoeffs = pCoeffs;
/* Assign state pointer */
S->pState = pState;
}