|
@@ -292,7 +292,7 @@ public class SoundCompareHelper implements PitchDetectionHandler {
|
|
|
float pitch = pitchDetectionResult.getPitch();
|
|
float pitch = pitchDetectionResult.getPitch();
|
|
|
double decibel = silenceDetector.currentSPL();
|
|
double decibel = silenceDetector.currentSPL();
|
|
|
//初始化偏移时间
|
|
//初始化偏移时间
|
|
|
- if(offsetTime == -1 && !DeviceTypeEnum.IOS.equals(deviceType) && pitch>0){
|
|
|
|
|
|
|
+ if(offsetTime == -1 && decibel>SoundCompareHandler.soundCompareConfig.validDb){
|
|
|
offsetTime = timeStamp;
|
|
offsetTime = timeStamp;
|
|
|
for (MusicPitchDetailDto musicXmlInfo : musicXmlInfos) {
|
|
for (MusicPitchDetailDto musicXmlInfo : musicXmlInfos) {
|
|
|
if(!musicXmlInfo.getDontEvaluating()){
|
|
if(!musicXmlInfo.getDontEvaluating()){
|
|
@@ -312,10 +312,7 @@ public class SoundCompareHelper implements PitchDetectionHandler {
|
|
|
SoundCompareHandler.LOGGER.info("时间:{}, 频率:{}, 分贝:{}", timeStamp, pitch, decibel);
|
|
SoundCompareHandler.LOGGER.info("时间:{}, 频率:{}, 分贝:{}", timeStamp, pitch, decibel);
|
|
|
|
|
|
|
|
if(decibel < SoundCompareHandler.soundCompareConfig.validDb){
|
|
if(decibel < SoundCompareHandler.soundCompareConfig.validDb){
|
|
|
- decibel = SoundCompareHandler.soundCompareConfig.validDb;
|
|
|
|
|
pitch = -1;
|
|
pitch = -1;
|
|
|
- }else{
|
|
|
|
|
- decibel = 0;
|
|
|
|
|
}
|
|
}
|
|
|
// if(pitch==-1){
|
|
// if(pitch==-1){
|
|
|
// decibel = SoundCompareHandler.soundCompareConfig.validDb;
|
|
// decibel = SoundCompareHandler.soundCompareConfig.validDb;
|
|
@@ -324,6 +321,7 @@ public class SoundCompareHelper implements PitchDetectionHandler {
|
|
|
|
|
|
|
|
Double avgPitch = currPitchInfos.stream().skip(1).collect(Collectors.averagingDouble(MusicPitchDetailDto::getFrequency));
|
|
Double avgPitch = currPitchInfos.stream().skip(1).collect(Collectors.averagingDouble(MusicPitchDetailDto::getFrequency));
|
|
|
Double avgDb = currPitchInfos.stream().skip(1).collect(Collectors.averagingDouble(MusicPitchDetailDto::getDecibel));
|
|
Double avgDb = currPitchInfos.stream().skip(1).collect(Collectors.averagingDouble(MusicPitchDetailDto::getDecibel));
|
|
|
|
|
+
|
|
|
long count = currPitchInfos.stream().filter(p -> p.getFrequency() < 0).count();
|
|
long count = currPitchInfos.stream().filter(p -> p.getFrequency() < 0).count();
|
|
|
if(currPitchInfos.size()>0&&count/currPitchInfos.size()<0.5){
|
|
if(currPitchInfos.size()>0&&count/currPitchInfos.size()<0.5){
|
|
|
avgPitch = currPitchInfos.stream().skip(1).filter(p->p.getFrequency()>0).collect(Collectors.averagingDouble(MusicPitchDetailDto::getFrequency));
|
|
avgPitch = currPitchInfos.stream().skip(1).filter(p->p.getFrequency()>0).collect(Collectors.averagingDouble(MusicPitchDetailDto::getFrequency));
|