Re: Audigy (not Audigy2) recording level much too low

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

 



At Mon, 1 Dec 2008 13:56:02 +0100,
Zbigniew Baniewski wrote:
> 
> On Mon, Dec 01, 2008 at 12:38:46PM +0000, James Courtier-Dutton wrote:
> 
> > It is a levels problem.
> > Mic captures at 24bits.
> > The DSP handles 24bits fine.
> > When the sound is passed from the DSP to the CPU only the top 16bits of
> > the 24bit value are passed. This accounts for the low capture levels.
> > The "snd_ac97_write_cache(emu->ac97, AC97_REC_GAIN, 0x0f0f);" reduces
> > the analogue capture headroom so is not ideal.
> > I think a better fix would be to add DSP code to adjust the 24bit value
> > into 16bits.
> > The current 24bit to 16bit conversion introduces about 48 dB loss.
> 
> Yes, I read the similar explaining almost one and half year ago. It's very
> likely, that exactly you wrote to me at that time. My current point is:
> when nobody's going to make it "better way", perhaps could be possible
> to apply that "worse fix", which - actually - immediately makes the living
> of Audigy owner a bit easier?
> 
> It seems to me, that it doesn't really make much sense "to do nothing at
> all - because (perhaps) one day we'll make it better". It can be fixed
> instantly by inserting this just one line - and then, some day, it can be
> improved further. What's the problem?

The problem is that it may worsen the audio recording quality.
But I basically agree with adding a practical workaround than
nothing.

As a compromise, we may add a mixer switch to enable/disable the
capture level boost, for example.  A totally untested patch is below.


thanks,

Takashi

---
diff --git a/sound/pci/emu10k1/emumixer.c b/sound/pci/emu10k1/emumixer.c
index f34bbfb..b0fb6c9 100644
--- a/sound/pci/emu10k1/emumixer.c
+++ b/sound/pci/emu10k1/emumixer.c
@@ -1639,6 +1639,45 @@ static struct snd_kcontrol_new snd_audigy_shared_spdif __devinitdata =
 	.put =		snd_emu10k1_shared_spdif_put
 };
 
+/* workaround for too low volume on Audigy due to 16bit/24bit conversion */
+
+#define snd_audigy_capture_boost_info	snd_ctl_boolean_mono_info
+
+static int snd_audigy_capture_boost_get(struct snd_kcontrol *kcontrol,
+					struct snd_ctl_elem_value *ucontrol)
+{
+	struct snd_emu10k1 *emu = snd_kcontrol_chip(kcontrol);
+	unsigned int val;
+
+	/* FIXME: better to use a cached version */
+	val = snd_ac97_read(emu->ac97, AC97_REC_GAIN);
+	ucontrol->value.integer.value[0] = !!val;
+	return 0;
+}
+
+static int snd_audigy_capture_boost_put(struct snd_kcontrol *kcontrol,
+					struct snd_ctl_elem_value *ucontrol)
+{
+	struct snd_emu10k1 *emu = snd_kcontrol_chip(kcontrol);
+	unsigned int val;
+
+	if (ucontrol->value.integer.value[0])
+		val = 0x0f0f;
+	else
+		val = 0;
+	return snd_ac97_update(emu->ac97, AC97_REC_GAIN, val);
+}
+
+static struct snd_kcontrol_new snd_audigy_capture_boost __devinitdata =
+{
+	.iface =	SNDRV_CTL_ELEM_IFACE_MIXER,
+	.name =		"Analog Capture Boost",
+	.info =		snd_audigy_capture_boost_info,
+	.get =		snd_audigy_capture_boost_get,
+	.put =		snd_audigy_capture_boost_put
+};
+
+
 /*
  */
 static void snd_emu10k1_mixer_free_ac97(struct snd_ac97 *ac97)
@@ -2087,5 +2126,12 @@ int __devinit snd_emu10k1_mixer(struct snd_emu10k1 *emu,
 		}
 	}
 		
+	if (emu->card_capabilities->ac97_chip && emu->audigy) {
+		err = snd_ctl_add(card, snd_ctl_new1(&snd_audigy_capture_boost,
+						     emu));
+		if (err < 0)
+			return err;
+	}
+
 	return 0;
 }

-------------------------------------------------------------------------
This SF.Net email is sponsored by the Moblin Your Move Developer's challenge
Build the coolest Linux based applications with Moblin SDK & win great prizes
Grand prize is a trip for two to an Open Source event anywhere in the world
http://moblin-contest.org/redirect.php?banner_id=100&url=/
_______________________________________________
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