On Tue, 16 Feb 2010, Clemens Ladisch wrote:
Lennart Poettering wrote:
Getting back to the invalid dB data from the USB cards: the question is whether the USB descriptor data is badly parsed, and the dB mismatch hence systematic for USB cards,
USB descriptors use units of 1/256th dB, while ALSA uses 1/100th dB. When the level is computed from the minimum plus a multiple of the step size, rounding errors add up considerately.
ALSA 1.0.21 (kernel 2.6.32) added a different TLV type that reports the range with the min/max values to minimize those rounding errors.
Unfortunately, it's not the case of a rounding problem. The USB specification is too much vague and vendors don't use the dB range correctly. For example, I tested SB MP3+ USB device and reported ranges were:
Master: -47.87dB..0.06dB # correct Line: 0dB..47.81dB # seems correct -47.81dB..0dB Line Capture: -0.18dB..23.81dB # seems correct -17.81dB..6.18dB
I just did tests using another soundcard to generate sounds and played back the captured result to determine the gain in the capture direction.
I put my results to:
http://git.alsa-project.org/?p=alsa-kernel.git;a=commitdiff;h=c3a3e040f01457...
The SB MP3+ uses AC97 codec AD1995 with some own ASIC from Creative. So I think that even the 47.87 values are not correct and the real ranges are from -48dB..0dB and -18dB..6dB.
Jaroslav
----- Jaroslav Kysela perex@perex.cz Linux Kernel Sound Maintainer ALSA Project, Red Hat, Inc.