0

I'am Unable to put Reverb effect on mp3 audio files for my android application and I've tried the following codes:

        mp = MediaPlayer.create(this, R.raw.audio1);
        PresetReverb pr=new PresetReverb(0,mp.getAudioSessionId());
        pr.setPreset(PresetReverb.PRESET_LARGEHALL);
        pr.setEnabled(true);
        mp.start()

        mp = MediaPlayer.create(this, R.raw.audio1);
        PresetReverb pr=new PresetReverb(1,0);
        pr.setPreset(PresetReverb.PRESET_LARGEHALL);
        mp.attachAuxEffect(pr.getId());
        mp.setAuxEffectSendLevel(1.0f);
        pr.setEnabled(true);
        mp.start();

I've also added required permissions. Anybody please help. I'm not getting any help from android Document as well.

  • Did you add MODIFY_AUDIO_SETTINGS? You need this if you are using audio session 0. – Techidiot Sep 15 '15 at 14:18
  • http://codekea.com/QGAK1GGDDjaY/android-audio-reverb-sample-app.html check these examples – Techidiot Sep 15 '15 at 14:23
  • @Bhush_Techidiot- yes i did add it.. and i've already tried that example but it's not working – Arush Verma Sep 15 '15 at 14:30
  • I am getting this error: "java.lang.RuntimeException: Unable to start activity ComponentInfo{com.anubodh.virtualtanpura/com.anubodh.virtualtanpura.MainActivity}: java.lang.RuntimeException: Cannot initialize effect engine for type: 47382d60-ddd8-11db-bf3a-0002a5d5c51b Error: -1" – Arush Verma Sep 15 '15 at 14:31
  • It might be a problem with your emulator then. 1. http://stackoverflow.com/questions/8341247/android-visualizer-audio-effects-runtime-exception-on-ice-cream-sandwich And here's a sample 2. https://github.com/android/platform_frameworks_base/blob/master/media/java/android/media/audiofx/AudioEffect.java And a working example 3. http://stackoverflow.com/questions/8595692/android-visualizer-implementation-crash – Techidiot Sep 15 '15 at 15:01
  • @Bhush_Techidiot will try running it on real device...thanks...! – Arush Verma Sep 15 '15 at 17:22
  • Let me know if that solves your issue. Will add it as answer. – Techidiot Sep 15 '15 at 17:30
  • Got any solution ? Please share it – Adeel Turk Apr 06 '16 at 06:08

0 Answers0