如何将WAV编码为Android设备上的mp3 [英] How to encode a WAV to a mp3 on a Android device

查看:110
本文介绍了如何将WAV编码为Android设备上的mp3的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我已经简化了我的问题,并提供了一个赏金:
有什么选择将原始PCM音频数据压缩到Android设备上的mp3。

I have simplified my question and offered a bounty: What options are there for compressing raw PCM audio data to a mp3 on a Android device.

我的原始帖子
我正在Android手机上创建一个合成器,并且我一直在生成PCM数据以发送给扬声器。现在我想知道我是否可以将这个PCM数据编码为mp3以保存到sdcard。 MediaRecorder 对象可以将来自麦克风的音频编码成各种格式,但是不允许编程从编程生成的音频数据。

My original post: I'm creating a synthesiser on my Android phone, and I've been generating PCM data to send to the speakers. Now I'm wondering if I can encode this PCM data as a mp3 to save to the sdcard. The MediaRecorder object can encode audio coming from the microphone into various formats, but doesn't allow the encoding from programmatically generated audio data.

所以我的问题是,是否有标准的Android API编码音频?如果没有,那么什么纯Java或NDK的解决方案呢?你可以推荐任何一个吗?

So my question is, is there a standard Android API for encoding audio? If not, what pure Java or NDK based solutions are there? And can you recommend any of them?

不幸的是,我只需要将生成的音频保存为一个WAV文件,我可以轻松地做。

Failing this I'll just have to save my generated audio as a WAV file, which I can easily do.

推荐答案

纯Java


查看Tritonus的洁净室实现javasound其中提供了一个 MP3编码器插件: http://www.tritonus.org/ plugins.html


其次,我建议查看jzoom的库JLayer或JLayerME: http://www.javazoom.net/javalayer/javalayer.html (这可能只是解码,不确定)


如果这些不符合您的需要,您可以从2000年关于将MP3功能添加到J2SE(源代码)中的这篇文章: http://www.javaworld.com/javaworld/jw-11-2000/jw-1103-mp3 .html



本地路由


如果要native的性能我会看看一个用于Android的FFmpeg或Lame端口。
Lame: http://lame.sourceforge.net/

Pure Java
Look into Tritonus's clean room implementation of javasound which offers an MP3 encoder plugin here: http://www.tritonus.org/plugins.html
Secondly, I would suggest looking into jzoom's libraries JLayer or JLayerME: http://www.javazoom.net/javalayer/javalayer.html (this may only be decode, not sure)
If those doesn't suit your need you can look at this article from 2000 about adding MP3 capabilities to J2SE (with source): http://www.javaworld.com/javaworld/jw-11-2000/jw-1103-mp3.html

Native route
If you want "native" performance I would look at an FFmpeg or Lame port for Android. Lame: http://lame.sourceforge.net/

这篇关于如何将WAV编码为Android设备上的mp3的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆