An Overview of Windows Sound and Music "Glitching" Issues

The following post comes from my colleague Steve Ball, Senior Program Manager for Sound in Windows Vista, and continues his team's on-going series on how Windows Vista treats various forms of audio.

-----

Part I: Why does my Windows sound sometimes "glitch?"

Windows is a rich and complex OS designed for multi-tasking users whose tasks must share access to scarce system hardware and resources.  Unfortunately, despite multiple decades of incredible advances in PC and CPU architectures, there are non-trivial, complex interactions between applications, processes, and devices in even the most advanced personal computers that make a supposedly "easy" task -- like playing back music without occasional glitches -- much more difficult than it may seem at first glance.

Another way of thinking about this:  it seems odd that a modern >$2000 PC may sometimes have trouble seamlessly playing back music when $20 CD players can effortlessly playback music without glitches. 

So why do many $2000 PCs occasionally glitch while playing back music?  The quick answer is this:  Windows is not a single-function device like a CD player.

A slightly longer answer goes like this:  even an average Windows machine today is commonly used simultaneously as a media player, word processor, presentation projector, spreadsheet number cruncher, authoring tool, photo editor, media server, video recorder, music composition tool, communications device, search engine, virus detector, data compressor and decompressor, and backup manager.  And these are only a few of the possible tasks and processes that are run at the same time on the hundreds of millions of Windows machines that are in use today.  Each of these tasks or processes, in isolation, would hardly tax the resources of modern PC hardware.  But in our multi-tasking world, unavoidable resource conflicts do sometimes occur between the huge and diverse ecosystem of Windows hardware that enables these tasks.  Even on the most expensive, brand-new machine, occasional glitches can occur if and when the system attempts to divide its finite resources among these multiple, diverse, independent, power-hungry activities.

What is a glitch?

A glitch is a perceivable error, gap or pop in the sound caused by discontinuities in the audio signal during playback or recording which result from processing or timing problems.  Glitches during music playback can sound like a loud "pop" or like a brief slice of silence randomly inserted where your music should have been.  Some customers have also described what "glitching" in their own words as:

  • audio stops a little bit
  • breaks up
  • choppy
  • clicking
  • corruption
  • crackle/crackling/crackly
  • interruption
  • jitters
  • jumpy
  • skipping/skip/skips

For the purpose of this discussion, let's lump all of these descriptions together under one general class of problems and call these "glitching."  While a glitch that happens during music playback can be annoying and unsettling, a glitch that occurs while you are recording or communicating with someone can result in frustrating and unacceptable data loss.

What causes my Windows sound and music to glitch?

Digital media processing is time-sensitive.  Playback requires specific work to be performed by a given deadline -- otherwise presentation or data loss can occur.  A "glitch" occurs when a deadline for time-sensitive processing is missed or when time-sensitive data is lost.

For example, in Windows Vista, playing back music involves "work" that must be done at least every 10 milliseconds so that there can be a continuous stream of music out to your speakers.  The "simple" task of playing back music consists of the following steps, all of which must be completed before a strict deadline:

  1. a small chunk of data from a music file needs to be read from a disc (CD or hard drive)
  2. this data needs to be "decompressed" or "decoded" (usually in system memory) so it can be streamed out to your speakers in a format that your sound hardware understands
  3. the decompressed sound data needs to be copied from system memory to your sound hardware memory
  4. the data in your sound hardware needs to be sent to your speakers at the appropriate time
  5. repeat steps 1-4 flawlessly every 10 milliseconds (ms)

In this example, if any of these steps aren't completed on time, then the user could hear a glitch in the music playback.

Elliot Omiya, Architect on the Sound dev team, puts this 10ms cycle into perspective:  "it's just slightly longer than the time it takes a nerve impulse to travel from the end of your finger to your brain (~8ms), known as NCV (nerve conduction velocity).  Because synapses are like network switches, there is switching time involved before the nerve impulse gets to the brain, i.e., switching time adds to latency."

There is some good news in this story:  Windows developers have made significant progress over the years in reducing glitching across key multimedia scenarios.  For example, music playback on an otherwise "lightly loaded" system can be generally as smooth as that $20 CD player.

But because of the multi-tasking nature of Windows and the vast array of new and legacy hardware in the ~1B PCs that are used to playback music today, this allegedly simple process is made more complex by the resource sharing that occurs between applications and hardware.  For example, it is not uncommon for certain older devices driver to occasionally "lock out" the CPU for 10-50ms, thereby causing obvious audio glitches.  This is just one example of the kinds of complex hardware, driver, and OS interactions that can cause glitches.

In summary, some of the common sources of glitches today include:

  • CPU starvation
  • GPU starvation
  • Resource contention from devices and drivers (sometimes called "IO contention")
  • Network devices
  • And, of course ... bugs in applications, OS, drivers and/or hardware

My colleague on the Windows Sound team, Larry Osterman, also pointed out to me recently that humans are actually "hard-wired" to be disturbed by audio glitches.  In an exchange about this topic, Larry observed that audio glitches are more obvious than video glitches because the ear's tuned to notice high frequency transients -- his visceral example of this idea is an image of a stick snapping in the woods behind you as an audio event that wakes you up before a bear wanders into your path. 

In my second post on this topic, I'll go a bit deeper in sharing details of work we’ve done in Windows Vista to address some of the known sources of potential sound glitches, including some additional background about a recent discovery of an apparent connection between multimedia playback and network throughput.

I wish to acknowledge the contributions and suggestions from my colleagues Hakon Strande, Richard Fricks, Alex Ferreira, Lan Ye, Larry Osterman and Elliot Omiya for this series of posts.


Comments

  1. Posted on: October 31, 2007 at 5:51PM  

    This is ridiculous. My laptop worked absolutely fine under XP. Whatever I was doing, VoIP worked fine. Now with Vista, I tried 7 different VoIP programs and I always get gliches, cracks and noise.

    IT IS NOT "THE HARDWARE", IT IS NOT "IMPOSSIBLE", IT IS JUST VISTA WHICH IS BADLY PROGRAMMED.

    Sorry.

    chuba

  2. Posted on: November 01, 2007 at 2:20AM  

    Hey Chuba -

    I'm sorry you are having VOIP glitching issues on Windows Vista.  

    Hearing about experiences like yours is one of the reasons I chose to write this post.

    Unfortunately, without more details about your hardware, apps, and drivers, I have no idea why your VOIP is glitching on Windows Vista when it worked fine on XP.    This is total speculation, but your issues may have something to do with variable latency in the capture path that can’t be ‘fixed’ by the dynamic thread priority adjustment or more predictable scheduling that can sometimes be mitigations for CPU or other resource contention issues.   I’ll address more on these topics in my next post in this series.  

    While it can be unpleasant to discuss or even acknowledge ‘what doesn’t work,’ this dialog is intended to both acknowledge and address the complexity and deficiencies around glitching issues.  I also hope to re-frame the (IMHO false) perception that it is even possible to build, test, and ship a ‘glitch-free’ multi-tasking, multi-purpose OS that always works flawlessly on the vast and random array of last, this, and next year’s apps, hardware, and drivers.  

    I’m also not offering excuses or suggesting that your issues are not bugs or issues for us to investigate – your experience may very well be caused by Windows bugs --  but the actual root causes of the glitching issues we’ve investigated to date are usually due to more subtle and complex interactions or latencies between apps, DSPs, specific drivers and hardware than can simply be blamed on ‘bad programming’ in Windows.  

    Thanks for sharing your experiences, Chuba, and I hope we can learn more about (and perhaps even fix?) the glitching you’re experiencing.  

    -Steve

    * * *  

  3. Posted on: November 01, 2007 at 2:36AM  

    Hey Jaxim -

    Without more details about your specific hardware, it's difficult for me to even speculate about what is going on, but the most direct way to investigate a solution is communicate with team who made your hardware: Creative.  

    The issues you are describing (6.1 config problems) belong firmly in the camp of Creative who built both the hardware and drivers that are designed to be used with their hardware.  

    Have you contacted them directly to make them aware of your problem you are experiencing?  Also, there are some recent driver updates on the Creative site (even from this month) which may be available for your hardware -- do you have the latest for your HW?    

    Hope this helps!

    -Steve  

    * * *

  4. Posted on: November 01, 2007 at 10:59AM  

    I'm blaming immature drivers. I had horrid problems with Audigy 4 audio breaking up when typing on a USB keyboard (actually PS/2->USB converter) on Vista SP1 beta.

    The problems went away when I installed Creative's own drivers. I'm still suspicious of exactly how good the USB keyboard drivers are, but haven't had an issue since.

  5. Posted on: November 01, 2007 at 2:18PM  

    Fortunately I experienced this problem only during use of my old DVD-ROM which must operate in PIO mode for it to work under the Vista.

    I am thinking about the following:

    There are two kinds of programs. One kind are games or communication programs which can not predict the played sound beyond small amount of ms. The other kind are audio and video players which usually have few seconds of sound data for future playback and they provide those data in advance to the api.

    Would it be reasonable to mix up to 20ms (or more) of available future data (so something like 10ms from first kind of application, full 20ms from audio player) during each 10ms step into the hw buffer? In the simplest implementation this would redo 10ms of sound in the glitch free case during each iteration.

    Now when one update is missed, the sound sourced from programs with small amount of future data would have the glitch (because data were not available when that part of buffer was mixed for first time) however sound from audio player would not.

  6. Posted on: November 01, 2007 at 3:23PM  

    Actually my friend who is a musician still uses Windows 98SE in a dual boot scenario with XP as in some scenarios 98SE performs better with his programs, something about Midi drivers.  I think he may use XP a bit now, but for music Im sure he wont touch Vista for a while, perhaps a special Boot mode for Musicians and musical tools would help.

  7. Posted on: November 02, 2007 at 12:35AM  

    jtu100: Audio Rendering applications are more than welcome to do that on Vista.  And the Vista audio engine can accomodate that behavior.  Of course, it's going to consume a fair amount of memory to achieve what you want, and you might have to totally reset the machine to stop rendering audio, but if that's what you want, I believe that you can do it.

    Erwin Reid: Interestingly enough, when you hit CTRL-ALT-DEL, you switch to the "secure desktop".  When that happens, on some display drivers, it totally resets the video hardware.  I could easily imagine that during such a reset operation, you might encounter a "lock out" situation.

    I'm not saying that's what's happening in your situation, but it's a possible explanation.

  8. Posted on: November 02, 2007 at 6:22AM  

    Nice backgrounder, but no specifics

    This article amounts to "it's so difficult", but it's the same set of contentions and trade-offs that XP and older OSs had to face.

    There's nothing I can see that is specific to why Vista can't do this stuff properly, e.g. what great new Vista functionality we have that exists at the expense of smooth multimedia playback.

    The bottom line seems to be that Vista doesn't manage these things as effectively as XP, and therefore is less effective as a multimedia platform.

  9. Posted on: November 02, 2007 at 11:16AM  

    Why does Windows Vista page excessively? and why does it take more than 5 minutes to copy 8 files from a USB thumb drive to a hard disk? Why does mac not have the same problem?

    the configuration:

    - 7200 rpm 200 GB Western Digital Hard disk

    - 2 GB DDR2 SDRAM

    - default configuration of Windows VISTA.

  10. Posted on: November 02, 2007 at 11:27AM  

    i congratulate you on a very sound intellectual and erudite theoretical examination of the treatise.  i am sure that you feel satisfied and delighted with your cool stuff and i hope you continue to travel the world.

    however may i kindly ask what you are planning to do about audio skipping for those poor unfortunate folk like me who stupidly updated with vista when xp sound worked perfectly.  you may be intellectually stimulated to know that my sound works perfectly on os-x

Trackbacks

  1. Posted by: Larry Osterman's WebLog on October 30, 2007 at 7:49PM

    Nick White over at the Windows Vista Blog just posted an article written by Steve Ball , the PM in charge

  2. Posted by: Noticias externas on October 30, 2007 at 8:25PM

    Nick White over at the Windows Vista Blog just posted an article written by Steve Ball , the PM in charge

  3. Posted by: Where are we going, and what's with the handbasket? on October 31, 2007 at 4:29AM

    Steve Ball posted an article about some "glitching" issues in Vista . I can't resist adding my two cents.

  4. Posted by: Noticias externas on October 31, 2007 at 4:39AM

    Steve Ball posted an article about some "glitching" issues in Vista . I can't resist adding

  5. Posted by: Microsoft on January 09, 2008 at 4:31PM

    Steve Ball of Microsoft has a very interesting blog started on the Windows Vista Blog site about audio

  6. Posted by: pcpartfinder on January 31, 2008 at 7:59PM

    Last fall , Steve Ball, Microsoft's program manager for sound in Vista, posted a blog entry explaining

  7. Posted by: how to sell digital products on ebay on July 17, 2008 at 11:02AM

    Fujifilm is one of the leading providers of imaging and information products. Fujifilm and its employees are committed to providing consumers and professionals with the most innovative and highest- quality imaging and information products and services.

  8. Posted by: Pulse Audio on Ubuntu.Working Fine for you? - Page 2 - Open Source - TechEnclave on March 07, 2009 at 1:01AM

    Pingback from  Pulse Audio on Ubuntu.Working Fine for you? - Page 2 - Open Source - TechEnclave