The microphones in Android or other mobile devices captures raw PCM sample with certain bit rate and sampling rates, but if we decides to save this captured audio pcm samples, we will not be able to play those as is using standard media players.
If we want to play those pcm using standard media players, we first have to encode it to something like aac or mp3 formats and then only it will be able to play, But within this post, we would show you how you can play the saved PCM samples using ffplay command on Ubuntu.
FFplay is a very simple and portable media player using the FFmpeg libraries and the SDL library. You can read more about ffplay command by typing “man ffplay” on ubuntu shell.
Now, lets assume you can captured the Voice samples using microphone configured to capture 16 bit PCM samples with 44.1KHz sampling frequency, and saved this file as, “raw_voice.pcm” then, on ubuntu you can play this file as,
$ ffplay -f s16le -ar 44.1k -ac 1 raw_voice.pcm
In above command, 16 represents the sample rate used to capture using microphone and 44.1 is Sampling frequency. NOTE: To properly play the audio the numbers should be same as you used for microphone configuration during capture.