I want to change the tempo of mp3 files without changing the pitch. I have byte array of mp3 file , want to change its tempo and save it with that increased or decreased tempo in sdcard. I searched about it alot , people were taking about Lame library and ffmpeg. Is it possible to change tempo with lib ffmpeg or lib Lame of a audio mp3 file in android.If yes then how to compile ffmpeg or Lame on windows. need help in writing android.mk and wrapper class. Help me out Thanks
EDIT
I have successfully compiled lib lame with help of this Link. but still don't know how to use those native methods(written in Encoder.java file) to change the tempo of mp3 file. As am new to android need right direction to move into right direction to solve my problem. I have seen a application named xSpeedPlayer on android market. This app changes the tempo of mp3 and saves that new file into sdcard . This is what i want to achieve in my app too. Then i searched how they are achieving this in xSpeedPlayer and found that they are using mp3Lame and mpg123 library. But don't know how they have done it using these libs. Now i need help to move forward .
EDIT
I have pcm data of Mp3 file and have native mathods of LAME lib which are.. (But dont know how to use these Methods to change tempo)
/**
* Initialize LAME.
*
* @param inSamplerate input sample rate in Hz.
* @param outChannel number of channels in input stream.
* @param outSamplerate output sample rate in Hz.
* @param outBitrate brate compression ratio in KHz.
* @param quality quality=0..9. 0=best (very slow). 9=worst.<br />
* recommended:<br />
* 2 near-best quality, not too slow<br />
* 5 good quality, fast<br />
* 7 ok quality, really fast
* @param id3tagTitle ID3 Tag title.
* @param id3tagArtist ID3 Tag artist.
* @param id3tagAlbum ID3 Tag album.
* @param id3tagYear ID3 Tag year.
* @param id3tagComment ID3 Tag comment.
*/
public native static int init(int inSamplerate, int outChannel,
int outSamplerate, int outBitrate, int quality, String id3tagTitle,
String id3tagArtist, String id3tagAlbum, String id3tagYear,
String id3tagComment);
/**
* Encode buffer to mp3.
*
* @param instanceIndex Instance index.
* @param buffer_l PCM data for left channel.
* @param buffer_r PCM data for right channel.
* @param sambles number of samples per channel.
* @param mp3buf result encoded MP3 stream. You must specified
* "7200 + (1.25 * samples)" length array.
* @return number of bytes output in mp3buf. Can be 0.<br />
* -1: mp3buf was too small<br />
* -2: malloc() problem<br />
* -3: lame_init_params() not called<br />
* -4: psycho acoustic problems
*/
public native static int encode(int instanceIndex, short[] buffer_l, short[] buffer_r,
int samples, byte[] mp3buf);
/**
* Encode buffer L & R channel data interleaved to mp3.
*
* @param instanceIndex Instance index.
* @param pcm PCM data for left and right channel, interleaved.
* @param sambles number of samples per channel. <strong>not</strong> number
* of samples in pcm[].
* @param mp3buf result encoded MP3 stream. You must specified
* "7200 + (1.25 * samples)" length array.
* @return number of bytes output in mp3buf. Can be 0.<br />
* -1: mp3buf was too small<br />
* -2: malloc() problem<br />
* -3: lame_init_params() not called<br />
* -4: psycho acoustic problems
*/
public native static int encodeBufferInterleaved(int instanceIndex, short[] pcm, int samples,
byte[] mp3buf);
/**
* Flush LAME buffer.
*
* @param instanceIndex Instance index.
* @param mp3buf result encoded MP3 stream. You must specified at least 7200
* bytes.
* @return number of bytes output to mp3buf. Can be 0.
*/
public native static int flush(int instanceIndex, byte[] mp3buf);
/**
* Close LAME.
*
* @param instanceIndex Instance index.
*/
public native static void close(int instanceIndex);
}
Is it possible to change the tempo of raw data of mp3 and store it in sdcard ? Help me out ... Thanx for any kind of help