compare Image

I need to compare these two frequencies and generate a similarity score .



  • Answer ✓

    I think it would be easier to compare frequencies using the audio file instead. Do you have access to that?

  • edited March 2016

    Ok then you should check out this fft example:

    import processing.sound.*;
    FFT fft;
    AudioIn in;
    int bands = 512;
    float[] spectrum = new float[bands];
    void setup() {
      size(512, 360);
      // Create an Input stream which is routed into the Amplitude analyzer
      fft = new FFT(this, bands);
      in = new AudioIn(this, 0);
      // start the Audio Input
      // patch the AudioIn
    void draw() { 
      for(int i = 0; i < bands; i++){
      // The result of the FFT is normalized
      // draw the line for frequency band i scaling it up by 5 to get more amplitude.
      line( i, height, i, height - spectrum[i]*height*5 );

    You should be able to generate some kind of similarity score by comparing the 2 spectra. I don't think that it is time sensitive... i.e. the same sound forwards and backwards will have the same fft (I'm just guessing on that though. my math is a little rusty. could someone confirm or falsify?)

    for a more complicated but more complete discussion of similarity check out this thread:

Sign In or Register to comment.