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