|
|
@@ -290,7 +290,7 @@ public class SoundCompareHelper implements PitchDetectionHandler {
|
|
|
public void handlePitch(PitchDetectionResult pitchDetectionResult, AudioEvent audioEvent) {
|
|
|
int timeStamp = (int) (measureStartTime + audioEvent.getTimeStamp()*1000);
|
|
|
float pitch = pitchDetectionResult.getPitch();
|
|
|
- double decibel = silenceDetector.currentSPL();
|
|
|
+ int decibel = (int) (100 - Math.abs(silenceDetector.currentSPL()));
|
|
|
//初始化偏移时间
|
|
|
if(offsetTime == -1 && decibel>SoundCompareHandler.soundCompareConfig.validDb){
|
|
|
offsetTime = timeStamp;
|
|
|
@@ -309,11 +309,13 @@ public class SoundCompareHelper implements PitchDetectionHandler {
|
|
|
}
|
|
|
}
|
|
|
|
|
|
- SoundCompareHandler.LOGGER.info("时间:{}, 频率:{}, 分贝:{}", timeStamp, pitch, decibel);
|
|
|
-
|
|
|
- if(decibel < SoundCompareHandler.soundCompareConfig.validDb){
|
|
|
+ if(decibel <= SoundCompareHandler.soundCompareConfig.validDb){
|
|
|
pitch = -1;
|
|
|
+ decibel = 0;
|
|
|
}
|
|
|
+
|
|
|
+ SoundCompareHandler.LOGGER.info("时间:{}, 频率:{}, 分贝:{}", timeStamp, pitch, decibel);
|
|
|
+
|
|
|
// if(pitch==-1){
|
|
|
// decibel = SoundCompareHandler.soundCompareConfig.validDb;
|
|
|
// }
|