如何在 android 中设置混响效果值?
How to set Values for Reverb Effects in android?
我正在开发一款具有混响功能的应用程序。我知道我们可以通过 PresetReverb 和 EnvironmentalReverb classes.
实现此功能
对于自定义,我们有 EnvironmentalReverb class,我正在使用它 class,效果可以在视频中看到:
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)
问题:如果我们想根据 PresetReverb class 效果(LARGE_ROOM、LARGE_HALL、MEDIUM_ROOM 等)应用 EnvironmentalReverb 值,那么应该是什么reverbDelay、扩散、密度等值?
EnvironmentalReverb source code refers to the OpenSL ES 1.0.1 specification.
该规范中的第 451-452 页列出了以下预设定义:
#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 }
为每个预设列出的 10 个值应该按以下顺序对应于 EnvironmentalReverb
参数: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
.
我正在开发一款具有混响功能的应用程序。我知道我们可以通过 PresetReverb 和 EnvironmentalReverb classes.
实现此功能对于自定义,我们有 EnvironmentalReverb class,我正在使用它 class,效果可以在视频中看到:
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)
问题:如果我们想根据 PresetReverb class 效果(LARGE_ROOM、LARGE_HALL、MEDIUM_ROOM 等)应用 EnvironmentalReverb 值,那么应该是什么reverbDelay、扩散、密度等值?
EnvironmentalReverb source code refers to the OpenSL ES 1.0.1 specification.
该规范中的第 451-452 页列出了以下预设定义:
#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 }
为每个预设列出的 10 个值应该按以下顺序对应于 EnvironmentalReverb
参数: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
.