alsa-project/alsa-utils issue #308 was opened from yoshihisa-yamamoto-re:
My environment is alsa-utils version : 1.2.14 (Debian trixie)
I tried to record and play PCM audio as S24_LE format over alsa as follows: ``` arecord -f S24_LE out.wav aplay out.wav ``` However, the audio turned into noise and did not seem to play properly.
This problem does **not** seem to occur when using alsa-utils version 1.2.9 (Ubuntu 24.04 LTS). Searching through the commits, I found the closed issue https://github.com/alsa-project/alsa-utils/pull/260.
From reading the source, it appears that the header information has been rewritten, so I dumped it to check, and it looks like this:
hexdump of wav created with alsa-utils version 1.2.14 : ``` 00000000 52 49 46 46 24 e2 04 00 57 41 56 45 66 6d 74 20 |RIFF$...WAVEfmt | 00000010 10 00 00 00 01 00 01 00 40 1f 00 00 00 7d 00 00 |........@....}..| 00000020 04 00 20 00 64 61 74 61 00 e2 04 00 e6 67 8d ff |.. .data.....g..| 00000030 c8 fd 8e ff 0c 8e 90 ff c6 18 92 ff 0a 9e 93 ff |................| 00000040 ec 1d 95 ff 7e 98 96 ff d2 0d 98 ff fd 7d 99 ff |....~........}..| 00000050 10 e9 9a ff 1c 4f 9c ff 35 b0 9d ff 6b 0c 9f ff |.....O..5...k...| 00000060 cf 63 a0 ff 74 b6 a1 ff 68 04 a3 ff be 4d a4 ff |.c..t...h....M..| 00000070 86 92 a5 ff cf d2 a6 ff a9 0e a8 ff 25 46 a9 ff |............%F..| ```
hexdump of wav created with alsa-utils version 1.2.9 : ``` 00000000 52 49 46 46 24 e2 04 00 57 41 56 45 66 6d 74 20 |RIFF$...WAVEfmt | 00000010 10 00 00 00 01 00 01 00 40 1f 00 00 00 7d 00 00 |........@....}..| 00000020 04 00 18 00 64 61 74 61 00 e2 04 00 17 3d fe ff |....data.....=..| 00000030 3e 3d fe ff 86 41 fe ff cb 47 fe ff 3b 46 fe ff |>=...A...G..;F..| 00000040 10 47 fe ff e3 4d fe ff 66 4f fe ff 8d 50 fe ff |.G...M..fO...P..| 00000050 be 4f fe ff 40 58 fe ff e7 5b fe ff 27 60 fe ff |.O..@X...[..'`..| 00000060 f9 60 fe ff ce 61 fe ff ce 63 fe ff d3 68 fe ff |.`...a...c...h..| 00000070 83 6f fe ff 84 6c fe ff 22 73 fe ff 91 6d fe ff |.o...l.."s...m..| ``` As the change in Commit 9cdcbe0e932b97fac88a6195f87647159a6c7194, the header information has changed BitsPerSample (bit_p_spl) from 24bit to 32bit (0x22-0x23). If I change this header info and treat the 1.2.14 wav as 24-bit per sample as before, the audio seems to play correctly. I don't have the correct information for S24_LE format, so I don't know if the header information is wrong or if I should modify the arecord to match this 32-bit.
Issue URL : https://github.com/alsa-project/alsa-utils/issues/308 Repository URL: https://github.com/alsa-project/alsa-utils