3

My question is simple: what is the default number of the bands provided by the built-in android equalizer? Also, what is the guaranteed minimum number of bands?

As far as I researched, the answer appears to be 5, but it is not very well documented. However, testing it on my devices, which is currently available, I got the following result:

  • HTC Desire S running android 2.3.5: 5 bands
  • Sony Xperia Tipo running android 4.0.x: 5 bands
  • however, Nexus 4 running Android 4.3.1: 6 bands

The way I get theese numbers is the following:

MediaPlayer mp=new MediaPlayer(this);
/* some initialization */
Equalizer eq=new Equalizer(0, mp.getAudioSessionId());
short bands=eq.getNumberOfBands();

So, on some devices, I may be able to get more bands, but the minimum number is 5?

Also, is that a good approach that I render the UI part of the equalizer dynamically, depending on how much bands the current device has, and then let the user set his own preferences?

Thanks in advance!

hundeva
  • 1,058
  • 14
  • 30

3 Answers3

4

I can't tell the number of bands of device. It is hardware dependent. Samsung galaxy have 13 equalizer bands and some devices have greater than it.

You can simply create any number of bands programamtically.

Equalizer eq=new Equalizer(0, mp.getAudioSessionId());
short bands=eq.getNumberOfBands();
LinearLayout parentViewToAllEqualizerSeekBars = findViewById...
for(int i=0;i<(int)bands.length;i++)
{
//create seekbar programmatically and set it min max and add to the view
Seekbar seek = new SeekBar(this);
seek.min(equalizerMinLevel....)
seek.max(equalizerMaxLevel..)
parentViewToAllEqualizerSeekBars .addView(seek);
}

Now it will work on all devices.Whether it has band less than 5 or greater than 13.

Note:

Also check whether equalizer!=null must

Zar E Ahmer
  • 33,936
  • 20
  • 234
  • 300
3

I do not think there is a default number of bands, and you should not build your application assuming there is a default/fixed number of bands.

Definitely you will have to render your UI equalizer dynamically, based on device number of bands.

Ovidiu Latcu
  • 71,607
  • 15
  • 76
  • 84
0

Because of low reputation i have to tell it to you here

Maximum number of bands are 8, I have created 8 seekbar and only show seekbar ==numberOfBands

How to implement Equalizer in android

Community
  • 1
  • 1
Xar-e-ahmer Khan
  • 1,314
  • 15
  • 23