如何为android创建均衡器

声明:本页面是StackOverFlow热门问题的中英对照翻译,遵循CC BY-SA 4.0协议,如果您需要使用它,必须同样遵循CC BY-SA许可,注明原文地址和作者信息,同时你必须将它归于原作者(不是我):StackOverFlow 原文地址: http://stackoverflow.com/questions/3419599/
Warning: these are provided under cc-by-sa 4.0 license. You are free to use/share it, But you must attribute it to the original authors (not me): StackOverFlow

提示:将鼠标放在中文语句上可以显示对应的英文。显示中英文
时间:2020-08-20 10:07:05  来源:igfitidea点击:

How to create equalizer for android

androidmediaequalizer

提问by MistaGreen

I want to create simple equalizer for android. How can I do it?

我想为 android 创建简单的均衡器。我该怎么做?

Try to find some methods in MediaPlayer class. But all my attempts failed.

尝试在 MediaPlayer 类中找到一些方法。但我所有的尝试都失败了。

采纳答案by androidworkz

Simple answer... you can't do it with the framework or with Java (because there is no JMF support in Android). You have to use the NDK and JNI to compile a native library with equalizer support. If you know C/C++ there are plenty of libraries around that will provide this functionality but if you don't know C/C++ or have the means to pay someone that does I would recommend you move on to something else within your means... There are even some working examples for Android, if you look around, that use libmpg123... but libmpg123 only provides an equalizer interface for mp3's. I found that it's pretty buggy in general and compromised the stability of the app in such a way that it would lock up android and I would have to pull the battery to reboot the phone. In addition, there was alot of audio clipping even with the equalizer flatlined. That is my experience...

简单的答案......你不能用框架或Java来做(因为Android中没有JMF支持)。您必须使用 NDK 和 JNI 来编译具有均衡器支持的本机库。如果您了解 C/C++,那么周围有很多库可以提供此功能,但是如果您不了解 C/C++ 或有办法支付某个人的费用,我建议您在力所能及的范围内转向其他东西。 . 甚至有一些适用于 Android 的工作示例,如果您环顾四周,使用 libmpg123...但 libmpg123 仅提供 mp3 的均衡器接口。我发现它总体上有很多问题,并且以这样的方式损害了应用程序的稳定性,以至于它会锁定 android,我必须拔掉电池才能重新启动手机。此外,即使均衡器平坦,也有很多音频剪辑。这是我的经验...

回答by dren311

Android has built-in qualizer engine, though it isn't located in MediaPlayer class, becouse it's a class itself located in android.media.audioFx package.

Android 有内置的 qualizer 引擎,虽然它不位于 MediaPlayer 类中,因为它本身是一个位于 android.media.audioFx 包中的类。

http://developer.android.com/reference/android/media/audiofx/Equalizer.html

http://developer.android.com/reference/android/media/audiofx/Equalizer.html