Re: [alsa-devel] Mixer volume/decibel mapping
Raymond Yau wrote:
2010/5/21 Clemens Ladisch clemens@ladisch.de
DB_LINEAR means that the mixer control value is a multiplier for the PCM sample value, as James wrote. A DB_LINEAR mapping has 0 == -infinity dB, full scale == 0 dB, and the mapping between mixer control values and corresponding dB values it _not_ linear.
pci/oxygen/oxygen.c:static const DECLARE_TLV_DB_LINEAR(ak4396_db_scale, TLV_DB_GAIN_MUTE, 0); pci/oxygen/hifier.c:static const DECLARE_TLV_DB_LINEAR(ak4396_db_scale, TLV_DB_GAIN_MUTE, 0);
Refer to AK4396 datasheet
Output Volume
The AK4396 includes channel independent digital output volumes (ATT) with 256 levels at linear step including MUTE. These volumes are in front of the DAC and can attenuate the input data from 0dB to –48dB and mute.
dB range is -48dB to 0dB only
ATT7-0: Attenuation Level ATT = 20 log10 (ATT_DATA / 255) [dB] FFH : 0dB (Default) 00H : Mute
This is the section of the datasheet on which the above declarations are based.
Now if you have some remark or question, you should remember to include it in your mail.
Regards, Clemens
2010/5/25 Clemens Ladisch clemens@ladisch.de
Raymond Yau wrote:
2010/5/21 Clemens Ladisch clemens@ladisch.de
DB_LINEAR means that the mixer control value is a multiplier for the PCM sample value, as James wrote. A DB_LINEAR mapping has 0 == -infinity dB, full scale == 0 dB, and the mapping between mixer control values and corresponding dB values it _not_ linear.
pci/oxygen/oxygen.c:static const DECLARE_TLV_DB_LINEAR(ak4396_db_scale,
TLV_DB_GAIN_MUTE, 0);
pci/oxygen/hifier.c:static const DECLARE_TLV_DB_LINEAR(ak4396_db_scale,
TLV_DB_GAIN_MUTE, 0);
Refer to AK4396 datasheet
Output Volume
The AK4396 includes channel independent digital output volumes (ATT) with 256 levels at linear step including MUTE. These volumes are in front of the DAC and can attenuate the input data
from
0dB to –48dB and mute.
dB range is -48dB to 0dB only
ATT7-0: Attenuation Level ATT = 20 log10 (ATT_DATA / 255) [dB] FFH : 0dB (Default) 00H : Mute
This is the section of the datasheet on which the above declarations are based.
Now if you have some remark or question, you should remember to include it in your mail.
Regards, Clemens
I have doubt about DECLARE_TLV_DB_LINEAR(ak4396_ db_scale, TLV_DB_GAIN_MUTE, 0);
since the datasheet mention that dB range is only -48dB to 0dB , DR and S/N is only 120dB
ATT = 20 log10 (ATT_DATA / 255) [dB]
How can AK4396 has scale of -inf DB to 0dB in the driver code ?
BTW , if ymf7xx (DSP) only accept 16 bit digital PCM data and output to 18-20 bit AC97 codec , how can the per stream volume control has a scale -inf dB to 0dB ?
inf dB may occur when DSP accept floating point
however the storage of Float pointing is still finite , the min dB of DSP accept FLOAT64 should in theory lower than the min dB of those DSP accept FLOAT32
Raymond Yau wrote:
I have doubt about DECLARE_TLV_DB_LINEAR(ak4396_db_scale, TLV_DB_GAIN_MUTE, 0);
since the datasheet mention that dB range is only -48dB to 0dB
ATT = 20 log10 (ATT_DATA / 255) [dB]
How can AK4396 has scale of -inf DB to 0dB in the driver code ?
When ATT_DATA = 0, there is no output, which is an attenuation of -inf. The next value, ATT_DATA = 1, results in ATT = -48 dB.
BTW , if ymf7xx (DSP) only accept 16 bit digital PCM data and output to 18-20 bit AC97 codec ,
The DSP uses more precise values internally.
how can the per stream volume control has a scale -inf dB to 0dB ?
multiplication factor 0: dB = 20 log10(0) = -inf multiplication factor 1: dB = 20 log10(1) = 0
This is true regardless of the precision of the multiplier. Even a one- bit factor behaves like this; in fact, this would describe a mute switch.
HTH Clemens
2010/5/25 Clemens Ladisch clemens@ladisch.de
Raymond Yau wrote:
I have doubt about DECLARE_TLV_DB_LINEAR(ak4396_db_scale,
TLV_DB_GAIN_MUTE, 0);
since the datasheet mention that dB range is only -48dB to 0dB
ATT = 20 log10 (ATT_DATA / 255) [dB]
How can AK4396 has scale of -inf DB to 0dB in the driver code ?
When ATT_DATA = 0, there is no output, which is an attenuation of -inf. The next value, ATT_DATA = 1, results in ATT = -48 dB.
But snd_mixer_selem_get_playback_dB_range() does not return 48dB **
2010/5/25 Clemens Ladisch clemens@ladisch.de
Raymond Yau wrote:
BTW , if ymf7xx (DSP) only accept 16 bit digital PCM data and output to 18-20 bit AC97 codec ,
The DSP uses more precise values internally.
DSP use more precise values internally only increase the number of step ( dB per step is much finer resolution , the dB range is limited to the number of bits of the input digital signral and output digital signal which pass through ac97 link
There seem to be no hardware can provide infinte dB range
2010/5/25 Clemens Ladisch clemens@ladisch.de
Raymond Yau wrote:
I have doubt about DECLARE_TLV_DB_LINEAR(ak4396_db_scale,
TLV_DB_GAIN_MUTE, 0);
since the datasheet mention that dB range is only -48dB to 0dB
ATT = 20 log10 (ATT_DATA / 255) [dB]
How can AK4396 has scale of -inf DB to 0dB in the driver code ?
When ATT_DATA = 0, there is no output, which is an attenuation of -inf. The next value, ATT_DATA = 1, results in ATT = -48 dB.
refer to ice1712/prodigy_hifi.c , why the comment is -64dB to 0dB ?
/* * ak4396 mixers */
/* * DAC volume attenuation mixer control (-64dB to 0dB) */
static int ak4396_dac_vol_info(struct snd_kcontrol *kcontrol, struct snd_ctl_elem_info *uinfo) { uinfo->type = SNDRV_CTL_ELEM_TYPE_INTEGER; uinfo->count = 2; uinfo->value.integer.min = 0; /* mute */ uinfo->value.integer.max = 0xFF; /* linear */ return 0; }
This is true regardless of the precision of the multiplier. Even a one-
bit factor behaves like this; in fact, this would describe a mute switch.
This mean that the dB range should be calculated from the next step above the min_dB and max_dB when min_dB regarded as a mute switch
Raymond Yau wrote:
2010/5/25 Clemens Ladisch clemens@ladisch.de
Raymond Yau wrote:
I have doubt about DECLARE_TLV_DB_LINEAR(ak4396_db_scale, TLV_DB_GAIN_MUTE, 0);
since the datasheet mention that dB range is only -48dB to 0dB
ATT = 20 log10 (ATT_DATA / 255) [dB]
How can AK4396 has scale of -inf DB to 0dB in the driver code ?
When ATT_DATA = 0, there is no output, which is an attenuation of -inf. The next value, ATT_DATA = 1, results in ATT = -48 dB.
refer to ice1712/prodigy_hifi.c , why the comment is -64dB to 0dB ?
/*
- DAC volume attenuation mixer control (-64dB to 0dB)
*/
Apparently just copied from pontis.c.
static int ak4396_dac_vol_info(struct snd_kcontrol *kcontrol, struct snd_ctl_elem_info *uinfo) { uinfo->type = SNDRV_CTL_ELEM_TYPE_INTEGER; uinfo->count = 2; uinfo->value.integer.min = 0; /* mute */ uinfo->value.integer.max = 0xFF; /* linear */ return 0; } ... static const DECLARE_TLV_DB_SCALE(db_scale_wm_dac, -12700, 100, 1);
And this defines a dB scale from -127 dB to +128 dB, which will break PulseAudio's volume calculations.
This is true regardless of the precision of the multiplier. Even a one- bit factor behaves like this; in fact, this would describe a mute switch.
This mean that the dB range should be calculated from the next step above the min_dB and max_dB when min_dB regarded as a mute switch
No; the AK4396 datasheet mentions -48 dB only because this is the minimum attenuation that isn't completely mute. The minimum of the ATT_DATA registers _is_ zero, i.e. -inf dB, and therefore TLV_DB_GAIN_MUTE is the correct minimum for the dB range.
Regards, Clemens
2010/5/28 Clemens Ladisch clemens@ladisch.de
Raymond Yau wrote:
2010/5/25 Clemens Ladisch clemens@ladisch.de
Raymond Yau wrote:
I have doubt about DECLARE_TLV_DB_LINEAR(ak4396_db_scale,
TLV_DB_GAIN_MUTE, 0);
since the datasheet mention that dB range is only -48dB to 0dB
ATT = 20 log10 (ATT_DATA / 255) [dB]
How can AK4396 has scale of -inf DB to 0dB in the driver code ?
When ATT_DATA = 0, there is no output, which is an attenuation of -inf. The next value, ATT_DATA = 1, results in ATT = -48 dB.
refer to ice1712/prodigy_hifi.c , why the comment is -64dB to 0dB ?
/*
- DAC volume attenuation mixer control (-64dB to 0dB)
*/
Apparently just copied from pontis.c.
static int ak4396_dac_vol_info(struct snd_kcontrol *kcontrol, struct
snd_ctl_elem_info *uinfo)
{ uinfo->type = SNDRV_CTL_ELEM_TYPE_INTEGER; uinfo->count = 2; uinfo->value.integer.min = 0; /* mute */ uinfo->value.integer.max = 0xFF; /* linear */ return 0; } ... static const DECLARE_TLV_DB_SCALE(db_scale_wm_dac, -12700, 100, 1);
And this defines a dB scale from -127 dB to +128 dB, which will break PulseAudio's volume calculations.
This is true regardless of the precision of the multiplier. Even a
one-
bit factor behaves like this; in fact, this would describe a mute
switch.
This mean that the dB range should be calculated from the next step above the min_dB and max_dB when min_dB regarded as a mute switch
No; the AK4396 datasheet mentions -48 dB only because this is the minimum attenuation that isn't completely mute. The minimum of the ATT_DATA registers _is_ zero, i.e. -inf dB, and therefore TLV_DB_GAIN_MUTE is the correct minimum for the dB range.
The AK4396 includes channel independent digital output volumes (ATT) with 256 levels at linear step including MUTE. These volumes are in front of the DAC and can attenuate the input data from 0dB to –48dB and mute.
It only mention the volume can be attenuate to -48dB and MUTE
some driver are using SMUTE (soft mute) and soft mute enable : default is OFF
As James said , DB_LINEAR is limited to 0dB as Max , how can you provide a dB scale for the capture volume control of pulseaudio
participants (2)
-
Clemens Ladisch
-
Raymond Yau