[alsa-devel] [usb-audio] M-Audio FastTrack Pro giving invalid sample rates
Lasse Kärkkäinen
tronic+8nhy at trn.iki.fi
Sun Sep 9 08:21:38 CEST 2007
This bug has been around for years...
ALSA seems to think that the card supports a wide range of sampling
rates, but it does not manage to set them in practice. I do not know
which is faulty, ALSA rate setting or the USB info sent by the device,
but the problem needs to be fixed.
I did some measurements with the alsarate program, attached to my other
post (subject: ALSA C++ API).
Using bConfigurationValue=1 and measuring the actual rate with alsarate,
I get
>>> Testing playback
Opening ALSA device hw:0,1 at 44100 Hz.
Got 44100 Hz, 2 channels, period 1.02 ms.
96.27 seconds, measured rate 45807 Hz.
>>> Testing capture
Opening ALSA device hw:0,1 at 44100 Hz.
Got 44100 Hz, 2 channels, period 1.02 ms.
97.29 seconds, measured rate 45330 Hz.
As expected, 44.1 kHz works. The measured rate seems a bit higher than
it should be, but I assume that this is an alsarate inaccuracy rather
than an actual phenomenon.
>>> Testing playback
Opening ALSA device hw:0,1 at 48000 Hz.
Got 44100 Hz, 2 channels, period 1 ms.
96.27 seconds, measured rate 45808 Hz.
>>> Testing capture
Opening ALSA device hw:0,1 at 48000 Hz.
Got 48000 Hz, 2 channels, period 1 ms.
105.89 seconds, measured rate 45330 Hz.
Using 48 kHz for playback is not possible, the
snd_pcm_hw_params_rate_near returns a new rate of 44.1 kHz. This is all
fine and the measured rate still is around 44.1 kHz as it should.
In the capture part, we see the first problem: rate_near returned 48
kHz, but the measured value hasn't changed. So, the application thinks
that it is recording at 48 kHz, but ALSA only gives it data at 44.1 kHz.
This is a bug in ALSA.
>>> Testing playback
Opening ALSA device hw:0,1 at 8000 Hz.
Got 44100 Hz, 2 channels, period 1.02 ms.
96.27 seconds, measured rate 45808 Hz.
>>> Testing capture
Opening ALSA device hw:0,1 at 8000 Hz.
Got 8000 Hz, 2 channels, period 2 ms.
17.66 seconds, measured rate 45309 Hz.
Trying to use 8 kHz yields similar results to the 48 kHz test. No
problems with playback, but the capture part reports that it is using 8
kHz, even though it really uses 44.1 kHz.
>>> Testing playback
Opening ALSA device hw:0,1 at 96000 Hz.
Got 44100 Hz, 2 channels, period 1.02 ms.
96.27 seconds, measured rate 45808 Hz.
>>> Testing capture
Opening ALSA device hw:0,1 at 96000 Hz.
Got 48000 Hz, 2 channels, period 1 ms.
105.89 seconds, measured rate 45330 Hz.
96 kHz makes little difference. Now the capture rate is reported to be
48 kHz, but the actual rates are still always 44.1 kHz.
That was all done using the default configuration. When using the other
configuration, bConfigurationValue=2, the following results are gathered:
>>> Testing playback
Opening ALSA device hw:0,1 at 44100 Hz.
Got 44100 Hz, 2 channels, period 1.02 ms.
96.27 seconds, measured rate 45808 Hz.
>>> Testing capture
Opening ALSA device hw:0,1 at 44100 Hz.
Got 44100 Hz, 2 channels, period 1.02 ms.
97.29 seconds, measured rate 45330 Hz.
44.1 kHz is identical to that in the other configuration.
>>> Testing playback
Opening ALSA device hw:0,1 at 48000 Hz.
Got 48000 Hz, 2 channels, period 1 ms.
96.29 seconds, measured rate 49849 Hz.
>>> Testing capture
Opening ALSA device hw:0,1 at 48000 Hz.
Got 48000 Hz, 2 channels, period 1 ms.
97.29 seconds, measured rate 49339 Hz.
48 kHz now works properly for both playback and capture (note: measured
rate over 49 kHz, but the measurements displaying about 1.5 kHz too high
is consistent).
>>> Testing playback
Opening ALSA device hw:0,1 at 8000 Hz.
Got 8000 Hz, 2 channels, period 2 ms.
15.89 seconds, measured rate 50336 Hz.
>>> Testing capture
Opening ALSA device hw:0,1 at 8000 Hz.
Got 8000 Hz, 2 channels, period 2 ms.
16.22 seconds, measured rate 49313 Hz.
8 kHz still doesn't work. ALSA reports that it does, but in reality
gives 48 kHz (within the bounds of the measurement accuracy).
>>> Testing playback
Opening ALSA device hw:0,1 at 96000 Hz.
Got 48000 Hz, 2 channels, period 1 ms.
96.29 seconds, measured rate 49849 Hz.
>>> Testing capture
Opening ALSA device hw:0,1 at 96000 Hz.
Got 48000 Hz, 2 channels, period 1 ms.
97.29 seconds, measured rate 49339 Hz.
96 kHz works kinda like it should, except for the fact that the hardware
should support that rate as well.
Summa summarum:
Config 1 only uses 44.1 kHz, but claims to support 8-48 kHz on capture.
Config 2 only uses 44.1 and 48 kHz, but claims to support 8-48 kHz on
both capture and playback.
The card in reality, according to specs, supports up to 96 kHz.
According to lspci (attached), it supports everything within the 8-96
kHz range.
-------------- next part --------------
An embedded and charset-unspecified text was scrubbed...
Name: lsusb.txt
Url: http://mailman.alsa-project.org/pipermail/alsa-devel/attachments/20070909/375464b3/attachment-0001.txt
More information about the Alsa-devel
mailing list