Re: aucat can't seem to properly play a 24-bit 44.1kHz stdout of flac -d

From: Alexandre Ratchov <alex_at_caoua.org>
Date: Mon, 23 May 2022 09:45:58 +0200
On Mon, May 23, 2022 at 02:21:11PM +0800, Job Bautista wrote:
> I'm using Devuan GNU/Linux (testing branch) and its packaging of sndio
> (which comes from Debian).
> 
> My sndiod flags are: -L 0.0.0.0 -m play,mon -e s24
> 
> Setting -e to s16 or s32, or omitting -e doesn't help the problem I will
> explain shortly below. Also, weirdly if I set sndiod's format encoding to
> s24, my /proc/asound/card0/pcm0p/sub0/hw_params says that the format is
> S32_LE. But anyway...
> 
> I'm trying to make aucat play flac's stdout of its decoding of a 24-bit,
> 44.1kHz FLAC file, but it's only returning noise to me, even if I specify
> aucat's input format as suggested in this email thread.[1] 16-bit FLACs work
> fine in this setup though. And if I decode the 24-bit FLAC first to a file,
> then make aucat play from there, it plays it properly. It's only when I try
> to use the stdout setup it fails. Weird.
> 
> Here's the exact command-line:
> 
> $ flac -dcs bf3.flac | aucat -e s24 -r 44100 -i -
> 

Hi,

First, flac produces a .wav file to stdout (which has a header) while
aucat expects raw samples on stdin.  In turn, it starts playing junk
(the .wav header) then may start playing unaligned with the first
sample which results in noise.

The "s24" strings means signed 24-bit samples stored in 4-byte words
(i.e. the smalles power of two large enough to hold the 24 bits).
While flac produces 24-bit samples in 3-byte packets, not 4-byte
words. The corresponding encoding name is s24le3

By forcing flac to output raw samples and using s24le3, this works:

flac -dc --force-raw --endian=little --sign=signed bf3.flac | aucat -r 44100 -e s24le3 -i -

> 
> Here's what aucat -dd tells me:
> 
> stdin,pst=cfg: play, chan 0:1, 44100Hz, s24le4msb, vol 32768
> default: 44100Hz, play 0:1, 36 blocks of 441 frames
> stdin,pst=cfg: allocated 15876 frame buffer
> cmap: nch = 2, ostart = 0, onext = 0, istart = 0, inext = 0
> dec: s24le4msb, 2 channels
  ^^^^^^^^^^^^^^

s -> signed
24 -> 24 bits of data
le -> little endian byte order
4 -> 4-byte packets
msb -> data aligned in most significant bits


> 
> Perhaps the "3bytes" may be throwing off aucat? I don't know, I'm not that
> well-versed with audio. If you need more information, please tell me. Thanks
> 

yes!
Received on Mon May 23 2022 - 09:45:58 CEST

This archive was generated by hypermail 2.3.0 : Tue May 24 2022 - 01:34:06 CEST