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

[Solved] Re: Audio, Soundbylayout: how to use it at 24 bits/96 KHz



Hi Benjamin, hi All

Thanks, Benjamin, for your response ..

On Mon, Aug 17, 2009 at 12:26:58AM +0200, Benjamin Cama wrote:
> Hi,
> 
> Just guessing : for mplayer, I know there is the -srate parameter that
> can set a forced sampling rate for your sound card.

You're right, but I get this switch - IIRC - only working if I install
the attached ~/.asoundrc. Without it this option does not change
mplayer's default here - which seems to be 48000 Hz, no matter what i
feed to mplayer - and this default is pulled - just guessing here -
from maybe /usr/share/alsa/alsa.conf

> Maybe it will work, but the s24le to s16le conversion looks strange
> too ...

Actually I haven't understood the {big,little} endian sound oddities
here - I recommend a look at 'aplay -v' and play some sound file: I
guess alsa just eats any sound, whether big or little endian, and
plays it back according to the endianness it finds on the hardware -
in that case big endian.

The solution:

If I install the attached ~/asoundrc both mplayer and aplay play the
files according to the values the sound files have - the depth at which
they're played back seems to depend on the rate they're played back -
that's nearly exactly what I was looking for. With mplayer I can even
change the rate with the -srate switch .. and yes, the rate is
commented out in the attached .asoundrc ...

Please note that I don't understand why this .asoundrc works as it
does: the documentation I found on the ALSA specifics was unusable
here - in the end I tested and edited config files I found on the
Interwebs. The one attached is the result of these tests.

If you want to explore your soundcard, and what it can do - sample
rate and depth: I use alsacap for this purpose, a little tool you find
at 
http://www.volkerschatz.com/noise/alsa.html
 - it compiled here in a second or 2 ...

------------------------------------

$ ./alsacap -h
Usage: alsacap [-R] [-C <card #> [-D <device #>]]
       alsacap [-R] -d <device name> [-r <rate>|-c <# of channels>|-f <sample format>]...
ALSA capability lister.
First form: Scans one or all soundcards known to ALSA for devices, 
subdevices and parameter ranges.  -R causes a scan for recording
rather than playback devices.  The other options specify the sound
card and possibly the device by number.
Second form: Displays ranges of configuration parameters for the given
ALSA device.  Unlike with the first form, a non-hardware device may be
given.  Up to three optional command-line arguments fix the rate,
number of channels and sample format in the order in which they are
given.  The remaining parameter ranges are output.  If unique, the
number of significant bits of the sample values is output.  (Some
sound cards ignore some of the bits.)

--------------------------------------

$ ./alsacap   
*** Scanning for playback devices ***
Card 0, ID `SoundByLayout', name `SoundByLayout'
  Device 0, ID `Master', name `', 1 subdevices (1 available)
    2 channels, sampling rate 8000..96000 Hz
    Sample formats: S16_BE, S32_BE
      Subdevice 0, name `subdevice #0

-----------------------------------------

$ ./alsacap -R
*** Scanning for recording devices ***
Card 0, ID `SoundByLayout', name `SoundByLayout'
  Device 0, ID `Master', name `', 1 subdevices (1 available)
    2 channels, sampling rate 8000..96000 Hz
    Sample formats: S16_BE, S32_BE
      Subdevice 0, name `subdevice #0'

------------------------------------------

HTH

Best Regards
Wolfgang
-- 
http://heelsbroke.wordpress.com
pcm.!default {
        type plug
        slave {
                pcm "hw:0"
#                rate 96000
        }
}


Reply to: