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

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



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
_______________________________________________
Alsa-devel mailing list
Alsa-devel@xxxxxxxxxxxxxxxx
http://mailman.alsa-project.org/mailman/listinfo/alsa-devel



[Index of Archives]     [ALSA User]     [Linux Audio Users]     [Kernel Archive]     [Asterisk PBX]     [Photo Sharing]     [Linux Sound]     [Video 4 Linux]     [Gimp]     [Yosemite News]

  Powered by Linux