# When recording sound skips, micro-hangs



## MorgothV8 (Jun 6, 2011)

Hi, I have problem with my FreeBSD box. Now I'm at work, so cannot paste any dmesg's etc, but I'll add it in the evening.

I have a Packard Bell 10.1 netbook and the newest FreeBSD 8.2 RELEASE i386. Sound driver is snd_hda. It detects two outputs/inputs:

/dev/dsp0: normal laptop's sound
/dev/dsp1: input microphone and headphones (red and green lines, external)

When I play sound on this machine everything seems OK, but when recording from the external microphone (red line) /dev/pcm0 strange things happen. I have sound, but every 1-2 s there is a little "micro hang" of system, lasting maybe 0.1 second. If I for example press some key on different console for example 's' then it will auto repeat and constantly appear on screen, but after every 1-2 seconds it will stop for just about 0.1 second, the same with mouse pointer etc.

Just like there is some sleep internal in the kernel which hangs the entire system for 0.1 second every 1-2 seconds. When I stop recording everything is OK.

I need to fix it, I'm going to Spitsbergen (Polish Polar Station team) and need to talk with my wife remotely. I've written my own VoIP aplication for FreeBSD, and it works just fine on different machines - but not this one 

Any suggestions? What output is needed? (*cat /dev/sndstat*, *dmesg*, *pciconf*, *uname -a*)?

I think about to do (at home):
1) mess with sysctl hw.snd* (especially polling, latency etc, verbose, default unit)
2) kernel Hz, SMP on/off, DEBUG
3) put snd_hda to /boot/loader.conf (now I load it from terminal after login)
4) maybe bad configuration (snd_hda associations)
5) ?

It almost works, but when it hangs there is bad sound, noise, we can talk  but it is very annoying.

BTW: there is only 600 BPS needed to talk using my own VoiP client/server, enough to work on blocked after using out transfer u3g Huawei E1750 modem? Old good PPP with 4 kbps is enough to talk. Of course tests are made locally, to remove bad network as a cause for bad sound.

Thanks a lot!


----------



## MorgothV8 (Jun 6, 2011)

I will answer to myself.

Added snd_hda_load to /boot/loader.conf. Recompiled kernel without any debug and with Hz=100. Now everything works OK



EDIT: little correction.
Kernel Hz and loading hda wasn't solution for this problem.
The problem was with alc0 ethernet driver. When I've been using it and USB Huawei modem at the same time then micro hangs happen.
But this is not a problem. I swithed from alc (cable) to wireless and disabled alc in kernel config. No more hangs there.... even with GENERIC kernel and fresh system, only disabling alc causes micro hangs to disappear - so it is 100% alc's driver fount.


----------

