[alsa-devel] question application playback

Gabriel M. Beddingfield gabrbedd at gmail.com
Sun Jan 29 16:51:27 CET 2012


On 01/29/2012 12:31 AM, Wang Xingchao wrote:
> i used tool "aplay" to "play" mp3 files sucessfully. :)
> well, in this scenario, alsa is used as data transfer interface, there
> must be mp3 decode interface in kernel layer to receive mp3 data and
> do the post work.  mp3 data is regarded as pcm data during transfer,
> so the format and rate must be specified with aplay.

1. There is no DSP done in the kernel.  That includes
    MP3 decode.  This is a hard and fast rule.  Decode
    must either be done by the hardware or userspace.
    Never in the kernel.

2. Some audio hardware is able to decode the MP3
    directly.  Since I've never seen/used one, I
    don't know how its driver would work or how
    to set the hw_params... or if ALSA even supports
    passing this format to the audio device.

3. aplay is able to do some format conversion. For
    example, `man aplay` shows that it supports MPEG
    decode.

Conclusion:  If you can set your hw_params to do SND_PCM_FORMAT_MPEG, 
then the hardware is doing the MPEG decode.  Most cards/drivers will 
reject this, though... in which case you have to do the decode yourself 
with something like liblame or libmpg123.

-gabriel



More information about the Alsa-devel mailing list