Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Comparing two different audio files doesn't work

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.

like image 749
patrio2 Avatar asked Jul 24 '15 06:07

patrio2


People also ask

How do I compare two audio files in audacity?

Re: Comparing two supposedly identical tracks. Import them both into Audacity. Apply the "Invert" effect to one of the tracks. Select both tracks, then from the "Tracks menu > Mix and Render". If the tracks were identical, the result will be silence.

How can I compare two files in Android?

Go to file name in project then press control then select Compare File and select another file you wish to compare. Seperate window will open up showing differences by colour contrast. Welcome to SO !


Video Answer


1 Answers

File temp = new File("temp.wav");

both Waves are backed by the same file. :)

like image 136
slipperyseal Avatar answered Sep 21 '22 01:09

slipperyseal