Re: cat sound.wav > /dev/dsp Not Working

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

 



On Mon, 21 Dec 2009, Geoffrey Crowther wrote:

> Sergei, Bill,
>
> Thankyou for your response to my query.  After I sent this email I tried the same thing with Logitech V10 USB speakers rather than the C-Media USB headphones.  The same wav file gets played successfully (same machine, same kernel) doing cat sound.wav > /dev/dsp.  Your second point though about number of bits/endianess etc could be an issue.  The sound I am hearing could be white noise but its not continuous and it sounds like a brief clicking noise. Will try and change the number of bits, endianess etc to see if I can get some better results.  Any further comments would be most welcome.

The issue is that when you pipe the stream to /dev/dsp, /dev/dsp is set up for
a certain number of channels, bits per second, etc. If you are lucky and it is
two channel, 16bit, 44100 bps, and the header on the wave file is a multiple
of 4 bytes long, and the endianness is right, then the wave file will create
sound. But this is NOT the way to test if anything works. You should either
hear music, or white noise. A brief click suggests that the header is being
sent ( ie some 10 or so bytes) which produces 1/10000 sec of noise, but
nothing else. Ie your wave file is empty.

Now, why do you want to play through oss? alsa will play .wav files fine
(aplay nameoffile.wav).

If you told us what you wanted to do rather than what your think is the
solution to your problem, perhaps we could be more helpful.

Whatever it is you NEVER want to play a wav file by doing cat
file.wav>/dev/dsp.



>
> Cheers,
>
> Geoff Crowther
>
> -----Original Message-----
> From: Sergei Steshenko [mailto:steshenko_sergei@xxxxxxx]
> Sent: Tuesday, 22 December 2009 6:28 AM
> To: Geoffrey Crowther
> Cc: alsa-user@xxxxxxxxxxxxxxxxxxxxx
> Subject: Re:  cat sound.wav > /dev/dsp Not Working
>
> On Sun, 20 Dec 2009 20:50:28 -0800
> Geoffrey Crowther <gcrowther@xxxxxxxxxx> wrote:
>
>> Hello,
>>
>> Want to use OSS emulation through /dev/dsp for playing wav files.  As a simple test to start with I attempt the following:-
>>
>> cat sound.wav > /dev/dsp
>>
> [snip]
>
> WAV file is not a PCM stream, so even after you're done fixing AOSS problems
> this won't work as expected.
>
> Use 'sox' or 'ecasound' to convert your WAV file to proper (number of bits,
> endianness, etc.) PCM stream which is written to stdout and pipe it into
> /dev/dsp.
>
> Regards,
>  Sergei.
>

-- 
William G. Unruh   |  Canadian Institute for|     Tel: +1(604)822-3273
Physics&Astronomy  |     Advanced Research  |     Fax: +1(604)822-5324
UBC, Vancouver,BC  |   Program in Cosmology |     unruh@xxxxxxxxxxxxxx
Canada V6T 1Z1     |      and Gravity       |  www.theory.physics.ubc.ca/

------------------------------------------------------------------------------
This SF.Net email is sponsored by the Verizon Developer Community
Take advantage of Verizon's best-in-class app development support
A streamlined, 14 day to market process makes app distribution fast and easy
Join now and get one step closer to millions of Verizon customers
http://p.sf.net/sfu/verizon-dev2dev 
_______________________________________________
Alsa-user mailing list
Alsa-user@xxxxxxxxxxxxxxxxxxxxx
https://lists.sourceforge.net/lists/listinfo/alsa-user

[Index of Archives]     [ALSA Devel]     [Linux Audio Users]     [Fedora Users]     [Fedora Desktop]     [Fedora SELinux]     [Big List of Linux Books]     [Yosemite News]     [Yosemite Photos]     [KDE Users]     [Fedora Tools]

  Powered by Linux