Problems recording sound in FreeBSD 5.1 (now 6.0)

Stephen Bartlett stephen at
Fri Apr 28 09:28:58 UTC 2006

I just installed FreeBSD 6.0-RELEASE on my laptop.  I was bummed that
the microphone seemed inoperative because I really wanted to use Skype
(especially after having gotten it running).  I Googled around and found
the solution in a 2003 message from Stuart Barkley:

On Mon Jul 14 22:36:57 PDT 2003, Stuart Barkley wrote:
> Two other things come to mind for AC97 recording:
> - AC97 specifies a control register bit which enables a 20dB
> microphone input gain.  For the microphones I use, I seem to always
> need the boost.  I apply the following patch (to 4.7, I'm not sure if
> it applies to 5.1 at all).

This seemed like just the ticket, as I have the AC97 chipset:
# cat /dev/sndstat
FreeBSD Audio Driver (newpcm)
Installed devices:
pcm0: <Intel ICH4 (82801DB)> at io 0x1c00, 0x18c0 irq 17 bufsz 16384  (1p/1r/0v channels duplex default)

Well, I figured out the code enough to apply that patch to the newer
source, and voila -- microphone now works great in gnome-sound-recorder
and in Skype.  Yay.

Patch is below.  Notice that it's in a different location in the file.

- Stephen

Stephen Bartlett
President, Bartlett Software, Inc.

(in  /sys/dev/sound/pcm/ )

*** ac97.c.orig	Sun Apr 10 04:45:27 2005
--- ac97.c	Thu Apr 27 22:37:17 2006
*** 455,460 ****
--- 455,466 ----
  			int cur = ac97_rdcd(codec, e->reg);
  			val |= cur & ~(mask);
+ 		/* stuartb: Enable 20dB mic channel gain boost */
+ 		/* TODO: Add ioctl or something else to control this */
+ 		/* Do ALL AC97 chips support this? */
+ 		if (channel == SOUND_MIXER_MIC)
+ 		  val |= 0x40;
  		ac97_wrcd(codec, reg, val);
  		return left | (right << 8);

-------------- next part --------------
A non-text attachment was scrubbed...
Name: not available
Type: application/pgp-signature
Size: 187 bytes
Desc: This is a digitally signed message part
Url :

More information about the freebsd-multimedia mailing list