* alsa-utils uses incorrect format for 24 bit audio?
@ 2017-09-05 19:32 Ricard Wanderlof
2017-09-06 0:28 ` Takashi Sakamoto
0 siblings, 1 reply; 2+ messages in thread
From: Ricard Wanderlof @ 2017-09-05 19:32 UTC (permalink / raw)
To: alsa-devel
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?
/Ricard
--
Ricard Wolf Wanderlöf ricardw(at)axis.com
Axis Communications AB, Lund, Sweden www.axis.com
Phone +46 46 272 2016 Fax +46 46 13 61 30
^ permalink raw reply [flat|nested] 2+ messages in thread
* Re: alsa-utils uses incorrect format for 24 bit audio?
2017-09-05 19:32 alsa-utils uses incorrect format for 24 bit audio? Ricard Wanderlof
@ 2017-09-06 0:28 ` Takashi Sakamoto
0 siblings, 0 replies; 2+ messages in thread
From: Takashi Sakamoto @ 2017-09-06 0:28 UTC (permalink / raw)
To: Ricard Wanderlof, alsa-devel
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
^ permalink raw reply [flat|nested] 2+ messages in thread
end of thread, other threads:[~2017-09-06 0:28 UTC | newest]
Thread overview: 2+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2017-09-05 19:32 alsa-utils uses incorrect format for 24 bit audio? Ricard Wanderlof
2017-09-06 0:28 ` Takashi Sakamoto
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.