[alsa-devel] alsa-utils uses incorrect format for 24 bit audio?

Ricard Wanderlof ricard.wanderlof at axis.com
Tue Sep 5 21:32:31 CEST 2017


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


More information about the Alsa-devel mailing list