|
@@ -388,7 +388,10 @@ public class SoundCompareHandler implements WebSocketEventHandler {
|
|
if (avgPitch > 0){
|
|
if (avgPitch > 0){
|
|
recordCents = PitchConverter.hertzToAbsoluteCent(avgPitch);
|
|
recordCents = PitchConverter.hertzToAbsoluteCent(avgPitch);
|
|
}
|
|
}
|
|
- double cents = PitchConverter.hertzToAbsoluteCent(musicXmlInfo.getFrequency());
|
|
|
|
|
|
+ double cents = 0;
|
|
|
|
+ if(musicXmlInfo.getFrequency()>0){
|
|
|
|
+ cents = PitchConverter.hertzToAbsoluteCent(musicXmlInfo.getFrequency());
|
|
|
|
+ }
|
|
double score = 100 - Math.round(Math.abs(cents - recordCents)) + soundCompareConfig.intonationCentsRange;
|
|
double score = 100 - Math.round(Math.abs(cents - recordCents)) + soundCompareConfig.intonationCentsRange;
|
|
if (score < 0){
|
|
if (score < 0){
|
|
score = 0;
|
|
score = 0;
|