Pārlūkot izejas kodu

Merge branch 'transaction_teacher'

Joburgess 4 gadi atpakaļ
vecāks
revīzija
4d9ef73cbb

+ 6 - 9
mec-biz/src/main/java/com/ym/mec/biz/service/impl/SoundServiceImpl.java

@@ -127,6 +127,10 @@ public class SoundServiceImpl implements SoundService {
         }
         Map<String, BigDecimal> result = new HashMap<>();
 
+        LOGGER.info("录音文件大小:{}MB,伴奏编号:{},源文件:{}", record.getSize()/1048576f, musicScoreId, sysMusicScore.getUrl());
+        String tmpDir = FileUtils.getTempDirectoryPath() + "/";
+
+        BigDecimal oneHandred = new BigDecimal(100);
         //总分
         BigDecimal score = BigDecimal.ZERO;
         //相似度
@@ -138,10 +142,6 @@ public class SoundServiceImpl implements SoundService {
         File f = null;
         File f_r = null;
         try {
-            LOGGER.info("录音文件大小:{}MB,伴奏编号:{},源文件:{}", record.getSize()/1048576f, musicScoreId, sysMusicScore.getUrl());
-
-            String tmpDir = FileUtils.getTempDirectoryPath() + "/";
-
             //存储录音文件
             String filePath_r =  tmpDir + idGeneratorService.generatorId("sound") + "_r.wav";
             f_r = new File(filePath_r);
@@ -153,8 +153,6 @@ public class SoundServiceImpl implements SoundService {
             f = new File(filePath);
             FileUtils.copyURLToFile(url, f);
 
-            BigDecimal oneHandred = new BigDecimal(100);
-
             //相似度
             List<Double> pitchs_s = soundPressureLevelExtractor(null, filePath);
             List<Double> pitchs_r = soundPressureLevelExtractor(null, filePath_r);
@@ -170,10 +168,9 @@ public class SoundServiceImpl implements SoundService {
                 double pitch1 = Math.abs(pitchs_s.get(i));
                 double pitch2 = Math.abs(pitchs_r.get(i));
                 double pitchGap = Math.abs(pitch1-pitch2);
-                if(pitchGap>pitch1){
+                if(pitchGap>pitch1||pitchGap>20){
                     pitchGap = pitch1;
-                }
-                if(pitchGap<13){
+                }else if(pitchGap<5){
                     pitchGap = 0;
                 }
                 allPitchGap+=pitchGap;

+ 3 - 3
mec-common/common-core/pom.xml

@@ -68,9 +68,9 @@
 
 
 		<dependency>
-			<groupId>com.github.dragoon000320</groupId>
-			<artifactId>tarsosdsp</artifactId>
-			<version>1.0</version>
+			<groupId>com.github.st-h</groupId>
+			<artifactId>TarsosDSP</artifactId>
+			<version>2.4.1</version>
 		</dependency>
 	</dependencies>
 </project>