How to play raw PCM voice/audio files using ffplay on Ubuntu ?

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.

Subscribe with Valid Email Id to receive updates in Inbox. ( Secured by Google FeedBurner )


Related :   Create a bootable USB pen drive on Ubuntu

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.


Leave a Comment

Android Android Build system Android Commands Android Java Applications Application Libraries Application Stack / User Interface Bash / Shell Scripts Bluetooth driver Cloud Technologies Commands and Packages Compilation Content Management System Core Kernel C Programs Development & Build Development, Debugging and Performance Tools Development Environment Setup Django & REST Api Errors & Failures Git Hardware Platforms HTML JAVA Programs Linux, OS Concepts and Networking Linux Device Drivers Linux Host, Ubuntu, SysAdmin Linux Kernel Linux Networking Middleware Libraries, HAL Multimedia Audio, Video, Images NDK / Middleware / HAL OS Concepts PHP Programming Languages Scripting and Automation Search Engine Optimisation ( SEO ) Social Media Source Code Management ( SCM ) System Administration, Security Testing and Debugging Uncategorized Web design and development Website Hosting Wordpress Yocto / Bitbake / Openembedded