: aplay has endian issues
A NOTE has been added to this issue.
======================================================================
<https://bugtrack.alsa-project.org/alsa-bug/view.php?id=1312>
======================================================================
Reported By: ChrisWhite
Assigned To:
======================================================================
Project: ALSA - utils Issue ID: 1312 Category: aplay/arecord Reproducibility: always Severity: minor Priority: normal Status: new ====================================================================== Date Submitted: 08-05-2005 07:18 CEST Last Modified: 08-05-2005 20:09 CEST
======================================================================
Summary: aplay has endian issues
Description:
It appears that play uses BE specific formating when playing back by default. As alsa seems to have a default SND_PCM_FORMAT_S16 which switches to the correct native endian, I'm not sure why that's not used as the default instead of endian specific definitions.
======================================================================
----------------------------------------------------------------------
ChrisWhite - 08-05-05 20:01
----------------------------------------------------------------------
Here's the MPlayer relevant code btw, it seems to simply switch to Little Endian if it can't handle the format:
-------------------------------------------------
/* workaround for nonsupported formats
sets default format to S16_LE if the given formats aren't
supported */
if ((err = snd_pcm_hw_params_test_format(alsa_handler,alsa_hwparams,
alsa_format)) < 0)
{
mp_msg(MSGT_AO,MSGL_INFO,
"alsa-init: format %s are not supported by hardware,
trying default\n", af_fmt2str_short(format));
alsa_format = SND_PCM_FORMAT_S16_LE;
ao_data.format = AF_FORMAT_S16_LE;
ao_data.bps = channels * rate_hz * 2;
}-------------------------------------------------
----------------------------------------------------------------------
jcdutton - 08-05-05 20:09
----------------------------------------------------------------------
You seem to missunderstand how alsa works.
If the hardware can only do S16_LE and the audio file is S16_BE, the alsa-lib will automatically do the conversion for you e.g.
aplay -Dplug:front filename.wav
That is what the "plug" bit does. If you use -Dhw:0,0 or -Dfront it does not use the "plug" bit, so alsa will not do the format conversion and the sound will fail to play.
Issue History
Date Modified Username Field Change
======================================================================
08-05-05 07:18 ChrisWhite New Issue
08-05-05 09:30 Clemens LadischNote Added: 0005663
08-05-05 18:08 ChrisWhite Note Added: 0005669
08-05-05 18:26 Clemens LadischNote Added: 0005670
08-05-05 19:55 ChrisWhite Note Added: 0005672 08-05-05 20:01 ChrisWhite Note Added: 0005673 08-05-05 20:09 jcdutton Note Added: 0005674
======================================================================
-------------------------------------------------------
SF.Net email is Sponsored by the Better Software Conference & EXPO September 19-22, 2005 * San Francisco, CA * Development Lifecycle Practices Agile & Plan-Driven Development * Managing Projects & Teams * Testing & QA Security * Process Improvement & Measurement * http://www.sqe.com/bsce5sf