某些大型的蓝牙音箱需要通过点位器调节高低音,高低音调节有硬件调节和软件调节两种方式,软件调节方式是通过调节内部软件eq的方式实现调节频点 低音:80~100HZ 高音10KHZ。
一、通过eq工具调节然后生成对应数组。
const int Seg1Coeff[][9][5] = {
//154Hz Low Shelf Q=0.7
};
const int Seg2Coeff[][9][5] = {
//90Hz Low Shelf Q=0.7
//segment_2 -12db
{
{2059346,-1010940,1034485,-2087398,1038993,},//44100
{2022547,-974636,1020892,-2077392,1029499,},//22050
{1951782,-905776,995111,-2056647,1010779,},//11025
{2062380,-1013947,1035611,-2088200,1039769,},//48000
{2028460,-980447,1023068,-2079035,1031036,},//24000
{1963035,-916640,999179,-2060083,1013797,},//12000
{2045316,-997059,1029288,-2083644,1035393,},//32000
{1995357,-948027,1010930,-2069661,1022379,},//16000
{1900606,-856788,976770,-2040328,996860,},//8000
},
//segment_2 -8db
{
{2066976,-1018570,1039546,-2084931,1036526,},//44100
{2037320,-989414,1030772,-2072511,1024617,},//22050
{1979504,-933535,1013955,-2047094,1001214,},//11025
{2069408,-1020975,1040270,-2085932,1037500,},//48000
{2042105,-994096,1032180,-2074543,1026542,},//24000
{1988768,-942402,1016623,-2051275,1004979,},//12000
{2055702,-1007447,1036198,-2080258,1032007,},//32000
{2015229,-967912,1024300,-2062989,1015702,},//16000
{1937040,-893313,1001850,-2027382,983882,},//8000
},
//segment_2 -4db
{
{2073076,-1024671,1044165,-2081834,1033429,},//44100
{2049210,-1001308,1039854,-2066398,1018502,},//22050
{2002092,-956153,1031522,-2035193,989297,},//11025
{2075025,-1026593,1044520,-2083083,1034652,},//48000
{2053074,-1005068,1040548,-2068914,1020913,},//24000
{2009694,-963351,1032850,-2040293,993984,},//12000
{2064027,-1015774,1042523,-2076011,1027759,},//32000
{2031298,-983991,1036659,-2054650,1007357,},//16000
{1966991,-923340,1025467,-2011317,967776,},//8000
},
//segment_2 0db
{
{2077948,-1029543,1048576,-2077948,1029543,},//44100
{2058754,-1010855,1048576,-2058754,1010855,},//22050
{2020406,-974490,1048576,-2020406,974490,},//11025
{2079508,-1031076,1048576,-2079508,1031076,},//48000
{2061872,-1013868,1048576,-2061872,1013868,},//24000
{2026633,-980309,1048576,-2026633,980309,},//12000
{2070689,-1022436,1048576,-2070689,1022436,},//32000
{2044246,-996948,1048576,-2044246,996948,},//16000
{1991451,-947860,1048576,-1991451,947860,},//8000
},
//segment_2 4db
{
{2081834,-1033429,1053006,-2073076,1024671,},//44100
{2066398,-1018502,1057371,-2049210,1001308,},//22050
{2035193,-989297,1065912,-2002093,956153,},//11025
{2083083,-1034652,1052648,-2075025,1026593,},//48000
{2068914,-1020913,1056666,-2053074,1005068,},//24000
{2040293,-993984,1064541,-2009694,963352,},//12000
{2076011,-1027759,1054664,-2064027,1015774,},//32000
{2054650,-1007357,1060630,-2031298,983991,},//16000
{2011317,-967776,1072206,-1966991,923339,},//8000
},
//segment_2 8db
{
{2084931,-1036526,1057685,-2066976,1018570,},//44100
{2072511,-1024616,1066688,-2037320,989414,},//22050
{2047094,-1001214,1084379,-1979504,933535,},//11025
{2085932,-1037500,1056949,-2069408,1020975,},//48000
{2074543,-1026542,1065232,-2042105,994096,},//24000
{2051275,-1004979,1081533,-1988768,942402,},//12000
{2080258,-1032007,1061102,-2055702,1007447,},//32000
{2062989,-1015702,1073427,-2015229,967912,},//16000
{2027383,-983882,1097481,-1937040,893313,},//8000
},
//segment_2 12db
{
{2087398,-1038993,1062859,-2059346,1010940,},//44100
{2077392,-1029499,1077010,-2022547,974636,},//22050
{2056647,-1010779,1104914,-1951782,905776,},//11025
{2088200,-1039769,1061704,-2062380,1013947,},//48000
{2079035,-1031036,1074720,-2028460,980447,},//24000
{2060083,-1013797,1100416,-1963035,916640,},//12000
{2083644,-1035393,1068226,-2045316,997059,},//32000
{2069662,-1022379,1087624,-1995357,948027,},//16000
{2040328,-996860,1125661,-1900606,856788,},//8000
},
};
const int Seg3Coeff[][9][5] = {
//154Hz Low Shelf Q=0.7
};
const int Seg4Coeff[][9][5] = {
//154Hz Low Shelf Q=0.7
};
const int Seg5Coeff[][9][5] = {
//154Hz Low Shelf Q=0.7
};
const int Seg6Coeff[][9][5] = {
//154Hz Low Shelf Q=0.7
};
const int Seg7Coeff[][9][5] = {
//154Hz Low Shelf Q=0.7
};
const int Seg8Coeff[][9][5] = {
//154Hz Low Shelf Q=0.7
};
const int Seg9Coeff[][9][5] = {
//10kHz Low Shelf Q=0.7
//segment_9 -12db
{
{126628,178395,589191,-225358,500075,},//44100
{0,0,1048576,0,0,},//22050
{0,0,1048576,0,0,},//11025
{228384,166169,593769,-403318,509727,},//48000
{0,0,1048576,0,0,},//24000
{0,0,1048576,0,0,},//12000
{0,0,1048576,0,0,},//32000
{0,0,1048576,0,0,},//16000
{0,0,1048576,0,0,},//8000
},
//
//segment_9 -8db
{
{143950,59361,715146,-211065,401850,},//44100
{0,0,1048576,0,0,},//22050
{0,0,1048576,0,0,},//11025
{259272,46828,718918,-378160,412521,},//48000
{0,0,1048576,0,0,},//24000
{0,0,1048576,0,0,},//12000
{0,0,1048576,0,0,},//32000
{0,0,1048576,0,0,},//16000
{0,0,1048576,0,0,},//8000
},
//se
//segment_9 -4db
{
{161498,-61228,866389,-195458,294600,},//44100
{0,0,1048576,0,0,},//22050
{0,0,1048576,0,0,},//11025
{290477,-73741,868698,-350625,306135,},//48000
{0,0,1048576,0,0,},//24000
{0,0,1048576,0,0,},//12000
{0,0,1048576,0,0,},//32000
{0,0,1048576,0,0,},//16000
{0,0,1048576,0,0,},//8000
},
//
//segment_9 0db
{
{178812,-180213,1048576,-178812,180213,},//44100
{0,0,1048576,0,0,},//22050
{0,0,1048576,0,0,},//11025
{321183,-192381,1048576,-321183,192381,},//48000
{0,0,1048576,0,0,},//24000
{0,0,1048576,0,0,},//12000
{0,0,1048576,0,0,},//32000
{0,0,1048576,0,0,},//16000
{0,0,1048576,0,0,},//8000
},
//segment_9 4db
{
{195458,-294600,1269074,-161498,61228,},//44100
{0,0,1048576,0,0,},//22050
{0,0,1048576,0,0,},//11025
{350625,-306135,1265701,-290477,73741,},//48000
{0,0,1048576,0,0,},//24000
{0,0,1048576,0,0,},//12000
{0,0,1048576,0,0,},//32000
{0,0,1048576,0,0,},//16000
{0,0,1048576,0,0,},//8000
},
//segment_9 8db
{
{211065,-401850,1537464,-143950,-59361,},//44100
{0,0,1048576,0,0,},//22050
{0,0,1048576,0,0,},//11025
{378160,-412521,1529398,-259272,-46828,},//48000
{0,0,1048576,0,0,},//24000
{0,0,1048576,0,0,},//12000
{0,0,1048576,0,0,},//32000
{0,0,1048576,0,0,},//16000
{0,0,1048576,0,0,},//8000
},
//segment_9 12db
{
{225358,-500075,1866137,-126628,-178395,},//44100
{0,0,1048576,0,0,},//22050
{0,0,1048576,0,0,},//11025
{403318,-509726,1851751,-228384,-166168,},//48000
{0,0,1048576,0,0,},//24000
{0,0,1048576,0,0,},//12000
{0,0,1048576,0,0,},//32000
{0,0,1048576,0,0,},//16000
{0,0,1048576,0,0,},//8000
},
};
const int Seg10Coeff[][9][5] = {
//154Hz Low Shelf Q=0.7
};
二、调节函数添加
void soft_eq_SegmentCoeff_Modify(int seg_idx, int tab_idx)
{
switch (seg_idx) {
case 1:
CurModify_Segment = seg_idx - 1;
CurModify_Tab = Seg1Coeff[tab_idx - 1];
break;
case 2:
CurModify_Segment = seg_idx - 1;
CurModify_Tab = Seg2Coeff[tab_idx - 1];
break;
case 3:
CurModify_Segment = seg_idx - 1;
CurModify_Tab = Seg3Coeff[tab_idx - 1];
break;
case 4:
CurModify_Segment = seg_idx - 1;
CurModify_Tab = Seg4Coeff[tab_idx - 1];
break;
case 5:
CurModify_Segment = seg_idx - 1;
CurModify_Tab = Seg5Coeff[tab_idx - 1];
break;
case 6:
CurModify_Segment = seg_idx - 1;
CurModify_Tab = Seg6Coeff[tab_idx - 1];
break;
case 7:
CurModify_Segment = seg_idx - 1;
CurModify_Tab = Seg7Coeff[tab_idx - 1];
break;
case 8:
CurModify_Segment = seg_idx - 1;
CurModify_Tab = Seg8Coeff[tab_idx - 1];
break;
case 9:
CurModify_Segment = seg_idx - 1;
CurModify_Tab = Seg9Coeff[tab_idx - 1];
break;
case 10:
CurModify_Segment = seg_idx - 1;
CurModify_Tab = Seg10Coeff[tab_idx - 1];
break;
default:
break;
}
}
三、调节时发送对应case即可,case可放在task_common.c当中处理
case MSG_BASS_EQ_UP:
printf(“MSG_BASS_EQ_UP\n”);
bass_eq_cnt++;
if(bass_eq_cnt >= 7)bass_eq_cnt = 7;
soft_eq_SegmentCoeff_Modify(2,bass_eq_cnt);
break;
case MSG_BASS_EQ_DOWN:
printf(“MSG_BASS_EQ_DOWN\n”);
if(bass_eq_cnt)
bass_eq_cnt–;
soft_eq_SegmentCoeff_Modify(2,bass_eq_cnt);
break;
case MSG_TRB_EQ_UP:
printf(“MSG_TRB_EQ_UP”);
trb_eq_cnt++;
if(trb_eq_cnt >= 7)trb_eq_cnt = 7;
soft_eq_SegmentCoeff_Modify(9,trb_eq_cnt);
break;
case MSG_TRB_EQ_DOWN:
printf(“MSG_TRB_EQ_DOWN”);
if(trb_eq_cnt)
trb_eq_cnt --;
soft_eq_SegmentCoeff_Modify(9,trb_eq_cnt);
break;
来源:CSDN
作者:VX FY1174801586
链接:https://blog.csdn.net/FY1174801586/article/details/104156799