From: Takashi Sakamoto <o-takashi@sakamocchi.jp>
To: Ricard Wanderlof <ricard.wanderlof@axis.com>,
alsa-devel <alsa-devel@alsa-project.org>
Subject: Re: alsa-utils uses incorrect format for 24 bit audio?
Date: Wed, 6 Sep 2017 09:28:15 +0900 [thread overview]
Message-ID: <e2ffedd4-a1db-a76b-3bb0-598aa352a74f@sakamocchi.jp> (raw)
In-Reply-To: <alpine.DEB.2.11.1709052122100.24087@lnxricardw1.se.axis.com>
Hi,
On Sep 6 2017 04:32, Ricard Wanderlof wrote:
> When attempting to use arecord to capture audio from a 24 bit source, and
> create a 24-bit .wav file I ran into the problem that the resulting file
> does not seem valid. Looking closer at the contents, it appears that
> arecord writes the 32-bit S24_LE samples verbatim to the file, and sets
> the number of bits per sample specifier to 24 in the .wav header, at the
> same time as it sets the 'block align' to 4 which I suppose is logical,
> although normally the block align corresponds to the frame size (in bytes)
> for the sample size specified in the bits per sample specifier.
>
> A number of utilities and applications I tried refused to play the file
> back properly, including Audacity, VLC, sox and kwave, so I'm guessing the
> format written by arecord is not valid in this case. 24 bit audio as
> exported from Audacity for instance in reality corresponds to the ALSA
> S24_3LE format, i.e. the data is sent with no padding (resulting in a .wav
> 'block align' specifier of 3 for a mono stream).
>
> Is this a known problem with arecord/aplay, or is it the other
> applications which have been less than accurate when implementing .wav
> file standard?
Would you please dump headers of RIFF/Wave format file with the captured
samples? Like:
$ hexdump -C /tmp/test.wav | head -n5
00000000 52 49 46 46 70 31 00 00 57 41 56 45 66 6d 74 20
|RIFFp1..WAVEfmt |
00000010 10 00 00 00 01 00 01 00 a0 0f 00 00 80 3e 00 00
|.............>..|
00000020 04 00 18 00 64 61 74 61 28 31 00 00 00 00 00 00
|....data(1......|
00000030 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00
|................|
*
For confirmation, when capturing any samples, please add '-v' option to
arecord command line to dump the type of handled samples. Like:
$ LANG=C arecord -v -D plughw:0,0 -t wav -f S24_LE /tmp/hoge.wav
Recording WAVE '/tmp/hoge.wav' : Signed 24 bit Little Endian, Rate 8000
Hz, Mono
Plug PCM: Rate conversion PCM (48000, sformat=S24_LE)
Converter: libspeex (external)
Protocol version: 10002
Its setup is:
stream : CAPTURE
access : RW_INTERLEAVED
format : S24_LE
...
Regards
Takashi Sakamoto
prev parent reply other threads:[~2017-09-06 0:28 UTC|newest]
Thread overview: 2+ messages / expand[flat|nested] mbox.gz Atom feed top
2017-09-05 19:32 alsa-utils uses incorrect format for 24 bit audio? Ricard Wanderlof
2017-09-06 0:28 ` Takashi Sakamoto [this message]
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=e2ffedd4-a1db-a76b-3bb0-598aa352a74f@sakamocchi.jp \
--to=o-takashi@sakamocchi.jp \
--cc=alsa-devel@alsa-project.org \
--cc=ricard.wanderlof@axis.com \
/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 a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).