في هذا الكود 
class MainActivity : AppCompatActivity() {

    private lateinit var player: SimpleExoPlayer
    private lateinit var playButton: Button
    private lateinit var lyricsTextView: TextView
    private lateinit var startRecordingButton: Button
    private lateinit var stopRecordingButton: Button
    private var mediaRecorder: MediaRecorder? = null
    private lateinit var outputFilePath: String
    private val lyricsHandler = Handler(Looper.getMainLooper())
    private lateinit var lyricsRunnable: Runnable
    private var mediaPlayer: MediaPlayer? = null
    private lateinit var playRecordingButton: Button

    override fun onCreate(savedInstanceState: Bundle?) {
        super.onCreate(savedInstanceState)
        setContentView(R.layout.activity_main)

        playButton = findViewById(R.id.playButton)
        lyricsTextView = findViewById(R.id.lyricsTextView)
        startRecordingButton = findViewById(R.id.startRecordingButton)
        stopRecordingButton = findViewById(R.id.stopRecordingButton)

        playButton.setOnClickListener {
            initializePlayer()
            displayLyrics()
        }

        startRecordingButton.setOnClickListener {
            requestAudioPermissionAndStartRecording()
        }

        stopRecordingButton.setOnClickListener {
            stopRecording()
        }

        playRecordingButton = findViewById(R.id.playRecordingButton)
        playRecordingButton.setOnClickListener {
            playRecording()
        }

        val soundEffectsButton1 = findViewById<Button>(R.id.soundEffectButton1)
        val soundEffectsButton2 = findViewById<Button>(R.id.soundEffectButton2)
        soundEffectsButton1.setOnClickListener {
            applySoundEffect1()
        }

        soundEffectsButton2.setOnClickListener {
            applySoundEffect2()
        }
    }

    private fun initializePlayer() {
        player = SimpleExoPlayer.Builder(this).build()

        val dataSourceFactory = DefaultDataSourceFactory(
            this,
            Util.getUserAgent(this, "KaraokeApp")
        )

        val mediaSource = ProgressiveMediaSource.Factory(dataSourceFactory)
            .createMediaSource(Uri.parse("https://directsendwhats.xyz/background_music.mp3"))

                    player.setMediaSource(mediaSource)
                    player.prepare()
                    player.playWhenReady = true
    }

    private fun displayLyrics() {
        scheduleLyricsUpdate()
    }

    private fun scheduleLyricsUpdate() {
        lyricsRunnable = Runnable {
            updateLyrics()
            lyricsHandler.postDelayed(lyricsRunnable, 1000) // جدولة التحديث كل ثانية
        }
        lyricsHandler.post(lyricsRunnable)
    }

    private fun updateLyrics() {
        val currentPosition = player.currentPosition
        // استخدم currentPosition لتحديد الجزء المناسب من كلمات الأغنية
        // وقم بتحديث lyricsTextView بناءً على ذلك
    }

    private fun requestAudioPermissionAndStartRecording() {
        if (ContextCompat.checkSelfPermission(
                this,
                android.Manifest.permission.RECORD_AUDIO
            ) != PackageManager.PERMISSION_GRANTED
        ) {
            ActivityCompat.requestPermissions(
                this,
                arrayOf(android.Manifest.permission.RECORD_AUDIO),
                RECORD_AUDIO_REQUEST_CODE
            )
        } else {
            startRecording()
        }
    }

    override fun onRequestPermissionsResult(
        requestCode: Int,
        permissions: Array<out String>,
        grantResults: IntArray
    ) {
        super.onRequestPermissionsResult(requestCode, permissions, grantResults)
        if (requestCode == RECORD_AUDIO_REQUEST_CODE) {
            if (grantResults.isNotEmpty() && grantResults[0] == PackageManager.PERMISSION_GRANTED) {
                startRecording()
            } else {
                // الإذن مرفوض، يمكنك إظهار رسالة توضيحية هنا
            }
        }
    }

    private fun startRecording() {
        outputFilePath =
            "${getExternalFilesDir(Environment.DIRECTORY_MUSIC)?.absolutePath}/recording.3gp"

        mediaRecorder = MediaRecorder().apply {
            setAudioSource(MediaRecorder.AudioSource.MIC)
            setOutputFormat(MediaRecorder.OutputFormat.THREE_GPP)
            setOutputFile(outputFilePath)
            setAudioEncoder(MediaRecorder.AudioEncoder.AMR_NB)

            try {
                prepare()
            } catch (e: IOException) {
                e.printStackTrace()
            }
            start()
        }
    }

    private fun stopRecording() {
        mediaRecorder?.apply {
            stop()
            release()
            player.stop()
        }
        mediaRecorder = null
    }

    override fun onStop() {
        super.onStop()
        lyricsHandler.removeCallbacks(lyricsRunnable)
        releasePlayer()
        mediaRecorder?.apply {
            stop()
            release()
        }
        mediaRecorder = null

        mediaPlayer?.apply {
            stop()
            release()
        }
        mediaPlayer = null
    }

    private fun releasePlayer() {
        if (::player.isInitialized) {
            player.release()
        }
    }

    companion object {
        private const val RECORD_AUDIO_REQUEST_CODE = 200
    }

    private fun applySoundEffect1() {
        if (outputFilePath.isNotEmpty()) {
            mediaPlayer = MediaPlayer().apply {
                try {
                    setDataSource(outputFilePath)

                    val effect = PresetReverb(1, 0).apply {
                        preset = PresetReverb.PRESET_LARGEROOM
                    }

                    setAuxEffectSendLevel(1f)
                    attachAuxEffect(effect.id)
                    prepare()
                    start()

                    setOnCompletionListener {
                        setAuxEffectSendLevel(0f)
                        attachAuxEffect(0)
                        effect.release()
                    }
                } catch (e: IOException) {
                    e.printStackTrace()
                }
            }
        }
    }

    private fun applySoundEffect2() {
        if (outputFilePath.isNotEmpty()) {
            mediaPlayer = MediaPlayer().apply {
                try {
                    setDataSource(outputFilePath)

                    val effect = BassBoost(1, 0).apply {
                        setStrength(500)
                    }

                    setAuxEffectSendLevel(1f)
                    attachAuxEffect(effect.id)
                    prepare()
                    start()

                    setOnCompletionListener {
                        setAuxEffectSendLevel(0f)
                        attachAuxEffect(0)
                        effect.release()
                    }
                } catch (e: IOException) {
                    e.printStackTrace()
                }
            }
        }
    }

    private fun playRecording() {
        if (outputFilePath.isNotEmpty()) {
            mediaPlayer = MediaPlayer().apply {
                try {
                    setDataSource(outputFilePath)
                    prepare()
                    start()
                } catch (e: IOException) {
                    e.printStackTrace()
                }
            }
        }
    }
} عند تشغيل الصوت وبدا التسجيل وانهاء التسجيل والضغط علي المؤثرات يحدث هذا الخطا FATAL EXCEPTION: main
                                                                                                    Process: com.dm.myapplication2, PID: 9022
                                                                                                    java.lang.RuntimeException: Cannot initialize effect engine for type: 47382d60-ddd8-11db-bf3a-0002a5d5c51b Error: -3
                                                                                                    	at android.media.audiofx.AudioEffect.<init>(AudioEffect.java:543)
                                                                                                    	at android.media.audiofx.AudioEffect.<init>(AudioEffect.java:501)
                                                                                                    	at android.media.audiofx.AudioEffect.<init>(AudioEffect.java:475)
                                                                                                    	at android.media.audiofx.PresetReverb.<init>(PresetReverb.java:128)
                                                                                                    	at com.dm.myapplication2.MainActivity.applySoundEffect1(MainActivity.kt:209)
                                                                                                    	at com.dm.myapplication2.MainActivity.onCreate$lambda$4(MainActivity.kt:75)
                                                                                                    	at com.dm.myapplication2.MainActivity.$r8$lambda$Wbigeh48ug95VEh-x8UxzmQg3io(Unknown Source:0)
                                                                                                    	at com.dm.myapplication2.MainActivity$$ExternalSyntheticLambda5.onClick(Unknown Source:2)  ارجوا تعديل الكود ليعمل بدون اخطاء