androidffmpegandroid-ffmpegaudioeffect

How to set Values for Reverb Effects in android?


I am working on an app that has a reverb feature. I know we can achieve this feature by the PresetReverb and EnvironmentalReverb classes.

For customization, we have the EnvironmentalReverb class and I am using this class like this and effects can be notice in the video:

val eReverb = EnvironmentalReverb(1, simpleExoplayer?.audioSessionId!!)
            eReverb.reverbDelay = 5 // [0, 100] done
            eReverb.roomLevel = -1000 // [-9000, 0]
            eReverb.reverbLevel = 2000 // [-9000, 2000]
            eReverb.decayHFRatio = 1000.toShort()
            eReverb.decayTime = 10000
            eReverb.density = 1000.toShort()
            eReverb.diffusion = 1000.toShort()
            eReverb.enabled = true
            val auxEffectInfo = AuxEffectInfo(eReverb.id, 1.0F)
            simpleExoplayer?.setAuxEffectInfo(auxEffectInfo)

Problem: If we want to apply the EnvironmentalReverb values according to the PresetReverb class effects(LARGE_ROOM, LARGE_HALL, MEDIUM_ROOM, etc) then what should be the values of reverbDelay, diffusion, density, etc?


Solution

  • The EnvironmentalReverb source code refers to the OpenSL ES 1.0.1 specification.

    Pages 451-452 in that specification lists the following preset definitions:

    #define SL_I3DL2_ENVIRONMENT_PRESET_SMALLROOM \
     { -1000,-600, 1100, 830, -400, 5, 500, 10, 1000, 1000 }
    #define SL_I3DL2_ENVIRONMENT_PRESET_MEDIUMROOM \
     { -1000,-600, 1300, 830, -1000, 20, -200, 20, 1000, 1000 }
    #define SL_I3DL2_ENVIRONMENT_PRESET_LARGEROOM \
     { -1000,-600, 1500, 830, -1600, 5, -1000, 40, 1000, 1000 }
    #define SL_I3DL2_ENVIRONMENT_PRESET_MEDIUMHALL \
     { -1000,-600, 1800, 700, -1300, 15, -800, 30, 1000, 1000 }
    #define SL_I3DL2_ENVIRONMENT_PRESET_LARGEHALL \
     { -1000,-600, 1800, 700, -2000, 30, -1400, 60, 1000, 1000 }
    #define SL_I3DL2_ENVIRONMENT_PRESET_PLATE \
     { -1000,-200, 1300, 900, 0, 2, 0, 10, 1000, 750 } 
    

    The 10 values listed for each of the presets ought to correspond to the EnvironmentalReverb parameters in the following order: PARAM_ROOM_LEVEL, PARAM_ROOM_HF_LEVEL, PARAM_DECAY_TIME, PARAM_DECAY_HF_RATIO, PARAM_REFLECTIONS_LEVEL, PARAM_REFLECTIONS_DELAY, PARAM_REVERB_LEVEL, PARAM_REVERB_DELAY, PARAM_DIFFUSION, PARAM_DENSITY.