我想在不改变音高的情况下改变 mp3 文件的速度。我有 mp3 文件的字节数组,想改变它的速度并用 sdcard 中增加或减少的速度保存它。我搜索了很多,人们正在关注 Lame 库和 ffmpeg。是否可以使用 android 中音频 mp3 文件的 lib ffmpeg 或 lib Lame 更改速度。如果是,那么如何在 Windows 上编译 ffmpeg 或 Lame。在编写 android.mk 和包装类时需要帮助。帮帮我谢谢
编辑
我已经在这个Link的帮助下成功编译了 lib lame 。但仍然不知道如何使用那些本地方法(写在 Encoder.java 文件中)来改变 mp3 文件的速度。作为android的新手,需要正确的方向才能进入正确的方向来解决我的问题。我在 android 市场上看到了一个名为 xSpeedPlayer 的应用程序。这个应用程序改变了 mp3 的速度并将新文件保存到 sdcard 中。这也是我想在我的应用程序中实现的目标。然后我搜索了他们如何在 xSpeedPlayer 中实现这一点,发现他们正在使用 mp3Lame 和 mpg123 库。但不知道他们是如何使用这些库完成的。现在我需要帮助才能前进。
编辑
我有 Mp3 文件的 pcm 数据,并且有 LAME lib 的原生数学,它们是..(但不知道如何使用这些方法来改变节奏)
/**
* 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);
}
是否可以更改 mp3 原始数据的速度并将其存储在 sdcard 中?帮帮我...感谢任何帮助