<?xml version="1.0" encoding="UTF-8"?>
<rss version="2.0"
	xmlns:content="http://purl.org/rss/1.0/modules/content/"
	xmlns:wfw="http://wellformedweb.org/CommentAPI/"
	xmlns:dc="http://purl.org/dc/elements/1.1/"
	xmlns:atom="http://www.w3.org/2005/Atom"
	xmlns:sy="http://purl.org/rss/1.0/modules/syndication/"
	xmlns:slash="http://purl.org/rss/1.0/modules/slash/"
	>
<channel>
	<title>Netflow Developments &#187; 9.04</title>
	<atom:link href="http://blog.netflowdevelopments.com/tag/904/feed/" rel="self" type="application/rss+xml" />
	<link>http://blog.netflowdevelopments.com</link>
	<description>The latest and greatest happenings in the world of Science, Technology and everything else Geek</description>
	<lastBuildDate>Mon, 06 Feb 2012 02:48:41 +0000</lastBuildDate>
	<language>en</language>
	<sy:updatePeriod>hourly</sy:updatePeriod>
	<sy:updateFrequency>1</sy:updateFrequency>
	<generator>http://wordpress.org/?v=3.3.1</generator>
		<item>
		<title>Fixing ALSA underrun erorrs associated with PulseAudio (and typically Skype) in Ubuntu</title>
		<link>http://blog.netflowdevelopments.com/2009/05/10/fixing-alsa-underrun-erorrs-associated-with-pulseaudio-and-typically-skype-in-ubuntu/</link>
		<comments>http://blog.netflowdevelopments.com/2009/05/10/fixing-alsa-underrun-erorrs-associated-with-pulseaudio-and-typically-skype-in-ubuntu/#comments</comments>
		<pubDate>Sun, 10 May 2009 19:08:38 +0000</pubDate>
		<dc:creator>admin</dc:creator>
				<category><![CDATA[Linux / Freebsd]]></category>
		<category><![CDATA[Technology]]></category>
		<category><![CDATA[9.04]]></category>
		<category><![CDATA[alsa]]></category>
		<category><![CDATA[alsa underrun detected]]></category>
		<category><![CDATA[error]]></category>
		<category><![CDATA[highpriority]]></category>
		<category><![CDATA[nice-level]]></category>
		<category><![CDATA[problem]]></category>
		<category><![CDATA[pulseaudio]]></category>
		<category><![CDATA[real-time priority]]></category>
		<category><![CDATA[realtime-scheduling]]></category>
		<category><![CDATA[skype alsa underrun]]></category>
		<category><![CDATA[sound cutting out]]></category>
		<category><![CDATA[sound not working]]></category>
		<category><![CDATA[ubuntu]]></category>
		<category><![CDATA[underrun]]></category>
		<guid isPermaLink="false">http://blog.netflowdevelopments.com/?p=256</guid>
		<description><![CDATA[So after running into this problem suddently and for no &#8216;apparent&#8217; reason(although it became apparent later) I noticed the complete lack of real support docs online in regards to the ALSA underrun problem.  Hopefully I can rememdy this a little bit and help some people out. Last week I noticed skype audio was getting really [...]]]></description>
			<content:encoded><![CDATA[<p><img class="alignleft" title="ubuntu" src="http://medya.gh.googlepages.com/ubuntu-tux.png" alt="" width="165" height="197" /></p>
<p>So after running into this problem suddently and for no &#8216;apparent&#8217; reason(although it became apparent later) I noticed the complete lack of real support docs online in regards to the ALSA underrun problem.  Hopefully I can rememdy this a little bit and help some people out.</p>
<p>Last week I noticed skype audio was getting really choppy, it was the equivalent of seeing the conversation through a strobe light.  Odd I thought but didn&#8217;t pay it too much heed, that was until the end of the week when the audio simply stopped all together and skype refused to close down normally.  I would have to manually kill the process in terminal after the sound cut out.  This problem was exclusive to skype, which made it even more frustrating as I could have youtube and/or music playing in <a href="http://www.exaile.org" target="_blank">exaile </a>while skype was screwing the pooch.</p>
<p>It occured to me today that something indeed had been changed recently right before this problem started and that was me fiddling with pulse&#8217;s daemon.conf and enabling real-time scheduling.  I can&#8217;t remember what for but this was part of the problem.  In fact there is even a mention in pulseaudio&#8217;s man page in regards to the possibility of real-time scheduling causing problems which I&#8217;ll quote here:</p>
<blockquote><p><em> Alternatively,  if the risk of locking up the machine is considered too<br />
big to enable real-time scheduling,  high-priority  scheduling  can  be<br />
enabled  instead  (i.e.  negative  nice  level). This can be enabled by<br />
passing &#8211;high-priority (see above) when starting  PulseAudio  and  may<br />
also  be  enabled  with  the approriate option in daemon.conf. Negative<br />
nice levels can only be enabled when  the  appropriate  resource  limit</em></p>
<p><em> RLIMIT_NICE  is  set  (see setrlimit(2) for more information), possibly<br />
configured in /etc/security/limits.conf. A resource limit of 31 (corre‐<br />
sponding with nice level -11) is recommended.</em></p>
<p><img class="alignright" title="skype" src="http://cultofmac.com/wp-content/uploads/skype-logo.jpg" alt="" width="137" height="137" /></p></blockquote>
<p>At this point I got a little excited as the solution seemed within reach.  I hashed out real-time schedule and implemented high-priority scheduling, restarted pulseaudio and loaded up skype.  It started fine but when I made a test call I was once again plagued by ALSA underruns.</p>
<p>They key here was to adjust the nice level.  I incrementally went down from -11 all the way to 3 (as in <strong>plus</strong> 3 <strong>not</strong> -3), restarted pulseaudio, loaded skype and viola!  Problem solved.  The nice level might be different for you so maybe experiment with that a little bit.</p>
<p><strong>Summary:</strong></p>
<ul>
<li>edit ~/.pulse/daemon.conf (or /etc/pulse/daemon.conf if you run as system)</li>
<li>Hash out realtime-scheduling and realtime-priority</li>
<li>Unhash high-priority and nice-level</li>
<li>set nice level to 3 (not -3 or -11 for that matter)</li>
</ul>
<p>Update:  Bah, I am still seeing these under runs.  The severity of them has gone down as skype doesn&#8217;t completely cut out now and lock up but I am getting audio cutting in and out every 2-3 seconds when making a call via skypeout.</p>
<p>Searching around the <a href="http://forum.skype.com/index.php?showtopic=306381" target="_blank">skype forums</a> I found this and this actually seems to have done the trick completely:</p>
<p>Edit your ~/.asoundrc file</p>
<p># Part I directly from ALSA Dmix Wiki</p>
<p>pcm.skype {<br />
type dmix<br />
ipc_key 1024<br />
slave {<br />
pcm &#8220;hw:0,0&#8243;<br />
period_time 0<br />
period_size 1024<br />
buffer_size 8192<br />
#format &#8220;S32_LE&#8221;<br />
#periods 128<br />
rate 44100<br />
}<br />
}</p>
<p>pcm.dsp0 {<br />
type plug<br />
slave.pcm &#8220;skype&#8221;<br />
}</p>
<p># This following device can fool some applications into using pulseaudio<br />
pcm.dsp1 {<br />
type plug<br />
slave.pcm &#8220;pulse&#8221;<br />
}</p>
<p>ctl.mixer0 {<br />
type hw<br />
card 0<br />
}</p>
<p>pcm.pulse { type pulse }<br />
ctl.pulse { type pulse }<br />
pcm.!default {<br />
type pulse<br />
}</p>
<p>ctl.!default {<br />
type pulse<br />
}</p>
]]></content:encoded>
			<wfw:commentRss>http://blog.netflowdevelopments.com/2009/05/10/fixing-alsa-underrun-erorrs-associated-with-pulseaudio-and-typically-skype-in-ubuntu/feed/</wfw:commentRss>
		<slash:comments>3</slash:comments>
		</item>
	</channel>
</rss>

