Wednesday, 29 January 2014

compare two sounds in android

Compare two sounds in Android 


Hi guys to i am going to share you code for comparing to sounds without using Google Voice.

There is very fine library which allows developers to extract audio features and operate audio data like reading, cutting and trimming easily from an inputstream. It also provides tools for digital signal processing, renders the wavform or spectrogram for research and development purpose.

https://code.google.com/p/musicg/

and here is code to compare wave two sounds 

// create a wave objectWave wave = new Wave(path1);Wave wave1 = new Wave(path2);FingerprintSimilarity fingerprintSimilarity = wave .getFingerprintSimilarity(wave1);float score = fingerprintSimilarity.getScore();float similarity = fingerprintSimilarity.getSimilarity();Log.d("Similarsound", "Score : " + score + "\n Similarity : "+ similarity);




2 comments:

  1. I used same code, i have two file wave in res/raw
    But dosnt work it display some error: no such file or directory

    ReplyDelete
    Replies
    1. InputStream in1=getResources().openRawResource(R.raw.bad_battery);
      Wave wave = new Wave(in1);
      //don't forget that the extension of the file must be in .wav

      Delete