|
@@ -373,9 +373,9 @@ public class UserChannelContext {
|
|
// YINPitchDetector frequencyDetector = new YINPitchDetector(samples.length , audioFormat.getSampleRate());
|
|
// YINPitchDetector frequencyDetector = new YINPitchDetector(samples.length , audioFormat.getSampleRate());
|
|
// int playFrequency = (int) frequencyDetector.getFrequency(samples);
|
|
// int playFrequency = (int) frequencyDetector.getFrequency(samples);
|
|
|
|
|
|
- int playFrequency = -1;
|
|
|
|
|
|
+ float playFrequency = -1;
|
|
if (StringUtils.equalsIgnoreCase(evaluationCriteria, EvaluationCriteriaEnum.FREQUENCY.getCode())) {
|
|
if (StringUtils.equalsIgnoreCase(evaluationCriteria, EvaluationCriteriaEnum.FREQUENCY.getCode())) {
|
|
- playFrequency = (int) detector.getPitch(samples).getPitch();
|
|
|
|
|
|
+ playFrequency = detector.getPitch(samples).getPitch();
|
|
}
|
|
}
|
|
|
|
|
|
double splDb = 0;
|
|
double splDb = 0;
|
|
@@ -691,6 +691,7 @@ public class UserChannelContext {
|
|
private int computeTempoWithFrequency(MusicXmlNote musicXmlNote, NoteAnalysis noteAnalysis, List<ChunkAnalysis> chunkAnalysisList) {
|
|
private int computeTempoWithFrequency(MusicXmlNote musicXmlNote, NoteAnalysis noteAnalysis, List<ChunkAnalysis> chunkAnalysisList) {
|
|
|
|
|
|
if (chunkAnalysisList == null || chunkAnalysisList.size() == 0 || musicXmlNote.getDontEvaluating()) {
|
|
if (chunkAnalysisList == null || chunkAnalysisList.size() == 0 || musicXmlNote.getDontEvaluating()) {
|
|
|
|
+ noteAnalysis.setMusicalErrorType(NoteErrorType.NOT_PLAY);
|
|
return -1;
|
|
return -1;
|
|
}
|
|
}
|
|
|
|
|
|
@@ -714,6 +715,7 @@ public class UserChannelContext {
|
|
}
|
|
}
|
|
|
|
|
|
if(frequencyRhythmMap.size() > 1) {
|
|
if(frequencyRhythmMap.size() > 1) {
|
|
|
|
+ noteAnalysis.setMusicalErrorType(NoteErrorType.CADENCE_WRONG);
|
|
LOGGER.debug("根据音高检测到[{}]个断点,分别在[{}]", frequencyRhythmMap.size(), frequencyRhythmMap.values().stream().map(value -> value).map(Object::toString).collect(Collectors.joining(",")));
|
|
LOGGER.debug("根据音高检测到[{}]个断点,分别在[{}]", frequencyRhythmMap.size(), frequencyRhythmMap.values().stream().map(value -> value).map(Object::toString).collect(Collectors.joining(",")));
|
|
return 0;
|
|
return 0;
|
|
}
|
|
}
|
|
@@ -730,11 +732,14 @@ public class UserChannelContext {
|
|
|
|
|
|
if ((firstBeatTime - firstChunkAnalysis.getStartTime()) * 100 / musicXmlNote.getDuration() > hardLevel.getTempoEffectiveRange(musicXmlNote.getDenominator(),
|
|
if ((firstBeatTime - firstChunkAnalysis.getStartTime()) * 100 / musicXmlNote.getDuration() > hardLevel.getTempoEffectiveRange(musicXmlNote.getDenominator(),
|
|
musicXmlNote.getDuration()) * 2) {
|
|
musicXmlNote.getDuration()) * 2) {
|
|
|
|
+ noteAnalysis.setMusicalErrorType(NoteErrorType.CADENCE_WRONG);
|
|
LOGGER.debug("节奏错误原因:进入时间点[{}]太晚", firstBeatTime);
|
|
LOGGER.debug("节奏错误原因:进入时间点[{}]太晚", firstBeatTime);
|
|
return 0;
|
|
return 0;
|
|
}
|
|
}
|
|
|
|
+ noteAnalysis.setMusicalErrorType(NoteErrorType.RIGHT);
|
|
LOGGER.debug("找到节奏点StartTime:{}", firstBeatTime);
|
|
LOGGER.debug("找到节奏点StartTime:{}", firstBeatTime);
|
|
} else {
|
|
} else {
|
|
|
|
+ noteAnalysis.setMusicalErrorType(NoteErrorType.NOT_PLAY);
|
|
LOGGER.debug("没有找到节奏点");
|
|
LOGGER.debug("没有找到节奏点");
|
|
return 0;
|
|
return 0;
|
|
}
|
|
}
|
|
@@ -783,6 +788,7 @@ public class UserChannelContext {
|
|
private int computeTempoWithAmplitude(MusicXmlNote musicXmlNote, NoteAnalysis noteAnalysis, List<ChunkAnalysis> chunkAnalysisList) {
|
|
private int computeTempoWithAmplitude(MusicXmlNote musicXmlNote, NoteAnalysis noteAnalysis, List<ChunkAnalysis> chunkAnalysisList) {
|
|
|
|
|
|
if (chunkAnalysisList == null || chunkAnalysisList.size() == 0 || musicXmlNote.getDontEvaluating()) {
|
|
if (chunkAnalysisList == null || chunkAnalysisList.size() == 0 || musicXmlNote.getDontEvaluating()) {
|
|
|
|
+ noteAnalysis.setMusicalErrorType(NoteErrorType.NOT_PLAY);
|
|
return 0;
|
|
return 0;
|
|
}
|
|
}
|
|
|
|
|