|
@@ -160,7 +160,7 @@ public class WebSocketHandler extends AbstractWebSocketHandler {
|
|
|
}
|
|
|
|
|
|
AudioDispatcher dispatcher = AudioDispatcherFactory.fromByteArray(message.getPayload().array(), soundCompareConfig.audioFormat, soundCompareConfig.simpleSize, soundCompareConfig.overlap);
|
|
|
- dispatcher.addAudioProcessor(soundCompareConfig.silenceDetector);
|
|
|
+ dispatcher.addAudioProcessor(userSoundInfoMap.get(phone).silenceDetector);
|
|
|
dispatcher.addAudioProcessor(new PitchProcessor(soundCompareConfig.algo, soundCompareConfig.simpleRate, soundCompareConfig.simpleSize, (pitchDetectionResult, audioEvent) -> {
|
|
|
int timeStamp = (int) (userSoundInfoMap.get(phone).getMeasureStartTime() + audioEvent.getTimeStamp()*1000);
|
|
|
float pitch = pitchDetectionResult.getPitch();
|
|
@@ -168,11 +168,11 @@ public class WebSocketHandler extends AbstractWebSocketHandler {
|
|
|
int preTimeStamp = CollectionUtils.isEmpty(userSoundInfoMap.get(phone).getRecordMeasurePithInfo())?0:userSoundInfoMap.get(phone).getRecordMeasurePithInfo().get(userSoundInfoMap.get(phone).getRecordMeasurePithInfo().size()-1).getTimeStamp();
|
|
|
calOffsetTime(phone, timeStamp - (timeStamp - preTimeStamp)/2);
|
|
|
}
|
|
|
- if(soundCompareConfig.silenceDetector.currentSPL()<soundCompareConfig.validDb){
|
|
|
+ if(userSoundInfoMap.get(phone).silenceDetector.currentSPL()<soundCompareConfig.validDb){
|
|
|
pitch = -1;
|
|
|
}
|
|
|
// LOGGER.info("时间:{}, 频率:{}, 分贝:{}", timeStamp, pitch, silenceDetecor.currentSPL());
|
|
|
- userSoundInfoMap.get(phone).getRecordMeasurePithInfo().add(new MusicPitchDetailDto(timeStamp, pitch, soundCompareConfig.silenceDetector.currentSPL()));
|
|
|
+ userSoundInfoMap.get(phone).getRecordMeasurePithInfo().add(new MusicPitchDetailDto(timeStamp, pitch, userSoundInfoMap.get(phone).silenceDetector.currentSPL()));
|
|
|
}));
|
|
|
dispatcher.run();
|
|
|
if(Objects.isNull(userSoundInfoMap.get(phone).getAccessFile())){
|