我想比较两个音频文件,例如mp3和wav.我使用
musicg来比较指纹.
Wave record1 = new Wave(music1.toString());
Wave record2 = new Wave(music2.toString());
FingerprintSimilarity Similarity=record1.getFingerprintSimilarity(record2);
System.out.println(Similarity.getSimilarity());
musicg仅在wav上工作所以我使用JAVE将mp3转换为wav
File temp = new File("temp.wav");
AudioAttributes audio = new AudioAttributes();
audio.setCodec("pcm_s16le");
audio.setBitRate(new Integer(128000));
audio.setChannels(new Integer(2));
audio.setSamplingRate(new Integer(44100));
EncodingAttributes attrs = new EncodingAttributes();
attrs.setFormat("wav");
attrs.setAudioAttributes(audio);
Encoder encoder = new Encoder();
encoder.encode(source, temp, attrs);
现在问题是,当我尝试比较两个wav,我不转换指纹工作完美,但当我比较两个不同的音频,我必须转换它总是返回两个音频是相同的.当我给它两个不同的音频时,Wave创建record1与record2相同的频谱图.