Discussion:
[BUG] Bad decibel data on C-Media USB sound card
Allen M.
2014-09-28 18:56:47 UTC
Permalink
First time bug submitter, forgive me if I'm not following proper procedure.

OS: Arch Linux 64-bit
Kernel version: 3.16.3-1-ARCH

What's happening:
When the Master channel is lowered below 35% in alsamixer,
all audio coming out of the C-Media USB sound card is muted.

Additional info:
PulseAudio is installed
Output of 'lsusb':
Bus 005 Device 002: ID 0d8c:000c C-Media Electronics, Inc. Audio Adapter
Alsa hw ID name:
'Set'
Output of 'cat /proc/asound/Set/usbmixer'
http://ix.io/exb

Any assistance in resolving the issue is greatly appreciated
Clemens Ladisch
2014-09-29 07:51:52 UTC
Permalink
Post by Allen M.
When the Master channel is lowered below 35% in alsamixer,
What is the value of the "Headphone Playback Volume" mixer control
(as shown by "amixer contents") above and below this threshold?


Regards,
Clemens
Allen M.
2014-09-29 12:19:05 UTC
Permalink
Post by Clemens Ladisch
What is the value of the "Headphone Playback Volume" mixer control
(as shown by "amixer contents") above and below this threshold?
using "amixer --device hw:Set contents"
36% yields "values=8,8"
34% yields "values=0,0"

interestingly, using "alsamixer" shows that while (default) reports 36%,
the C-media device reports 3%
Raymond Yau
2014-09-29 15:41:46 UTC
Permalink
Post by Allen M.
Post by Clemens Ladisch
What is the value of the "Headphone Playback Volume" mixer control
(as shown by "amixer contents") above and below this threshold?
using "amixer --device hw:Set contents"
36% yields "values=8,8"
34% yields "values=0,0"
interestingly, using "alsamixer" shows that while (default) reports 36%,
the C-media device reports 3%
Card: C-Media USB Headphone Set at usb-0000:00:12.0-1, full speed Unit: 9
Control: name="Headphone Playback Volume", index=0 Info: id=9, control=2,
cmask=0x3, channels=2, type="S16" Volume: min=-7264, max=-16, dBmin=-2837,
dBmax=-6

Unit: 10 Control: name="Auto Gain Control", index=0 Info: id=10, control=7,
cmask=0x0, channels=1, type="BOOLEAN" Volume: min=0, max=1, dBmin=0, dBmax=0

Do the automatic gain has any side effect when it normalise the volume?

Do you mean the sound card does not has 7248 steps ?

http://www.freedesktop.org/wiki/Software/PulseAudio/Backends/ALSA/Decibel/

You need to find out the value of c->res

https://bugzilla.redhat.com/show_bug.cgi?id=1065097

As you complain dB range -28.37 to -0.06 are not correct

You need to calibrate the dB range

https://bugs.freedesktop.org/show_bug.cgi?id=46236
Allen M.
2014-09-29 22:29:33 UTC
Permalink
Post by Raymond Yau
Do the automatic gain has any side effect when it normalise the volume?
I am unsure of how to go about testing that, 'alsamixer' does not appear
to allow me to modify automatic gain.
Post by Raymond Yau
Do you mean the sound card does not has 7248 steps?
I am not familiar with how to properly check, however dbverify indicates
'Element volume range is 0..151 (-28.37..-0.06 dB).'

Instructions for dbmeasure on the wiki indicates the need for a Line In,
the sound card only provides Line Out and Mic In. Will it automatically
make use of 'Mic In' if 'Line In' is absent? Or do I even need to use it?
Post by Raymond Yau
You need to find out the value of c->res
As you complain dB range -28.37 to -0.06 are not correct
Quick testing done with dbverify: http://ix.io/eyi
Post by Raymond Yau
You need to calibrate the dB range
Volume Steps <=3 are mute while volume step 4 is audible,
based on dbverify testing. This 'seems' to indicate that the
minimum volume is somewhere between -27.81 dB to -27.63 dB?

Additional info logs:
Output of 'amixer -c2 contents': http://ix.io/eyq
Alsa info script output: http://ix.io/eyn
Raymond Yau
2014-09-30 08:27:59 UTC
Permalink
Post by Allen M.
Post by Raymond Yau
Do the automatic gain has any side effect when it normalise the volume?
I am unsure of how to go about testing that, 'alsamixer' does not appear
to allow me to modify automatic gain.
You have to specify card number

It affect your measurent if you are using the mic on your usb audio if the
automatic gain control is switch on
Post by Allen M.
Post by Raymond Yau
Do you mean the sound card does not has 7248 steps?
I am not familiar with how to properly check, however dbverify indicates
'Element volume range is 0..151 (-28.37..-0.06 dB).'
Instructions for dbmeasure on the wiki indicates the need for a Line In,
the sound card only provides Line Out and Mic In. Will it automatically
make use of 'Mic In' if 'Line In' is absent? Or do I even need to use it?
Background noise affect the result if you are not using line in and line
out with a loopback cable , this mean you have to minimize the background
noise
Post by Allen M.
Post by Raymond Yau
You need to find out the value of c->res
As you complain dB range -28.37 to -0.06 are not correct
Quick testing done with dbverify:http://ix.io/eyi
Post by Raymond Yau
You need to calibrate the dB range
Volume Steps <=3 are mute while volume step 4 is audible,
based on dbverify testing. This 'seems' to indicate that the
minimum volume is somewhere between -27.81 dB to -27.63 dB?
How many steps need to reduce amplitude of the recorded sine wave by half
when you play a sine wav through your usb audio and record it back using
audacity?

http://mailman.alsa-project.org/pipermail/alsa-devel/2010-September/032016.html

You many need to change the name of the volume control to headphone
playback volume in alsamixertest
Post by Allen M.
Output of 'amixer -c2 contents':http://ix.io/eyq
Alsa info script output:http://ix.io/eyn
Allen M.
2014-09-30 20:22:40 UTC
Permalink
Post by Raymond Yau
It affect your measurent if you are using the mic on your usb audio if the
automatic gain control is switch on
Automatic gain control is now switched off.
Post by Raymond Yau
Background noise affect the result if you are not using line in and line
out with a loopback cable
I am using loopback, noise should not be an issue.
Post by Raymond Yau
How many steps need to reduce amplitude of the recorded sine wave by
half when you play a sine wav through your usb audio and record it back
using audacity?
Using recorded sine wav provided by 'speaker-test -t sin'
amplitude of recorded sine wave reduced by half at step 77

output of 'amixer -c 2 set Headphone 77':
Simple mixer control 'Headphone',0
Capabilities: pvolume pswitch pswitch-joined
Playback channels: Front Left - Front Right
Limits: Playback 0 - 151
Mono:
Front Left: Playback 77 [51%] [-13.94dB] [on]
Front Right: Playback 77 [51%] [-13.94dB] [on]
Post by Raymond Yau
You many need to change the name of the volume control to headphone
playback volume in alsamixertest
Done. alsamixertest output: http://ix.io/ezd
Raymond Yau
2014-10-01 09:51:57 UTC
Permalink
Post by Allen M.
Post by Raymond Yau
It affect your measurent if you are using the mic on your usb audio if the
automatic gain control is switch on
Automatic gain control is now switched off.
Post by Raymond Yau
Background noise affect the result if you are not using line in and line
out with a loopback cable
I am using loopback, noise should not be an issue.
Post by Raymond Yau
How many steps need to reduce amplitude of the recorded sine wave by
half when you play a sine wav through your usb audio and record it back
using audacity?
Using recorded sine wav provided by 'speaker-test -t sin'
amplitude of recorded sine wave reduced by half at step 77
Simple mixer control 'Headphone',0
Capabilities: pvolume pswitch pswitch-joined
Playback channels: Front Left - Front Right
Limits: Playback 0 - 151
Front Left: Playback 77 [51%] [-13.94dB] [on]
Front Right: Playback 77 [51%] [-13.94dB] [on]
Does this number of steps remain the same when your starting volume are not
at 151?

Your value 77 seem quite different from alsamixertest
Post by Allen M.
Post by Raymond Yau
You many need to change the name of the volume control to headphone
playback volume in alsamixertest
Done. alsamixertest output:http://ix.io/ezd
You may need David to analyse the result

Do those measured value match with those in datasheet?

Seem the measured dB range is larger than 27 dB

https://git.kernel.org/cgit/linux/kernel/git/tiwai/sound.git/log/sound/usb?qt=grep&q=cm106
Allen M.
2014-10-01 23:18:24 UTC
Permalink
Post by Raymond Yau
Does this number of steps remain the same when your starting volume are
not at 151?
Post by Raymond Yau
Your value 77 seem quite different from alsamixertest
recording a sine wave with an amplitude of 1 in Audacity at step 151 shows
that the recorded
value is amplitude 0.885. Does this indicates some loss? The loopback cable
I am using
is 2 meters in length, is the resistance of the cable is too high?
Raymond Yau
2014-10-03 07:14:38 UTC
Permalink
Post by Allen M.
Post by Raymond Yau
Does this number of steps remain the same when your starting volume are
not at 151?
Post by Allen M.
Post by Raymond Yau
Your value 77 seem quite different from alsamixertest
recording a sine wave with an amplitude of 1 in Audacity at step 151
shows that the recorded
Post by Allen M.
value is amplitude 0.885. Does this indicates some loss? The loopback
cable I am using
Post by Allen M.
is 2 meters in length, is the resistance of the cable is too high?
Did you use mono or stereo in playback and capture?

Did your capture volume /boost set to 0dB?

Do your sound card support the sampling rate ?

It depends on frequency of sine wave, sampling rate, playback gain/atten
capture gain/atten

http://wiki.linuxaudio.org/apps/all/jaaa

Do the frequency response of your card look like a straight line at 0dB
similar to those cards loopback test ?

http://audio.rightmark.org/test_results.shtml

Refer to the datasheet and your alsamixertest result , the card seem not
has fixed gain for each step
Post by Allen M.
Post by Raymond Yau
You many need to change the name of the volume control to headphone
playback volume in alsamixertest
Done. alsamixertest output:http://ix.io/ezd
Are you using version 48.11?

Seem alsamixertest is not suitable for testing volume control with less
than 1dB per step or variable dB per step
Allen M.
2014-10-03 15:48:56 UTC
Permalink
Post by Raymond Yau
Did you use mono or stereo in playback and capture?
mono
Post by Raymond Yau
Did your capture volume /boost set to 0dB?
yes
Post by Raymond Yau
Do your sound card support the sampling rate ?
Yes
Post by Raymond Yau
Refer to the datasheet and your alsamixertest result , the card seem not
has fixed gain for each step
http://www.steila.com/USB4IO/CMedia/CM119.pdf
Card is using C-Media CM119.
Datasheet seems to show 38 volume control steps?
Should the steps be 38 instead of 151? Or are these values unrelated?
Post by Raymond Yau
Are you using version 48.11?
Yes

Loading...