Search code examples
javamp3fft

Fourier Transform of Mp3 File


I want to take Fourier Transform of Mp3 file.For this first I am reading that file using AudioInputStream and then converting in Required Audio format,

AudioFormat decodedFormat = newAudioFormat(AudioFormat.Encoding.PCM_SIGNED,
        baseFormat.getSampleRate(), 16, baseFormat.getChannels(),
        baseFormat.getChannels() * 2, baseFormat.getSampleRate(), false);

It is giving me a very huge byte of array. Now divide this byte array into small size chunks(4096 bytes)and pass it to Fourier Transform Function and continue for whole array.This process slow Down my system.and it is taking 15 minute to process a single mp3 song. So How i can solve this problem? I am using this code for Fourier Transform-- http://introcs.cs.princeton.edu/java/97data/FFT.java.html


Solution

  • If it's taking 900 seconds (15 minutes) to generate 9000 FFTs with 4k points (i.e. 100ms per FFT) then your FFT implementation is broken.

    You need to find a (much) more efficient FFT implementation.