Skip to content

Commit

Permalink
change eq
Browse files Browse the repository at this point in the history
  • Loading branch information
sctanf committed Nov 8, 2023
1 parent c3295e8 commit 4edd884
Showing 1 changed file with 32 additions and 11 deletions.
43 changes: 32 additions & 11 deletions main.c
Original file line number Diff line number Diff line change
Expand Up @@ -28,6 +28,7 @@ biquad(eq_bq_4)
biquad(eq_bq_5)
biquad(eq_bq_6)
biquad(eq_bq_7)
biquad(eq_bq_8)

bufring_t bufring1 = {
.len = 0,
Expand All @@ -38,15 +39,31 @@ bufring_t bufring1 = {
#define EQ_ENABLE
#define BASS_ENABLE

#define EQ_BASS 1.0103039413192074,-1.9969618889340095,0.9867280269044961,-1.9969618889340095,0.9970319682237037

#define EQ_I_0 0.9965576386879125,-1.9839585467318037,0.9879395722471472,-1.9839585467318037,0.9844972109350598
#define EQ_I_1 0.9963746376001873,-1.9658037098953092,0.971220306025217,-1.9658037098953092,0.9675949436254043
#define EQ_I_2 0.8268183972914943,-1.3305651464497943,0.642976882517346,-1.3305651464497943,0.4697952798088404
#define EQ_I_3 0.9140112066297957,-0.7905987559304656,0.4423009998729839,-0.7905987559304656,0.3563122065027796
#define EQ_I_4 0.7402985840212692,0.4319053043751767,0.4494992580405334,0.4319053043751767,0.1897978420618026
#define EQ_I_5 0.9025172943482934,1.2860580329781677,0.6818806031296316,1.2860580329781677,0.5843978974779251
#define EQ_I_6 0.8753858330544143,-1.4142987088868204,0.6249711130929093,-1.4142987088868204,0.5003569461473237 // 2600hz -6db 1q
#define USE_EQ 3

#define EQ_BASS 1.0103039413192074,-1.9969618889340095,0.9867280269044961,-1.9969618889340095,0.9970319682237037 // PK Fc 64 Hz Gain 18 dB Q 1

#if (USE_EQ == 1) // Dawn_2
#define EQ_I_0 0.9965576386879125,-1.9839585467318037,0.9879395722471472,-1.9839585467318037,0.9844972109350598 // PK Fc 178 Hz Gain -5.1 dB Q 2
#define EQ_I_1 0.9963746376001873,-1.9658037098953092,0.971220306025217,-1.9658037098953092,0.9675949436254043 // PK Fc 326 Hz Gain -2.2 dB Q 1.47
#define EQ_I_2 0.8268183972914943,-1.3305651464497943,0.642976882517346,-1.3305651464497943,0.4697952798088404 // PK Fc 3352 Hz Gain -9.2 dB Q 1
#define EQ_I_3 0.9140112066297957,-0.7905987559304656,0.4423009998729839,-0.7905987559304656,0.3563122065027796 // PK Fc 7246 Hz Gain -2.7 dB Q 1
#define EQ_I_4 0.7402985840212692,0.4319053043751767,0.4494992580405334,0.4319053043751767,0.1897978420618026 // PK Fc 14838 Hz Gain -8.9 dB Q 1.142
#define EQ_I_5 0.9025172943482934,1.2860580329781677,0.6818806031296316,1.2860580329781677,0.5843978974779251 // PK Fc 19235 Hz Gain -5.5 dB Q 1.528
//#define EQ_I_6 0.8753858330544143,-1.4142987088868204,0.6249711130929093,-1.4142987088868204,0.5003569461473237 // PK Fc 2600 Hz Gain -6 dB Q 1
#elif (USE_EQ == 2) // Dawn_EQ35
#define EQ_I_0 0.9919132550794737,-1.963896472164113,0.9726767797772573,-1.963896472164113,0.9645900348567311 // PK Fc 203 Hz Gain -5.3 dB Q 1
#define EQ_I_1 0.9024536817593295,-1.5522012531794867,0.7709127999701245,-1.5522012531794867,0.673366481729454 // PK Fc 2925 Hz Gain -7.9 dB Q 1.508
#define EQ_I_2 0.8730691349873055,-1.171940774852281,0.6293785491500764,-1.171940774852281,0.5024476841373821 // PK Fc 5165 Hz Gain -6.2 dB Q 1.35
#define EQ_I_3 0.7043621327728964,0.3722244789612045,0.4013317214907637,0.3722244789612045,0.1056938542636602 // PK Fc 14623 Hz Gain -9.4 dB Q 1
#define EQ_I_4 0.913545712658519,1.3095800172930876,0.697104518707821,1.3095800172930876,0.6106502313663402 // PK Fc 19253 Hz Gain -5.1 dB Q 1.615
#elif (USE_EQ == 3) // 9038S_EQ6
#define EQ_I_0 0.9960573775741578,-1.971504039419141,0.9761636483403762,-1.971504039419141,0.9722210259145339 // PK Fc 206 Hz Gain -2.9 dB Q 1.131
#define EQ_I_1 0.9053027497803863,-1.5715511784650351,0.7912594893853321,-1.5715511784650351,0.6965622391657185 // PK Fc 2951 Hz Gain -8.5 dB Q 1.718
#define EQ_I_2 0.8890348686131229,-1.1958731759385073,0.666048165071862,-1.1958731759385073,0.5550830336849849 // PK Fc 5298 Hz Gain -6 dB Q 1.578
#define EQ_I_3 0.7801809639766932,0.3703576085839218,0.5249782367336662,0.3703576085839218,0.3051592007103593 // PK Fc 14198 Hz Gain -8.7 dB Q 1.486
#define EQ_I_4 0.9376486097718588,1.3951586019224378,0.7893292315832322,1.3951586019224378,0.7269778413550909 // PK Fc 19185 Hz Gain -5.3 dB Q 2.529
#endif

#ifndef EQ_I_0
#define EQ_I_0 1.0,0.0,0.0,0.0,0.0
Expand Down Expand Up @@ -76,6 +93,10 @@ bufring_t bufring1 = {
#define EQ_I_6 1.0,0.0,0.0,0.0,0.0
#endif

#ifndef EQ_I_7
#define EQ_I_7 1.0,0.0,0.0,0.0,0.0
#endif

int32_t actual_vol = 0;
#define VOL_STEP 600000

Expand Down Expand Up @@ -341,8 +362,8 @@ static void __not_in_flash_func(_as_audio_packet)(struct usb_endpoint *ep) { //
process_biquad(&eq_bq_3, biquadconstsfx(EQ_I_2), count, buf0, buf1);
process_biquad(&eq_bq_4, biquadconstsfx(EQ_I_3), count, buf1, buf0);
process_biquad(&eq_bq_5, biquadconstsfx(EQ_I_4), count, buf0, buf1);
process_biquad(&eq_bq_6, biquadconstsfx(EQ_I_5), count, buf1, buf0);
process_biquad(&eq_bq_7, biquadconstsfx(EQ_I_6), count, buf0, buf1);
// process_biquad(&eq_bq_6, biquadconstsfx(EQ_I_5), count, buf1, buf0);
// process_biquad(&eq_bq_7, biquadconstsfx(EQ_I_6), count, buf0, buf1);
// process_biquad(&eq_bq_8, biquadconstsfx(EQ_I_7), count, buf1, buf0);
#endif
for (int i = 0; i < count * 2; i += 2) { // 25 us
Expand Down

0 comments on commit 4edd884

Please sign in to comment.