[alsa-devel] [BUG] aplay doesn't honor `-t raw` when WAVE header is detected on input
Hello,
I ran into a problem on how alsa-utils's aplay command handles `-t` option when I was trying to play a PCM WAVE file in loop, using following command:
( while true; do cat audio.wav; done ) | aplay -t raw -f S16_LE -r 44100 -c 2
An "audio.wav" can be any 44100 Hz 16-bit stereo PCM WAVE file, and `-t raw` was specially specified to make aplay reject length information in the header. However, once the command is run, first line of the output would read:
Playing WAVE 'stdin' : Signed 16 bit Little Endian, Rate 44100 Hz, Stereo
Which shows that aplay still read the input as WAVE format, despite the `-t raw` option being explicitly specified. And you would notice that the audio *does not loop*. Instead, it will play just once, followed by silence.
However, if WAVE header was stripped out (or corrupted), aplay would now treat the input as raw audio stream, and play a continuously repeated sound as expected:
( while true; do dd if=audio.wav of=/dev/stdout ibs=44 skip=1; done ) | \ aplay -t raw -f S16_LE -r 44100 -c 2
The first line of output would also show the stream as "raw data" too:
Playing raw data 'stdin' : Signed 16 bit Little Endian, Rate 44100 Hz, Stereo
This problem exists on the latest alsa-utils 1.1.4, as well as the older 1.0.25 which came with my GNU/Linux distribution; though I'm not certain whether this is also applicable to other file format (like Sun .AU) or not.
Please investigate.
Regards, Nutchanon Wetchasit
alsa-utils: 1.1.4 (source distribution) libasound: 1.1.4 (source distribution) System: Debian GNU/Linux 7.0 "Wheezy" i386
P.S. The "audio.wav" I used in my testing is a siren sound generated by Sox:
sox -b 16 -c 2 -e signed-integer -r 44100 -n audio.wav \ synth 0.5 sine 800 gain -6 : synth 0.5 sine 600 gain -6
On Sun, 15 Oct 2017 17:41:52 +0200, Nutchanon Wetchasit wrote:
Hello,
I ran into a problem on how alsa-utils's aplay command handles `-t` option when I was trying to play a PCM WAVE file in loop, using following command:
( while true; do cat audio.wav; done ) | aplay -t raw -f S16_LE -r 44100 -c 2
An "audio.wav" can be any 44100 Hz 16-bit stereo PCM WAVE file, and `-t raw` was specially specified to make aplay reject length information in the header. However, once the command is run, first line of the output would read:
Playing WAVE 'stdin' : Signed 16 bit Little Endian, Rate 44100 Hz, Stereo
Which shows that aplay still read the input as WAVE format, despite the `-t raw` option being explicitly specified. And you would notice that the audio *does not loop*. Instead, it will play just once, followed by silence.
However, if WAVE header was stripped out (or corrupted), aplay would now treat the input as raw audio stream, and play a continuously repeated sound as expected:
( while true; do dd if=audio.wav of=/dev/stdout ibs=44 skip=1; done ) | \ aplay -t raw -f S16_LE -r 44100 -c 2
The first line of output would also show the stream as "raw data" too:
Playing raw data 'stdin' : Signed 16 bit Little Endian, Rate 44100 Hz, Stereo
This problem exists on the latest alsa-utils 1.1.4, as well as the older 1.0.25 which came with my GNU/Linux distribution; though I'm not certain whether this is also applicable to other file format (like Sun .AU) or not.
Please investigate.
Regards, Nutchanon Wetchasit
alsa-utils: 1.1.4 (source distribution)
Try the git version of alsa-utils. This issue should have been already addressed along with the code refactoring.
thanks,
Takashi
2017-10-16 18:50 GMT+07:00, Takashi Iwai tiwai@suse.de:
Try the git version of alsa-utils. This issue should have been already addressed along with the code refactoring.
thanks,
Takashi
Yes, using current Git version fixed the problem. Thank you!
Though, this version doesn't build out of the box on my machine; it failed in `autoheader` preprocessing step, which needs a manual edit in `configure.ac` to work around:
configure.ac:422: error: `po/Makefile.in' is already registered with AC_CONFIG_FILES. ../../lib/autoconf/status.m4:288: AC_CONFIG_FILES is expanded from... configure.ac:422: the top level autom4te: /usr/bin/m4 failed with exit status: 1 autoheader: '/usr/bin/autom4te' failed with exit status: 1
The problem seems to be the `po/Makefile.in` argument being added into parameter list of `AC_OUTPUT()` macro call in `configure.ac` for *two times* (instead of just once) by some step in preprocessing before `autoheader` invocation- probably the `gettextize`.
The workaround in my case is removing an extraneous second instance of "po/Makefile.in" in `configure.ac` before running `autoheader` and the rest of preprocessing procedure. (I'm using the manual preprocessing steps listed in "Compilation from git sources" section of the `INSTALL` file)
I will open a separate thread to report once I collected more information.
Regards, Nutchanon Wetchasit
alsa-utils: v1.1.4-9-gf72a296 (git 26-Sep-2017) libasound: 1.1.4 (source distribution) autoconf: 2.69 (debian) automake: 1.11.6 (debian) gettext: 0.18.1 (debian) System: Debian GNU/Linux 7.0 "Wheezy" i386
On Thu, 19 Oct 2017 08:36:41 +0200, Nutchanon Wetchasit wrote:
2017-10-16 18:50 GMT+07:00, Takashi Iwai tiwai@suse.de:
Try the git version of alsa-utils. This issue should have been already addressed along with the code refactoring.
thanks,
Takashi
Yes, using current Git version fixed the problem. Thank you!
Though, this version doesn't build out of the box on my machine; it failed in `autoheader` preprocessing step, which needs a manual edit in `configure.ac` to work around:
configure.ac:422: error: `po/Makefile.in' is already registered with AC_CONFIG_FILES. ../../lib/autoconf/status.m4:288: AC_CONFIG_FILES is expanded from... configure.ac:422: the top level autom4te: /usr/bin/m4 failed with exit status: 1 autoheader: '/usr/bin/autom4te' failed with exit status: 1
The problem seems to be the `po/Makefile.in` argument being added into parameter list of `AC_OUTPUT()` macro call in `configure.ac` for *two times* (instead of just once) by some step in preprocessing before `autoheader` invocation- probably the `gettextize`.
The workaround in my case is removing an extraneous second instance of "po/Makefile.in" in `configure.ac` before running `autoheader` and the rest of preprocessing procedure. (I'm using the manual preprocessing steps listed in "Compilation from git sources" section of the `INSTALL` file)
I will open a separate thread to report once I collected more information.
Please try "autoreconf -fi" and configure instead of gitcompile. This may work more reliably with the decent version of auto-tools.
Takashi
participants (2)
-
Nutchanon Wetchasit
-
Takashi Iwai