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: January 03, 2009 at 5:29AM  

    This blog was the first step in solving my latency problem on my brand new Dell vista ultimate home 64 bit windows and in learning how bad the sound situation is on windows.

    I read about the multimedia scheduling and thought "great, Microsoft has finally fixed the sound problem"  

    1) I plug in my m-audio midisport uno midi usb adapter and the driver doesn't install. m-audio says it is class compliant and needs no drivers, yet it doesn't work.  

    2) I buy a $80 m-audio 2x2 midi-usb adapter and it installs with no problem.  I install sonar home studio and give it a shot.  The midi events come into sonar but they are all wrong.  A trip to m-audio and downloading new drivers fixes that problem.

    3) I can't get the latency below 120 milliseconds.  I spend two days messing around with disabling processes, tweeks here and there to no avail.  (BTW it's funny to think how much computing a modern computer can do in 120 milliseconds...Quad Core 2.3 GHZ software incapable of servicing 44KHZ sound? Phenomenally bad. No excuse)

    4) I read that integrated sound chips have problems doing low-latency audio (for some reason) so I go out and buy a $99 PCI m-audio 2496 sound card and apply to be on their beta program for 64 bit drivers.

    5) I visit Best Buy and see a setup with Vista, a keyboard, a USB based m-audio sound output and ask to see a demo.  The technician claims to be taking classes in this stuff (he has a mac) The demo system has horrible latency too.

    6) Just when I'm saying to myself "Perhaps I have to finally buy a mac". I finally find this article from creative labs.

    forums.creative.com/.../message

    I install AISO4ALL and it seems my latency issues are solved.

    Summary.

    Hankon Strande (from Microsoft) said "Audio glitching is typically not due to the audio device or the audio driver but more likely caused by other software components you are running on your system".  It turns out that the "other software components" he is talking about is all the sound software that Microsoft provides that is not a device driver. Microsoft needs to get it's act together and work with ISVs and solve this latency issue.

    I can't believe that ASIO was released in 1997 and became the de-facto standard because Microsoft provided no alternative. Now 11 years later I still have to download ASIO4ALL, some non-logo'ed, library developed by Michael Tippach (whoever he is) to do what a Multi-billion dollar corporation failed to do in 11 years!  Microsoft should be ashamed of itself.  They should buy ASIO4ALL for $50 million, ship it with Vista, problem solved.

    How has 64 bit Vista been released to the unsuspecting public with 64 bit drivers unavailable or still in beta?  Microsoft should have an army of ISV reps and programmers helping these companies and writing drivers for them.

    Why is there no applet included in windows that allows you to buy a midi-usb adapter, plug it in, and hear sounds?  You need to spend at least $100 on some 3'rd party software while macs ship with garage-band.  All evidence is that he windows sound system is broken for this use and has been for at least 11 years.

  2. Posted on: April 02, 2009 at 1:12PM  

    (Warning: long rant ahead)

    (Developers: if you want to help, skip the rant and scroll on down, past the line)

    Well... I'm finally glad now that there's a possible closure (but no solution still) for the audio problems I have been facing here as of late.

    The odd thing is, most people around here started experiencing problems soon after they buy their new computer; in my case, it happened a year after that, but very shortly after I bought a pair of Creative speakers to replace the aging 2.1 no-brand speakers that came with my old Acer computer. At first I thought it was the speakers, then the sound chip, then even the entire motherboard. I even bought a new external hard disk to back up my data in order to prepare it for any possible major repairs. Had my computer tugged from my home to the computer store, which was located in a busy, being-renovated shopping mall a 15-minute bus ride away (my computer's warranty has already expired by then), only to have the computer shop draw up a blank. Came home, and the problem was apparently solved until it started acting up again these past few days. I did more digging in Google and, after following a messy path of links, finally brought myself to this page and learn that the problem is with Windows Vista itself, and that I'm not the only one.

    It's really unbelievable that there are so many claims of people using Windows XP and not having to suffer this problem, while Vista users have to go through this pain. I demand a lot from my music and audio (though I won't classify myself as an audiophile), and I could have expected the quality of music from my 1-year old computer with an operating system that's 2-years old to be much, much better than what I'm getting now - stutters, pops, drops, and cackles. This is just simply ridiculous - you guys spend 5 long years only to give us a product that breaks something that was working fine in a version that is now eight (!) years old?

    And it just grates on my nerves when I try to play some music on my computer while doing other things, only to have it get messed-up like this. At it's worst, it could do this even when it was mostly idling!

    I am now starting to see why there was such a big negative movement against Windows Vista - at first I thought the problems are not as bad as what the pundits were making it out to be (and in this day and age of fanboyism, you can't trust anyone's praise or criticism of anything until you use it yourself and see if it's what you need/want/like). Now, one year on, I am finally starting to see their light. Just a few days ago I spend more hair-pulling time trying to find a tweak for another Windows Vista annoyance (p.s. it's related to folder  and file thumbnails, if you want to know), only to find that Microsoft has implemented an all-or-nothing solution built dead-in, with absolutely no way to change things around. And that one's at least the second Windows Vista annoyance I have tried to work around in a month!

    I could probably not be able to do anything other than to just shake my head if I really need to change my operating system just to get some proper music flowing from my computer. The ridiculousness here is beyond my threshold.

    ----------------------------------

    So here's the technical gist:

    Acer Aspire M5630 desktop with Acer EG-31M motherboard

    Intel Core2Quad Q6600 processor at 2.4 GHz

    2 GB of RAM

    NVIDIA GeForce 8600GS

    Realtek High-Definition Audio (on-board sound chip)

    Realtek 8185 Extensible 802.11b/g Wireless Device (disabled)

    Realtek RTL8168B/8111B Family PCI-E Gigabit Ethernet NIC (NDIS 6.0)

    Windows Vista SP1 (a given)

    I have already ruled out:

    • the speakers (have them checked by Creative technicians, and tested them with my own MP3 player)

    • drivers (all updated)

    • hard drive controller settings (all are using UDMA)

    • wireless card interference (it's already disabled, unless I'm missing something)

    • something wrong with the Windows Audio and related services (restarted them all, and even tried setting some of them to Realtime base priority in Task Manager)

    • speakers' electrical supply (any problems there should also have shown up on my MP3 player)

    The problem shows up most when I load or reload something on my web browsers - Internet Explorer, Mozilla Firefox, Opera, Safari, and Google Chrome (basically, every commonly-used web browser out there). It affects playing music from any application, be it Windows Media Player, Winamp, Songbird, or one of the web browsers I use. Best-case is only some slight popping noise, worst case is a complete slowing-down of the music being played. There seems to be no buffer underrun issues.

    I have no idea what else might be causing this other than some kind of processor usage competition going on (which shouldn't happen as I have set the speakers properties settings to allow applications to take exclusive control, and to elevate their priority) or something that has to with the network, as discussed elsewhere. It can't be the wireless card, as I have it disabled - unless I'm doing something wrong.

    I am also suspecting possible interference from my router - a 2Wire HGV-2700, but that is low on my list of suspects right now.

    Any ideas and solutions short of changing the operating system?

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