0

I'm trying to make application can record my voice from mic built-in and music from android device at the same time. while playing song it should display lyrics also please help me out i need to add in my app.!

it should show me lyrics while playing song.

thank you for your replay in advance.

Community
  • 1
  • 1
  • i have created a media player, now i have to display lyrics of the song how to display can u give me any idea for that. – abdul khadar Sep 15 '14 at 07:34
  • You haven't said anything about what lyrics format you're using. I suggest that you use google or some other search engine to find information on the lyrics format(s) you plan on using. – Michael Sep 15 '14 at 07:38

1 Answers1

3

For the lyrics part, while there are many ways to implement it, one way is to store phrases from your lyrics in an arraylist of strings and display each phrase at its specific time while the song is playing. Use Media Player getCurrentPosition() to get the current playback time and display lyrics from your arraylist at the time it should appear on the screen. Further develop your algorithms to make it more efficient but you get the idea..

For the music playing and recording part you should use Media Player and Media Recorder. There are other ways to play and record audio but they are more complicated. So,

Media Player example:

Uri myUri = ....; // initialize Uri here
MediaPlayer mediaPlayer = new MediaPlayer();
mediaPlayer.setAudioStreamType(AudioManager.STREAM_MUSIC);
mediaPlayer.setDataSource(getApplicationContext(), myUri);
mediaPlayer.prepare();
mediaPlayer.start();

more details here Media Player


Media Recorder example:

MediaRecorder recorder = new MediaRecorder();
 recorder.setAudioSource(MediaRecorder.AudioSource.MIC);
 recorder.setOutputFormat(MediaRecorder.OutputFormat.THREE_GPP);
 recorder.setAudioEncoder(MediaRecorder.AudioEncoder.AMR_NB);
 recorder.setOutputFile(PATH_NAME);
 recorder.prepare();
 recorder.start();   // Recording is now started
 ...
 recorder.stop();
 recorder.reset();   // You can reuse the object by going back to setAudioSource() step
 recorder.release(); // Now the object cannot be reused

more details here: Media Recorder

Good luck!!

mnaa
  • 416
  • 4
  • 12