7

I am trying to apply the Bass Effects programmatically by using the following code:

BassBoost bassBoost = new BassBoost(0, audioSessionId);
bassBoost.setEnabled(true);
BassBoost.Settings bassBoostSettingTemp =  bassBoost.getProperties();
BassBoost.Settings bassBoostSetting = new BassBoost.Settings(bassBoostSettingTemp.toString());
bassBoostSetting.strength = MAX_STRENGTH_FOR_BASS; // 1000
bassBoost.setProperties(bassBoostSetting);

bassBoost.setStrength((short) progress); // progress value from seek bar

But the bass effects aren't applied on the current audio session.
Please help me by showing me what's wrong.

Phantômaxx
  • 37,901
  • 21
  • 84
  • 115
Parveen
  • 241
  • 6
  • 17
  • try http://kyogs.blogspot.in/2012/09/android-audioeffect.html here you can get all effect as you need.hop its helpful to you. – kyogs Jan 08 '13 at 11:24
  • @mojmaho: the link you have give is the sample code given by developer.android.com. Here is the link: http://stuff.mit.edu/afs/sipb/project/android/docs/resources/samples/ApiDemos/src/com/example/android/apis/media/AudioFxDemo.html The questioner ask about the implementation of BassBoost. Have you any idea about it? – Shreyash Mahajan Apr 12 '13 at 03:30
  • try calling the AudioTrack or Mediaplayer object's `attachAuxEffect(bassBoost.getId())` method. And remember to call `setAuxEffectSendLevel(float level)` method too otherwise even if you attach the effect it won’t work (level is 0.0 by default) – Esses77 Mar 08 '14 at 15:17
  • @Parveen i also trying for this, did you found any solution for this? – balaji koduri Dec 24 '14 at 05:02

1 Answers1

1

Check whether it is supported or not.

bassBoost = new BassBoost(0, 0);
bassBoost.setEnabled(true);

if (bassBoost.getStrengthSupported())
{
    short word1 = bassBoost.getRoundedStrength();
    bassBoost.setStrength(word1);
}

And you can also check that whatever you're testing on supports it (it is device-dependent). You can use:

final Descriptor[] effects = AudioEffect.queryEffects();

// Determine available/supported effects 
for (final Descriptor effect : effects) {
    Log.d(TAG, effect.name.toString() + ", type: " + effect.type.toString());
}
Zar E Ahmer
  • 33,936
  • 20
  • 234
  • 300