The rate parameter in asound.conf

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

 



I have some sound files which were playing at the wrong sample rate (the pitch 
was about a step high and the speed was elevated).  The sample rate of the 
files is 88.2 kHz.  I believe that they were playing at 96 kHz, judging from 
the pitch error.  My output device is HDA Intel PCH.

I found that I could fix the problem by augmenting my /etc/asound.conf file with 
a rate specification:

pcm.!default {
    type hw
    card 0
    rate 192000
}
ctl.!default {
    type hw
    card 0
}

However, I do not understand what this change actually does.  When I play one 
of the sound files now and then do

cat /proc/asound/card0/pcm0p/sub0/hw_params

I see that rate is 192000.  In fact, I see that same value for rate regardless 
of the sample rate of the sound file.  This observation is true whether I play 
using

gst-launch-0.10 playbin2 uri=file:///home/lubuntu/09.ogg

or play (sox).  The change that I made to asound.conf must have specified that 
the sample rate be converted to 192000.  However, I understood that "type hw" 
meant that ALSA would send a file directly to the sound device without any 
processing, so why is the conversion happening and where?

I tested asound.conf with other values for rate.  44100, 48000, 96000, and 
192000 all work, and the value in hw_params for sample rate always 
corresponds.  When I specify 88200, the play command fails with "invalid 
argument".

I also tried speaker-test.  When I run the command

speaker-test -D hw:CARD=PCH,DEV=0 -c2 -r 48000

the sample rate that I read in hw_params corresponds to the value I specify in 
the command -- except when I specify 88200, which produces an "invalid 
argument" error.  Why is the sample-rate conversion not happening for this 
command although it is happening for the play commands?  That is, when I 
specify 192000 in asound.conf, I get 192000 regardless of the sample rate of 
the sound file I play, but with speaker-test I get the value that I specify on 
the command line regardless of what I put in asound.conf.  And am I supposed 
to believe that HDA Intel PCH is not capable of handling a sample rate of 88.2 
kHz?

The system is running Ubuntu 12.04 or 13.10 with GStreamer version 0.10 or 
1.2.0.

I would like for the DAC to run at the sample rate specified by the sound file 
so that the samples it receives are exactly the samples in the sound file.

------------
Jeffrey Barish

------------------------------------------------------------------------------
Is your legacy SCM system holding you back? Join Perforce May 7 to find out:
• 3 signs your SCM is hindering your productivity
• Requirements for releasing software faster
• Expert tips and advice for migrating your SCM now
http://p.sf.net/sfu/perforce
_______________________________________________
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