如何在Ubuntu中播放PCM声音文件?

soc*_*ket 9 linux pcm

我有一个PCM声音文件,采样率16000,采样位16和通道1.我想播放它,但没有软件可以做.我也试过像ffplay:

ffplay -ar 16000 -ac 1 snake.raw
Run Code Online (Sandbox Code Playgroud)

但仍然失败了.如何在Ubuntu中播放PCM声音文件?

san*_*tte 22

你可以使用play/ sox,这应该是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
Run Code Online (Sandbox Code Playgroud)

  • `--endian`也很有趣. (3认同)

mar*_*k4o 19

要使用ffplay带符号的16位小端原始PCM,请指定-f s16le:

ffplay -f s16le -ar 16k -ac 1 snake.raw
Run Code Online (Sandbox Code Playgroud)

有关该-f选项支持的格式列表,请使用ffplay -formats. -ar是采样率,-ac是通道数.