How to change sound frequency on Android device using kotlin

88 Views Asked by At

i have a problem, i want to change phone sound frequency like this library: https://github.com/bullheadandplato/AndroidEqualizer

i use audiomanager to be able to control the audio player but i don't know how to get the sessionId of the current audio. Everyone help me

I tried with this code

if (getArguments() != null && getArguments().containsKey(ARG_AUDIO_SESSIOIN_ID)) {
    audioSessionId = getArguments().getInt(ARG_AUDIO_SESSIOIN_ID);
    Log.e("duylt", "Check SessionId: " + audioSessionId);
}

but the returned results are all 1

1

There are 1 best solutions below

0
On

Try this:

val audioManager: AudioManager = context.getSystemService(Context.AUDIO_SERVICE) as AudioManager
val sessionId = audioManager.generateAudioSessionId()