Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

How to set audio equalizer in Android

Tags:

android

audio

I am making a media player in which there is need to set equalizer effect using "seek bar" as "Bass","terrible","Rock","Pop","Medium". I got a link in which for doing this some NDK libraries used. Is there any Java library for doing it and please any explain what would be the logic for doing this.

 @Override
public void onCreate(Bundle savedInstanceState) {
super.onCreate(savedInstanceState);
setContentView(R.layout.equalizertab);


      f
   }
  } else {
   try {
    ((GlobalState) getApplicationContext())
      .resetEQ();
   } catch (RemoteException re) {
    // TODO:
   }
  }
 }
});

Log cat out below:

05-25 11:52:16.630: E/AndroidRuntime(19088): FATAL EXCEPTION: main
05-25 11:52:16.630: E/AndroidRuntime(19088): java.lang.RuntimeException: Unable to start activity ComponentInfo{com.example.android.apis.media/com.example.android.apis.media.AudioFxDemoActivity}: java.lang.RuntimeException: Cannot initialize Visualizer engine, error: -1
05-25 11:52:16.630: E/AndroidRuntime(19088):    at android.app.ActivityThread.performLaunchActivity(ActivityThread.java:1818)
05-25 11:52:16.630: E/AndroidRuntime(19088):    at android.app.ActivityThread.handleLaunchActivity(ActivityThread.java:1834)
05-25 11:52:16.630: E/AndroidRuntime(19088):    at android.app.ActivityThread.access$500(ActivityThread.java:122)
05-25 11:52:16.630: E/AndroidRuntime(19088):    at android.app.ActivityThread$H.handleMessage(ActivityThread.java:1027)
05-25 11:52:16.630: E/AndroidRuntime(19088):    at android.os.Handler.dispatchMessage(Handler.java:99)
05-25 11:52:16.630: E/AndroidRuntime(19088):    at android.os.Looper.loop(Looper.java:132)
05-25 11:52:16.630: E/AndroidRuntime(19088):    at android.app.ActivityThread.main(ActivityThread.java:4126)
05-25 11:52:16.630: E/AndroidRuntime(19088):    at java.lang.reflect.Method.invokeNative(Native Method)
05-25 11:52:16.630: E/AndroidRuntime(19088):    at java.lang.reflect.Method.invoke(Method.java:491)
05-25 11:52:16.630: E/AndroidRuntime(19088):    at com.android.internal.os.ZygoteInit$MethodAndArgsCaller.run(ZygoteInit.java:844)
05-25 11:52:16.630: E/AndroidRuntime(19088):    at com.android.internal.os.ZygoteInit.main(ZygoteInit.java:602)
05-25 11:52:16.630: E/AndroidRuntime(19088):    at dalvik.system.NativeStart.main(Native Method)
05-25 11:52:16.630: E/AndroidRuntime(19088): Caused by: java.lang.RuntimeException: Cannot initialize Visualizer engine, error: -1
05-25 11:52:16.630: E/AndroidRuntime(19088):    at android.media.audiofx.Visualizer.<init>(Visualizer.java:182)
05-25 11:52:16.630: E/AndroidRuntime(19088):    at com.example.android.apis.media.AudioFxDemoActivity.setupVisualizerFxAndUI(AudioFxDemoActivity.java:151)
05-25 11:52:16.630: E/AndroidRuntime(19088):    at com.example.android.apis.media.AudioFxDemoActivity.onCreate(AudioFxDemoActivity.java:53)
05-25 11:52:16.630: E/AndroidRuntime(19088):    at android.app.Instrumentation.callActivityOnCreate(Instrumentation.java:1050)
05-25 11:52:16.630: E/AndroidRuntime(19088):    at android.app.ActivityThread.performLaunchActivity(ActivityThread.java:1782)
like image 919
SRam Avatar asked May 24 '12 13:05

SRam


People also ask

How do I set my EQ for best sound?

First, position speakers for best sound. Next, set equalizer controls to neutral or 0 before adjusting to your listening preference. For brighter treble, reduce mid-range and low-end frequencies. For more bass, tone down treble and mid-range frequencies.

Does Android have a built in equalizer?

On an Android phone, you will find the equalizer setting hidden in the Sound & Vibration section of the Settings app, though the exact menu location may vary depending on your device's manufacturer.

How do I get better sound quality on my Android?

Users can access these by going to “Settings -> Sound & Vibration -> Advanced -> Sound Quality and Effects.” Here you'll find an Equalizer feature with several presets as well as the option to create a custom one. Additionally, some phones have a Dolby Atmos feature at their disposal that can be turned on and off.


1 Answers

You can find equalizer in AudioFxDemo class.

And this is the link where you can find permissions to work out:

Android Visualizer implementation crash

like image 115
Abhi Avatar answered Oct 01 '22 22:10

Abhi