[alsa-devel] [BUG] aplay doesn't honor `-t raw` when WAVE header is detected on input

Takashi Iwai tiwai at suse.de
Mon Oct 16 13:50:10 CEST 2017


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


More information about the Alsa-devel mailing list