All of lore.kernel.org
 help / color / mirror / Atom feed
From: Takashi Sakamoto <o-takashi@sakamocchi.jp>
To: Marios Sioutis <smarios@jaist.ac.jp>
Cc: alsa <alsa-devel@alsa-project.org>
Subject: Re: S24LE and S32LE format equivalency
Date: Sun, 12 Dec 2021 20:51:17 +0900	[thread overview]
Message-ID: <YbXiNdYIp99Df47Q@workstation> (raw)
In-Reply-To: <2a4907ee-96d2-9969-de47-80b77b7444d1@jaist.ac.jp>

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/sound/usb/misc/ua101.c#n615

In detail, please refer to my previous patch:

 * https://lore.kernel.org/alsa-devel/20210529033353.21641-1-o-takashi@sakamocchi.jp/

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

  reply	other threads:[~2021-12-12 11:52 UTC|newest]

Thread overview: 4+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2021-12-12 11:16 S24LE and S32LE format equivalency Marios Sioutis
2021-12-12 11:51 ` Takashi Sakamoto [this message]
2021-12-12 13:03   ` Marios Sioutis
2021-12-12 13:40     ` Takashi Sakamoto

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=YbXiNdYIp99Df47Q@workstation \
    --to=o-takashi@sakamocchi.jp \
    --cc=alsa-devel@alsa-project.org \
    --cc=smarios@jaist.ac.jp \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.