|
@@ -149,8 +149,9 @@ public class SoundCompareHandler implements WebSocketEventHandler {
|
|
|
File file = new File(tmpDir+phone + "_"+ userSoundInfoMap.get(phone).getMusicScoreId() +"_"+ LocalDateTime.now().format(DateTimeFormatter.ofPattern("yyyyMMddHHmmss")) +".wav");
|
|
|
userSoundInfoMap.get(phone).setFile(file);
|
|
|
userSoundInfoMap.get(phone).setAccessFile(new RandomAccessFile(file, "rw"));
|
|
|
+ userSoundInfoMap.get(phone).getAccessFile().seek(44);
|
|
|
userSoundInfoMap.get(phone).setRecordFilePath(file.getAbsolutePath());
|
|
|
- } catch (FileNotFoundException e) {
|
|
|
+ } catch (IOException e) {
|
|
|
throw new BizException("文件创建失败:", e);
|
|
|
}
|
|
|
break;
|
|
@@ -358,6 +359,7 @@ public class SoundCompareHandler implements WebSocketEventHandler {
|
|
|
if(recordPitchs.size()>0){
|
|
|
integrityDuty = recordPitchs.get(0).getDuration()/(float)musicXmlInfo.getDuration();
|
|
|
}
|
|
|
+ integrityDuty = scoreMapping(integrityDuty, userSoundInfoMap.get(phone).getHeardLevel().getIntegrityRange(), 1);
|
|
|
//节奏
|
|
|
if(recordPitchs.size()==1||integrityDuty>userSoundInfoMap.get(phone).getHeardLevel().getCadenceRange()){
|
|
|
cadenceNum++;
|
|
@@ -438,6 +440,11 @@ public class SoundCompareHandler implements WebSocketEventHandler {
|
|
|
createPushInfo(phone, "measureScore", measureIndex, intonation, cadence, integrity);
|
|
|
}
|
|
|
|
|
|
+ private float scoreMapping(float score, float divisor, float maxValue){
|
|
|
+ score = score*divisor;
|
|
|
+ return score>maxValue?maxValue:score;
|
|
|
+ }
|
|
|
+
|
|
|
/**
|
|
|
* @describe 计算最终评分
|
|
|
* @author Joburgess
|