I am using android equalizer API to create a high pass filter. But even if I set every band to -1500 it does not seems to work. The audio is playing well but no eq effects. Here is my code.
private void attachEq(int audioSessionId) { Equalizer eq = new Equalizer(100,audioSessionId); short[] freqRange = eq.getBandLevelRange(); short minLvl = freqRange[0]; short maxLvl = freqRange[1]; eq.setBandLevel((short) 4,minLvl); eq.setBandLevel((short) 3,minLvl); eq.setBandLevel((short) 2,minLvl); eq.setBandLevel((short) 1,minLvl); eq.setBandLevel((short) 0,minLvl); }
I am getting the audio session-id by
at.getAudioSessionId()
where at is an already initialized AudioTrack. As I said AudioTrack is playing fine but eq doesn’t seem to have any effect.
Edit: Do I have to set band levels before I call at.play() or after? I am doing it before at.play() and it doesn’t seem to work.
Advertisement
Answer
I figured it out! I wasn’t calling eq.setEnabled(true)
.
Now it works!