Engineering Windows 7

Welcome to our blog dedicated to the engineering of Microsoft Windows 7

Improving Audio Glitch Resilience in Windows 7

Improving Audio Glitch Resilience in Windows 7

  • Comments 72

Delivering excellent audio playback on a PC is one of those “much harder than it looks” technical challenges.  Unlike dedicated audio / video devices, PCs have a lot going on during playback of audio and the playback happens on an incredible array of hardware and software.  Many of you might be familiar with “glitches” that occasionally happen.  In this post, Kristin Carr, a program manager on our Devices and Media team, describes some of the engineering in Windows 7 to improve this area representing the work of a number of folks across the team.  One lesson I learned early in the product cycle is that we don’t say “glitch-free” but rather “glitch-resilient” and hopefully that will make sense as you read this.  --Steven

Have you ever used your PC to play an MP3 or a DVD? If you answered yes, you’re among the overwhelming majority of PC customers who use their computer for audio and video applications, encompassing everything from watching a movie to playing a game to viewing a YouTube clip. But you may have also had an experience where your audio or video wasn’t quite perfect – perhaps the video was a bit choppy or the audio stuttered. We call this a ‘glitch’ – a perceived discontinuity in your audio or video that interrupts the playback experience. In this blog post, we’ll be focusing on audio glitching: we’ll examine the ecosystem challenges that can cause glitches, and we’ll discuss the work we’ve been doing to improve the Windows 7 experience.

 

What Causes Glitching?

In previous posts, we’ve touched on a variety of ecosystem initiatives and challenges that we’ve undertaken for Windows 7, including application compatibility, accessibility, and system performance, among others. Tracing the root cause of audio glitching leads us to a similar place: because Windows runs on a huge variety of hardware configurations and multitasks between dozens of applications, it is challenging to ensure that all of the programs and drivers running on your computer will work together in exactly the way you expect.

Audio is especially sensitive. In order for you to hear music from your speakers, data needs to be delivered to your audio hardware approximately every 10 milliseconds, or 30 times in the blink of an eye! The challenge is that your PC is usually doing a lot of other things at the same time you’re listening to music, such as streaming that YouTube video or downloading that new song, and many of these other tasks have complex timing requirements as well. As you can imagine, it doesn’t take much – a slow network driver or a graphics driver that requires plenty of CPU time – to prevent your audio from reaching your ears in a continuous fashion.

So what are we doing to address this challenge? The answer is ‘lots!’ – and the remainder of this blog post will be devoted to discussing these things:

  1. Gathering data in order to characterize the problem
  2. Developing a systematic method to detect and analyze glitches
  3. Getting these tests and tools widely deployed, both at Microsoft and by our Windows partners
  4. Engaging with partners to detect, diagnose and fix glitching issues

Who Experiences Glitching?

In studying this during the Windows 7 development cycle, our first order of business was to gather data. We‘d heard reports of audio glitching, but we didn’t know the exact scope of the problem. How often do users hear their audio glitching? Are there certain machines that were worse than others? With these questions in mind, we set out to understand our problem space a bit better.

We gathered data by using the telemetry infrastructure built into Windows, which allows our users to report back to Microsoft with performance data and other statistics that help us improve the OS. For each machine that opted to contribute data to Microsoft, we measured the number of times that the underlying audio hardware was being starved for data (i.e., when the user might hear a glitch). This data was grouped into “sessions,” each of which represents the data collected on a single machine for a single day or the data collected between machine reboots, whichever is shorter.

Let’s dive into some of the results. First, let’s look at the overall rate of audio glitching:

Figure 1: Distribution of Glitch Counts per Session

Figure 1: Distribution of Glitch Counts per Session

The chart above shows data from external (non-Microsoft) RC users. Approximately 80% of sessions showed no glitching at all, but 4.3% showed 10 or more glitches, which indicates that audio glitching affects a significant number of users.

Once we figured out how often glitching occurs, we started looking into why it occurs. First, we broke the data down by laptop/desktop form factor:

Figure 2: Glitching Likelihood by Form Factor

Figure 2: Glitching Likelihood by Form Factor

From this data, we noticed that laptops were almost twice as likely to experience audio glitching. As a result, we’ve made sure to address and target mobile PCs as well as mobile scenarios (for example, playing music while running on battery) for better coverage in our glitching tests and diagnostic tools.

Next, we looked at glitching likelihood by PC manufacturer:

Figure 3: Glitching Likelihood by PC Manufacturer (Mfr)

Figure 3: Glitching Likelihood by PC Manufacturer (Mfr)

This data showed that certain manufacturers were more likely to be susceptible to audio glitching than others. As a result, we made sure to spread our testing efforts across a wide spectrum of machines and manufacturers. In addition, we are using this data to work with manufacturers to see if we can identify components or specific causes that would result in higher glitch incidents.

Finally, we looked at glitching on a wide variety of PC models:

Figure 4: Breakdown of All Glitch Sessions by PC Model

Figure 4: Breakdown of All Glitch Sessions by PC Model

In the chart above, we examined all of the sessions that had at least one glitch, and we looked for any correlation with the PC make and model as shown in the table above (actual machine names have been anonymized). The first thing to notice is that Machine A is responsible for more than three times as much audio glitching as any of the other machines on the list. This data confirmed earlier reports of audio glitching on this particular machine, which we traced to a graphics card that shipped in a faulty configuration. As a result, we were able to work with the manufacturer to improve the configuration.

This chart also helps to show how widespread the issue is. There were hundreds of PC models that showed evidence of glitching – in fact, it seemed difficult to find a single PC model for which audio glitching did not ever occur. On the other hand, most individual machines didn’t show any problems at all. The conclusion that we drew was that audio glitching was not caused by any one hardware configuration, but was dependent on all the different hardware and driver permutations a user could possibly encounter on their machine. It was clear that no machine was immune, and in order to improve the experience, we were going to need a far-reaching, system-wide solution to this problem.

Developing Tools to Diagnose Glitching

Once we had data on when and why glitching occurs, the Windows Devices & Media Performance team developed a comprehensive suite of tests that were centered around media playback scenarios and were designed to assess how well a PC performed at that scenario. During media playback, these tests recorded thousands of statistics about the system’s performance, including CPU load, the activity of all components on the system and their corresponding interactions, and whether glitching occurred, among other things. We intentionally covered a huge range of scenarios and configurations, including laptops running on battery power, hardware under stress, hundreds of media content types, and many more. The goal was to exercise each PC in a wide variety of user scenarios in order to uncover and isolate audio glitches.

In addition, the Devices & Media Performance team created a graphical tool to highlight glitches as well as the CPU activities that occurred before and during an audio glitch, which allows us to quickly diagnose any glitching problems that we uncover. For example, in the figure shown below, we can see a visual representation of when glitches occurred, and we can display related measurements that occurred at the time of the glitching in order to easily pinpoint any suspicious behavior.

Figure 5: Example Graphical View of Audio Glitch Troubleshooting

Figure 5: Example Graphical View of Audio Glitch Troubleshooting

In this case, you can see four audio glitches (shown by red vertical lines in the top panel). Two panels down, we have displayed calls to the CPU that took longer than 3ms (called long ISRs/DPCs). In this example, you can see a direct correlation between audio glitches and long ISRs and DPCs, which are procedure calls executed by the operating system that have the potential to hog the CPU and produce audio glitches. From here, we can track down the components responsible for these calls in order to reduce or eliminate the glitching. This figure shows additional information than what we used to diagnose the particular problem discussed above; however, this information and the many other measurements are available to diagnose other glitches and media performance issues from across a wide range of sources.

Putting the Tools to Work

Armed with these tests and tools, our next step was to deploy them on as many systems as possible. As part of this effort, we are participating in a Windows-wide initiative to help OEMs test their PCs at or before ship time. Hundreds of OEM machines get shipped to Microsoft for use in our Windows lab where we run thousands of tests in order to validate and ensure the best user experience. What this means is that if we notice that a particular machine or configuration might be susceptible to glitching, we can work with the OEM to try to fix the problem before the consumer ever sees their new PC.

By running these tests and analyzing the results with our new tools, we’ve been able to find hundreds of potential issues that would result in audio glitches. In some cases, this analysis resulted in changes to the Windows code. In other cases, we have identified components developed by our partners that can lead to audio glitching.

Engaging with Windows Partners

Since the issues we identify with these tools often involve components from many different partners, an important aspect of this work is engaging with these partners. Until now, it has been almost impossible for manufacturers to know how their components will affect the system as a whole, but by making these tests and tools available, we are attempting enable these partners to see how their components interact and what the final impact on users will be.

As part of this effort, we have been working to ensure that our partners can take full advantage of these new tools and tests. We’ve talked with OEMs, ODMs (original design manufacturers, who traditionally assemble the PC for the OEM), hardware manufacturers, and software vendors. We’ve given presentations and tutorials, written whitepapers, and held video conference workshops. Our goal has been to make it as easy as possible to create glitch-resilient software and hardware.

In summary, this effort includes:

  1. Sharing audio glitching telemetry data with our partners. Our partners have had very little concrete data on the prevalence of audio glitching. With the data we are now collecting, we can help them to diagnose problems and improve their products.
  2. Running our suite of audio and video performance tests on the hundreds of machines that OEMs send us and communicating the results to our partners. By assessing as many systems as possible and providing these results, we begin to tackle the causes of audio glitching.
  3. Providing the tools and support that enable our partners to understand how their components are interacting with everything else on a PC and enable them to more easily address the subtle issues that can result in audio glitching.

What’s Next

Ultimately, we and all of our Windows partners share a common customer (you!); by working with our partners, calling attention to these issues, and providing more insight into the root causes of audio glitching, we are continue to improve the audio experience for everyone.

Leave a Comment
  • Please add 3 and 8 and type the answer here:
  • Post
  • @Jalf

    Are you sure you;re using Win 7 and RC? Didn't the Up/Back button make a 'by popular demand' return?

    @Hairs

    you do understand that much of the code that causes problems is the third-party driver code that Ms doesn't write? Creative and HP and the rest need to raise their game, but they don't always see the value in updating drivers for existing hardware for new OS releases when they make more money by selling new hardware.

    I want to see Microsoft create an open and unbiased system for naming and shaming vendors who create buggy drivers that are so poor they negate the value of installing a whole service pack, vendors whose software slows down my system or decreases my battery life and vendors who consistently don't provide new drivers. I know it would make Ms unpopular with vendors and it would have to be completely accurate and legally vetted, but it would have huge user benefit. Ms already knows exactly which drivers crash most often and applies behind the scenes pressure, but I'd like to know when I choose a new graphics card if I'm picking one from a company that's often responsibly for buggy drivers, slow updates or power hog products. And if an AV product requires a ridiculous number of reboots to install an update (which I often see critiqued as the fault of Windows in Win v Mac comparisons) and then proceeds to eat 20%+ of CPU, I want Ms to be saying that this isn't acceptable.

  • @marypcb:

    No, sorry, they didn't put back in the up button.

    Instead, they made the breadcrumb bar much more aggressive at keeping the parent folder available to navigate to.

    I still prefer an up button, but I guess it's a compromise I can live with.

    The "back is sometimes up" excuse is frankly a copout (it almost never is).

    Frankly, I want to go up far more often than I want to go back.

    This argument all goes back to how we deal with file management. There are two lines of thinking: "spatial" file management (using multiple windows) and "navigational" file management (a single window with a tree view on left) There's been arguments about what's the "right" way for a long time, and it's unlikely to be resolved soon.

    http://blogs.msdn.com/e7/archive/2009/03/13/a-few-more-changes-from-beta-to-rc.aspx

  • "I'm not impressed by win7's search either, and to be honest, preferred the one in XP. Yes, it was primitive, it wasn't integrated into explorer and it was slow, but it found my files, guaranteed, all the time."

    That's a joke, right? Not only was XP's search functionality appallingly slow but it wouldn't find the file I was looking for 90% of the time - and that's without even taking into account the stupid cartoon dog. With Vista and Win7 the exact opposite is true, as it's very accurate and incredibly fast. And the search functionality in the Start Menu allows me to launch apps in a fraction of the time, as I can't just press Win and type in 'calc' to get Calculator. It's an immense time saver. I'm quite surprised to hear someone complaining about the search functionality in Vista/Win7.

    As for the "Up" button debate... the breadcrumb supersedes it. You can move about with much greater precision and you still have the Back button when using conventional navigation (unless you're typing in addresses manually it will always take you to the next folder up). Don't resist the change, embrace it. I don't even think about it anymore, as I'm so used to Vista.

  • Strange how the threads here get off topic.

    The search function in win 7, seems to be fast, so why complain?

    Since there are no keyboard shortcuts to open aall programs, you need to use windows and land in the search field. For experienced users who knows what to search for, but is not good at shortcut keys searching for part of a program name makes sense. But for people who are used to navigating the start menu by first letter navigation and only using the keyboard you land too often in the search field. Another problem is the start menu at least all programs is now a treeview rather tthan the xp list with sub menues. At least for blind users this will sometimes give strange results or unexpected results.

    I would like a keyboard shortcut to the search field or another shortcut to all programs, this would solve these problems, and maybe stop all of us that want to have the old xp start menu back.

    The search is fast, but if it also searches in mails,it can report too many ansers. I have not really searched for files, but hopefully this is more accurate and faster than in XP. The last good search tool from MS was in windows98, but there may be search settings where I can customize the search behavior.

  • Microsoft needs to separate real-time search including real-time content search and indexed search. The last real-time search which was fast compared to Windows Search 4.x was in Windows 2000/XP's Classic search. If the item is already indexed, then Windows Search 4.x is much more quicker at returning results. For near instantaneous real-time search, I now use Agent Ransack.

  • @marypcb

    Blaming the vendors for not reacting to the change may be a valid point, but it doesn't solve the *user's* issues, does it? And most important, MS decided to make the change to "pretend fix" kernel crashes - the code still glitches and crashes, it just doesn't have the same fallout when it does. Rule 1: Don't break the way something works if your new way of doing it is ALSO broken. MS created the WHQL to avoid dodgy vendors creating bad drivers. By letting creative and nvidia drag on with dodgy, buggy drivers for over a year past Vista's launch, they damaged consumer opinion, and most important wasted users time. It also creates the cynical impression that new versions of Windows since 2000 are created to increase hardware sales for the benefit of OEMs and vendors, rather than to provide new useful functionality and improvement.

    @Jaquez

    My sentences say exactly what they mean. The only people who have no interest in running audio on their PC are corporate users who should run an image that has sound hardware disabled. To the average user, telling them, "Hey guess what your PC won't crash so much now, and that's all thanks to our brilliant new system of 'not letting you use the hardware!' Round of applause, guys!" is... err.. unhelpful?

    For the record, my audio hardware does not work under Win7. Ask me how many times I've had a system crash due to audio stack problems. Ehhh.. None. Guess which OS I will consider "broken" when faced with a choice.

  • @Hairs

    Your argument is clearly driven out of frustration rather than reason. If the audio system crashes, I can gracefully shut down my open applications, saving data as I go, and then restart the system when it is convenient for me (maybe after I have finished reading the important email my boss just sent me or after that big file finishes downloading). If the OS crashes, all applications just die, any tasks in progress are interrupted, state is corrupted and data is lost. Neither situation is desirable, but the former is clearly FAR better than the latter.

    And blaming Microsoft for buggy drivers written by third party sound providers makes it clear that you are only interested in hating Microsoft, not on honestly evaluating the situation. Microsoft makes the operating system, but they don't make the audio hardware, and they don't make the interface for the audio hardware. If you buy a sound system from Creative, it is  Creative's responsibility to support it. If they don't, it's their fault, not Microsoft's. As the OS vendor, it is Microsoft's responsibility to make sure that the OS remains stable even if the audio system crashes, which is what they did by taking it out of the kernel.

  • Another pet peeve of mine is the Desktop isn't shown in the breadcrumbs bar as the uppermost level which contains (My) Computer. You must click the tiny downwards arrow to access the desktop from the breadcrumbs because most of the times the Favorites group isn't visible in Windows 7 unlike Vista if you've navigated to a long path and the scrollbar is all the way down in the navigation pane. Also, if there is a button to toggle the preview pane in Windows 7, why not 1 more button to toggle the navigation pane like the XP 'Folders' button? I kinda agree Explorer has been on a complete downhill slide since Vista and Microsoft is merely turning a deaf ear to our issues.

  • I have found that the Vista subcoding sound API has caused a LOT more "glitching" than any previous of Windows. Even on the exact same computer (GA-EP35-DS3P, E6600, 4GB DDR2-800, 9800GT video) with multiple partitions (with XP SP3, Vista x64 SP2, Windows 7 RC v7100, Ubuntu 9.04), I have found that using this Creative X-Fi XtremeMusic sound card works very well in all of the OS I have, except for Vista. I have seen and experienced sound glitches in Vista since the day I started beta testing it (when it was still called Longhorn). I have even removed this sound card and used the onboard sound which only made things much worse in Vista (and did not even work properly in Windows7).

    So I really believe that removing the direct access to hardware I/O and switching it to a software based API has only made things worse. Increasing the work that the memory, chipset and CPU has to do means less direct I/O abilities and allowance for the hardware devices to do what they are meant to do, handle the code discreetly and directly without the need to direct everything (via software) through the CPU and everything else first.

    With XP, everything worked and worked very well without stutters or glitches

  • I have very serious audio stuttering when running Media Center (Im using Windows 7 RC). Sound becomes very distorted, very unpleasant.

    I have older computer(ASUS mb P4C800 Delux and Intel CPU at 3.0Ghz), but I think this computer is good enough for HTPC setup. I am testing Windows 7 to see if I should upgrade to it and have this kind of stupid problem in the only application I am going to use... However, when I watch the same movie using Media Player - the sound is perfect. Any suggestions?

    Leo

  • That's funny because my Amiga from the 80's could run a 32bit preemptive multitasking system on a 7.14Mhz CPU and could play complex wave form audio in stereo without glitching while the CPU is running at 100% doing spreadsheet calculations.  

  • Why would anyone wanted to get rid of hardware support? Why MS doesn't keep option to let sound be processed at HW level? This is kind of very unprofessional design. Why do I need to have software sound stack if I only going to use Media Center. The point using mixing sound for every applicaion separately is useless in that case.

  • I have seen and experienced sound glitches in Vista since the day I started beta testing it (when it was still called Longhorn). I have even removed this sound card and used the onboard sound which only made things much worse in Vista (and did not even work properly in Windows7).

  • My main issue is with the latency caused in sound card line in monitoring.

    For example, one was able to plug in a guitar into the line in and play and hear it realtime. And XP is in general a stable piece of OS. It hardly ever gives problems.

    But in 7, it has so much latency. There has to be layers of useless stuff going on if, I can't plug in a source and play it unprocessed without latency. This renders my machine useless. The prospect of going to XP is not very good either, since Windows 7 excels in almost all other aspects.

    For home recording studio owners, this is a big issue. There's always new gadgets but at the end of the day, one can plug in their guitar and record stuff at 1am for saving the idea. Real recording can be done later. I'm hesitant to move to recording interfaces since those might have the exact same issue due to the Windows 7 processing everything....

    As a windows user, I'd much rather have a real responsive system with glitches than one that tries to guess my needs. If a person is playing a file and trying to compile a 200 file C++ program and they hear glitches, then stop doing resource intensive stuff. I know how to stop glitches in that situation. But I don't know how to _make_ windows guess my priorities correctly.

    Is there a way to enable realtime monitoring bypassing the glitch resilient stack?

    Lastly, Windows 7 is a more stable and faster OS than XP. It has many positives, so not Windowsh 7-bashing here. Just pointing out an issue with my home studio which may require a rollback.

  • Nearly all developers from the professional audio market I know deprecate the way Microsoft handled the issue.

    Moving everything out of the Kernel introduces such a big latency that no one can use software monitoring anymore. Yes, you have less glitches but a system that is unusable for creating and producing music with it.

    If you follow the strategies of pro soundcard manufacturers you will find out that everyone will work around the windows audio system to keep the users happy.

    So at the end of the day, all developers have more work through this.

    best

    torcek

Page 3 of 5 (72 items) 12345