问题
I want to compare two audio file for example mp3 and wav. I use musicg to compare by fingerprints.
Wave record1 = new Wave(music1.toString());
Wave record2 = new Wave(music2.toString());
FingerprintSimilarity Similarity=record1.getFingerprintSimilarity(record2);
System.out.println(Similarity.getSimilarity());
musicg work only on wav so I convert mp3 to wav using JAVE
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);
And now the problem, when I try compare two wav that I don't convert fingerprints work perfect but when I compare two different audio that I have to convert it's always return that both audio are same. Wave
create record1
the same spectrogram as record2
when I give to it two different audio.
回答1:
File temp = new File("temp.wav");
both Waves are backed by the same file. :)
来源:https://stackoverflow.com/questions/31603508/comparing-two-different-audio-files-doesnt-work