#Audiocapture with timestamp android stufdio code#
Modify src/MainActivity.java file to add AudioCapture code You will use Android studio IDE to create an Android application and name it as AudioCapture under a package. To experiment with this example, you need to run this on an actual device. This example provides demonstration of MediaRecorder class to capture audio and then MediaPlayer class to play that recorded audio. This method should be called when the recorder instance is needed. This method configures the path to the file into which the recorded audio is to be stored This method specifies the audio encoder to be used This method specifies the audio format in which audio to be stored This method specifies the source of video to be recorded This method specifies the source of audio to be recorded tOutputFile(outputFile) Īfter specifying the audio source and format and its output file, we can then call the two basic methods prepare and start to start recording the audio.Īpart from these methods, there are other methods listed in the MediaRecorder class that allows you more control over audio and video recording. Now you will set the source, output and encoding format and output file. MediaRecorder myAudioRecorder = new MediaRecorder() In order to use MediaRecorder class ,you will first create an instance of MediaRecorder class. There are many ways to do that but the most common way is through MediaRecorder class.Īndroid provides MediaRecorder class to record audio or video.
Android has a built in microphone through which you can capture audio and store it, or play it in your phone.