|
@@ -401,6 +401,8 @@ public class WebSocketHandler extends AbstractWebSocketHandler {
|
|
|
boolean ing = false;
|
|
|
//当前分贝
|
|
|
double cd = 0;
|
|
|
+ //分贝变化方向,-1变小,1变大
|
|
|
+ int dcd = -1;
|
|
|
//分贝持续数量
|
|
|
int dnum = 0;
|
|
|
for (MusicPitchDetailDto musicalNotesPitch : measureSoundPitchInfos) {
|
|
@@ -418,13 +420,17 @@ public class WebSocketHandler extends AbstractWebSocketHandler {
|
|
|
}
|
|
|
}
|
|
|
//计算声音大小断层册数
|
|
|
- if(ing && Math.abs(musicalNotesPitch.getDecibel() - cd) > 5){
|
|
|
+ if(ing && Math.abs(musicalNotesPitch.getDecibel() - cd) > 10){
|
|
|
dnum ++;
|
|
|
}
|
|
|
if (dnum > 2){
|
|
|
+ int tdcd = cd > musicalNotesPitch.getDecibel() ? -1 : 1;
|
|
|
cd = musicalNotesPitch.getDecibel();
|
|
|
dnum = 0;
|
|
|
- decibelChangeNum++;
|
|
|
+ if (tdcd != dcd) {
|
|
|
+ decibelChangeNum++;
|
|
|
+ }
|
|
|
+ dcd = tdcd;
|
|
|
}
|
|
|
}
|
|
|
userSoundInfoMap.get(phone).getMusicalNotePitchMap().put(musicXmlInfo.getMusicalNotesIndex(), (float) pitch);
|