Hi,
On Sun, Dec 12, 2021 at 08:16:57PM +0900, Marios Sioutis wrote:
Hi all,
Quick question, I was troubleshooting a 24bit USB device and got down the rabbit hole of sample formats. The device advertises itself as S24LE (4byte payload) but it appears as S32LE under alsa, something that bothered me a lot initially. However, If the conversion between the two formats is to just << 8 i.e. put a zero byte as LSB, then the two formats are essentially equivalent.
Is this actually the case? If yes, who performs the conversion? Is it on the alsa side, or the device already adds a zero byte LSB?
Thank you in advance,
Marios
I think the format of sample is 'left-justified' or 'right-padding' 24 bit in 32 bit frame. For the case, in ALSA PCM interface, [S|U]32 sample format is used with 'msbits' hardware parameter. The snd-ua101 USB driver might be an good example for the case.
* https://git.kernel.org/pub/scm/linux/kernel/git/torvalds/linux.git/tree/soun...
In detail, please refer to my previous patch:
* https://lore.kernel.org/alsa-devel/20210529033353.21641-1-o-takashi@sakamocc...
Unfortunately, as long as I know, no userspace application evaluates the msbits parameter with sample format, however in theory the conversion should be done in userspace in advance of transmission of audio data frame.
Regards
Takashi Sakamoto