yonge 4 years ago
parent
commit
bb28861493

+ 2 - 2
mec-biz/src/main/java/com/ym/mec/biz/dal/dto/SoundCompareHelper.java

@@ -347,8 +347,8 @@ public class SoundCompareHelper implements PitchDetectionHandler {
         SoundCompareHandler.LOGGER.info("时间:{}, 振幅:{}, 频率:{}, 分贝:{}", timeStamp, amplitude, pitch, decibel);
 
         if(currPitchInfos.size()>0&&(Math.abs(currPitchInfos.get(currPitchInfos.size()-1).getFrequency()-pitch)>10||Math.abs(currPitchInfos.get(currPitchInfos.size()-1).getDecibel()-decibel)>10)){
-            Double avgPitch = currPitchInfos.stream().skip(1).collect(Collectors.averagingDouble(MusicPitchDetailDto::getFrequency));
-            Double avgDb = currPitchInfos.stream().skip(1).collect(Collectors.averagingDouble(MusicPitchDetailDto::getDecibel));
+            Double avgPitch = currPitchInfos.stream().collect(Collectors.averagingDouble(MusicPitchDetailDto::getFrequency));
+            Double avgDb = currPitchInfos.stream().collect(Collectors.averagingDouble(MusicPitchDetailDto::getDecibel));
 
             MusicPitchDetailDto measureDetail = new MusicPitchDetailDto(currPitchInfos.get(0).getTimeStamp(), avgPitch.floatValue(), avgDb);
             measureDetail.setEndTimeStamp(timeStamp);