One of the easy ways is to implement music playback using MediaPlayer and recording using MediaRecorder. MediaRecorder's setAudioSource (MediaRecorder.AudioSource).When MIC)
is set, you can record the sound input to the microphone. At this time, if the music is being played through the speaker on the phone, the sound is recorded by microphone input. (Not recorded when using earphones) I think using these two classes is a simple way to record music and voice.
The other way is to record only the voice in the microphone, and then mix and output the music and voice to each channel during playback. Please refer to the following link for a rough flow.
© 2024 OneMinuteCode. All rights reserved.