how to play PCM sound file in Ubuntu?
Asked Answered
D

2

18

I have a PCM sound file with sample rate 16000, sample bit 16 and channel 1. I want to play it , but there's no software can do. I also tried ffplay like :

ffplay -ar 16000 -ac 1 snake.raw

But still failed. How to play the PCM sound file in Ubuntu?

Denominationalism answered 1/12, 2013 at 17:0 Comment(1)
superuser.com/questions/76665/…Plead
U
42

To use ffplay with signed 16-bit little endian raw PCM, specify -f s16le:

ffplay -f s16le -ar 16k -ac 1 snake.raw

For a stereo, 32-bit floating-point, little endian, 48 kHz file specify:

ffplay -f f32le -ar 48k -ac 2 snake.raw

For a list of supported formats for the -f option, use ffplay -formats. -ar is the sample rate and -ac is the number of channels.

Universalize answered 11/7, 2015 at 16:14 Comment(1)
Thank you, in my case it was: ffplay -f s32be -ar 22222 -ac 2 (big endian with often used 22222Hz)Metamer
T
30

You can use play/sox, which should be standard in ubuntu

play -t raw -r 16k -e signed -b 16 -c 1 snake.raw 

-r = sampling rate
-b = sampling precision (bits)
-c = number of channels
Thacher answered 18/8, 2014 at 11:36 Comment(1)
--endian is also interesting.Plead

© 2022 - 2024 — McMap. All rights reserved.