Recording and Production Tech Notes
Optimizing your Windows PC for audio
The causes of glitches
Windows is a multitasking operating system. It can run many applications simultaneously by processing each in turn for short intervals. However, it is not a real-time operating system, so there is no guarantee that any particular task will be processed in any given time interval. This is a problem for audio applications which must handle audio signals at the soundcard's sample rate.Audio applications buffer digital audio signals in blocks of memory that hold many samples of the audio signal. When playing audio, the application passes each buffer in turn to the DAC which then empties it one sample at a time. The application must ensure that each new buffer is available before the DAC has finished the previous one, or else there will be a drop-out in the audio stream. Similarly, in the record direction, the ADC fills up each buffer, one sample at a time, at the soundcard's sample rate. The audio application must have processed each buffer before the next one is filled.
Multitasking operating systems work better with larger buffers, because there is more time for the processor to handle other system tasks between servicing the buffers and hence less chance of a glitch.
The trade-off is audio latency; the larger the buffer is, the longer it takes an audio signal to make its way to or from the soundcard. This does not matter when simply playing back or recording audio, but it becomes an issue when you must do the two together, for example when overdubbing in a DAW. In these cases, you may need to optimize your system.
Making it work
In order to make sure that we can get audio through without interruptions, we need to know how fast the computer can process the data - this is where DPC latency comes in. A Deferred Procedure Call (DPC) is a mechanism used by Windows for performing urgent critical tasks in the kernel. Ordinary windows processes, such as DAWs or ASIO drivers, are locked out whenever a DPC need to run.Windows itself makes sure that all its DPC tasks can run very quickly in order to protect applications such as those which stream media. However, third-party device drivers, which also need DPCs, are notoriously inattentive to this need. The combined effect of all driver and system DPC tasks can be measured as the DPC latency of the system. Low DPC latency will result in a system which is less likely to cause errors in the audio. In practice we are looking for the DPC latency to be consistently well below 1ms (1000µs) to avoid audio glitches. Note that it is the worst-case duration of an individual DPC which interests us, not any sort of average, since a single long DPC can cause an audible drop-out.
Measuring DPC latency
A number of free tools are available to measure DPC latency. The DPC latency checker by Thesycon is free for non-commercial use but (as of May 2013) doesn't yet work with Windows 8. Another one that does work with Windows 8 is LatencyMon by Resplendence (Vista and later, free home and paid pro versions). Both of these can tell you the level of latency you are experiencing.Screen-shots of Thesycon Latency Check showing bad DPC latency (left) and good DPC latency (right)
The red lines in the left screen shot above indicate periods when the DPC latency went too high. These are usually caused by device drivers taking too long with their DPCs.
Finding and fixing problem drivers
Finding the problematic drivers is much easier in Windows Vista and later since there are tools to point you in the right direction. In most cases LatencyMon will find the drivers responsible for the delays. There is also the Microsoft Windows Performance Analyzer from the Windows Assessment and Deployment Kit which is available free from Microsoft which has some useful tools (Windows Vista, 7 and 8). In particular the DPC CPU Usage Summary Table, which can be sorted by duration to bring the main culprits to the top. See the Sysnative DPC latency tutorial for information on installing and running this.For Windows XP you will need to experiment by disabling different drivers one at a time using Device Manager and checking to see if the latency problems have improved.
WARNING: disabling some devices will render your system unusable. Only disable those devices you KNOW you can do without and which other devices are not depending on. If in doubt, don't.
Disable drivers by going to "Control Panel" → "System" → "Hardware" → "Device Manager" right click the device and select "Properties". At the bottom of the "General" tab is a "Device usage" drop-list. Set this to "Do not use this device (disable)" to test whether this device is the problem. Once you know what drivers are causing the problems, you need to work out what can be done about it. The first course of action is to find updated drivers and re-test. Next, look for work-arounds (different settings etc.), and thirdly, (if practical) removing the offending item or leave it disabled. Anecdotal and scant hard data suggests that the main suspects are often the motherboard chipset drivers (update, but don't disable), WLAN/WIFI cards, network cards, modems, USB devices and internal sound cards although power management also seems to be a source of grief.
Further ways to optimize your PC
The other half of the battle with helping your computer to be able to cope is to tune it for audio and reduce its work-load. If you are experiencing problems, the table below is a list of things you can try. Not all will be applicable to all systems, and even those that are applicable may not help. Please treat each with caution and satisfy yourself that what you are doing is sensible in your particular usage scenario. We have not attempted to give detailed instructions or tutorials for these, but just a pointer to get you started and some ideas that you might like to research. At the bottom of the page are some useful links. Please also note that things change: some of the suggestions made here will soon be out of date and some refer to problems with older versions of Windows/drivers/programs that have already been fixed in current versions.Things to try | |
+ | Increase the buffer size |
You can control the buffer delays within the Windows drivers directly, irrespective of what buffering is employed by the particular audio software. It is generally recommended that these buffer delays are set long, in order to provide best stability. However, for the user with a powerful and tightly-optimized setup, who has contained audio processing tasks and needs low latency, the buffer delay can be minimized. For more information, see the manual for your unit. For a detailed discussion specific to Prism Sound Lyra, Titan and Atlas units, see also this technical note on buffer settings in Windows USB drivers.
|
|
+ | Bypass the computer hardware where possible |
For foldback and over-dubbing situations, your equipment (e.g., Lyra, Orpheus) may have a mixer capability which can mix the unit's inputs with each output's computer feed in order to build a dedicated monitor mix with extremely low latency. Incoming audio to the mix doesn't have to go in and out of the computer at all - the mix is handled within the unit's hardware itself.
|
|
+ | Make sure you have enough RAM |
Nothing kills a computer's speed quite like running out of memory and having to access the swap file. Making sure you have enough RAM is essential. Don't worry if recent operating systems seem to want to use it all: this is usually a good thing - it means it has loaded the DLLs you are likely to want into memory so they are available fast without having to read them off disk. Unused RAM is wasted RAM - if the system suddenly finds itself needing more it just drops something it has pre-emptively loaded with very little time penalty.
|
|
+ | Set "Processor Scheduling" to "Background Services" |
This is a Windows setting. It is accessed via "Control Panel" → "System" → "Advanced" → "Performance Settings" → "Advanced" → "Background Services"
The reasoning is that setting the processor scheduling to "Background Services" makes the CPU scheduler gives more priority to tasks that are going on in the background (including audio processes such as ASIO) at the expense of foreground threads. |
|
+ | Check the computer's power management scheme |
Primarily for laptops running on batteries, Windows can slow the processor to conserve power. For audio, we don't want this. For preference, run with a power supply, but if not, then check that the power scheme allows the processor full rein. "Control Panel" → "Power Options" → "High Performance" (terminology may vary with different versions of Windows). While in here, it's worth making sure the computer can't shut down the hard disks or the monitor.
Disable USB Selective Suspend: Windows can selectively suspend USB devices to save power but this can cause problems for USB audio devices. This setting is in "Control Panel" → "Power Options" → Advanced Settings → "USB Settings" → USB Selective Suspend. In XP the same thing is achieved by going to "Device Manager" → "Universal Serial Bus Controllers" and opening the Properties of each "USB Root Hub", going to the "Power Management" tab and turning off the option to "Allow the computer to turn off this device to save power". One device known to cause problems with DPC latency is "Microsoft ACPI-Compliant Control Method Battery" which can be disabled in the "Batteries" section in "Device Manager". This can have side effects so best to read up on it first. |
|
+ | Turn off wireless networking and Bluetooth |
Wireless networking is a notorious source of problems with DPC latency (see above), Bluetooth not so much so, but if you're not using it, why have it loaded?
|
|
+ | Disable CPU dynamic frequency scaling. |
This is usually a BIOS setting and relates to a feature of most modern CPUs that enables them to slow down their clock to save power. It may be referred to as SpeedStep (Intel) or AMD Cool 'n' Quiet, or PowerNow! etc. Although this can save power, it can also interfere with audio performance.
|
|
+ | Disable ACPI C-States |
Within the ACPI specification are several CPU processor states which include states for stopping the CPU clock which can interfere with real time processes such as audio. This will be a BIOS setting and will probably be called something like "Disable CPU Idle State for Power Saving".
|
|
+ | Isolate your computer from the internet then disable security |
WARNING: Don't disable security if you are connecting to the internet or loading unknown files onto your computer.
Anti-virus software, anti-malware and anti-spyware are highly intrusive and can cause a significant impact on audio performance, particularly if they are set to continuously monitor your system. In an ideal world you wouldn't need them, but the reality is that if you are connecting your PC to the internet, you should not disable them... and you're going to need to connect the PC to the internet to keep its drivers and software up to date. Disable them only after disconnecting from the network. You can also disable the firewall if you are not connected to a network. If disconnected from the network, you can also disable Windows Explorer's "Automatically search for network folders and printers". From Windows Explorer → "Tools" → "Folder Options" → "View" and look in the "Advanced Settings" checklist. You can also disable "Offline Files" if you are not using them, still in "Folder Options", go to the "Offline Files" tab and uncheck the "Enable offline files" box. |
|
+ | Avoid scheduled tasks (Windows Update, Defrag, backups etc.) |
This would be things like software that checks for updates periodically (Windows Update, anti-virus definition updates, program updates etc) or processes that are set to run on a scheduled basis (Disk defragmenters, backups etc.). They will probably attempt to run when it is least convenient (don't they always?) and you may regret it. Programs that check for updates automatically should also provide an option to check manually when it's convenient (Windows Update included).
Another side to this issue is that you should never run updates just before an important session; you don't know what will break. This is particularly important when recording. Always run your machine in a known state and with known connections. It can be very difficult to know how close your machine is to the limit and just enabling one more plug-in or connecting a memory stick could be all that it takes to cause the processor to run out of time and get a glitch in your audio. Do your updates when you have sufficient time to test them and work around any issues that occur. Other Timed Processes:
|
|
+ | Turn off Windows Search / Google Desktop etc. |
Windows Search was built in to Windows beginning with Vista and uses disk and processor time while indexing, potentially interfering with audio threads. Prior to this, XP also has an Indexing Service to speed up searches. Other search tools and file organizers that build an index do similar things (including photo library applications etc.). How you disable this will depend on your operating system and the installed search system and is the subject of numerous tutorials on the internet. To disable indexing on a particular drive in Windows, you can right-click on your hard drive in Windows Explorer, go to Properties and uncheck the option to allow the drive to be indexed (terminology varies here with different versions of windows). Even better, you can disable the indexing service from the computer management interface. It's called "Indexing Service" in XP and "Windows Search" in later versions - set to "Disabled" and then stop it.
|
|
+ | Disable visual effects (Aero etc.) |
What options are available here will depend on your operating system, but essentially many of the things that make modern computers look nice also make them run slower. The quickest way to fix this in Windows is to go to "Control Panel" → "System" → "Advanced" → "Performance (Settings)" → "Visual Effects " and select the 'Adjust for Best Performance' radio button. This may be a bit extreme and un-necessary depending on your system, and just using a simpler theme may be sufficient. It is primarily the animations that are the problem and disabling them can make a big difference. On the other hand, much of the graphics heavy lifting is handled by the graphics card and you may not notice much difference.
|
|
+ | Optimize your drives |
In addition to making sure your drives are physically fast, there may be some options to make sure you are getting the best of them in your OS. In Windows if you right click on the drives you are using for reading or writing audio to and select "Properties", in the "General" tab, make sure "Compress drive to save disk space" and "Allow Indexing Service to index this disk for fast file searching" are both unchecked. In Vista and later, there will also be an "Enable advanced performance" checkbox in the "Policies" tab. This uses a different caching mechanism and carries an added risk that if there is a power cut while there is data in the cache waiting to be written to disk will get lost unless you have a working battery or UPS backup, but should give some performance gain.
For audio PCs it is a good idea to use at least two hard-drives; one for the operating system and a separate drive or drives for the working audio files. This not only gives a speed advantage but there are advantages if you need to rebuild the computer or you want to transfer the audio to a different computer. Remember to back it all up and defrag (don't defrag SSDs). If supported, make sure AHCI and NCQ are enabled. |
|
+ | Disable your screen-saver |
Particularly if it is a CPU intensive one! Screen savers were useful for CRT monitors and plasma displays to prevent burn from static images, but, apart from privacy concerns, they have no use on LCD monitors and can be very disruptive to workflow and audio.
|
|
+ | Watch out for plugins |
It's fairly obvious that plug-ins use CPU cycles. It may help to disable as many plug-ins as possible during recording and only enable them during editing when the audio is already captured safely to disk.
|
|
+ | Start-up items / system tray / widgets / sidebar |
Most new PCs come with a range of little craplets installed that the manufacturers think "add value" but typically are more of a hindrance. There are quite a few tools out there now for removing them automatically. If you have the option, installing the OS from scratch is likely to be better than having to attempt to remove them.
bloatware Similarly many hardware devices come with disks that install bloated drivers and "free" applications of dubious merit (printers and cameras come to mind). It's often worth attempting to use them without installing the supplied drivers and seeing if Windows can either use its built in drivers or locate appropriate ones. Unwanted start-up items There are also tools for locating and disabling unwanted processes that start up with your computer. This can include software updaters and utilities that you never use. Have a look at Piriform ccleaner, and Autoruns from Sysinternals for a couple of useful tools. Note that these are quite low level tools and it's possible to do quite a bit of damage to your computer if used without care. |
|
+ | Keep drivers updated |
Unfortunately this isn't always the panacea we would hope as the average driver update will not make things quicker and lighter. As a general principle though, if you're having problems, check for driver updates as known issues and bugs should be getting sorted out.
|
|
+ | Check for Windows hotfixes |
Here are a couple:
|
|
+ | Disable Remote Access |
If you don't need to make the computer available to be controlled remotely, you can disable it. "Control Panel" → "System" → "Remote (tab)"
|
|
+ | Disable System Restore |
While this may be useful, it is a resource hog. If you have other means of recovering your computer in the event of a failure (e.g., drive image etc.) you can disable it from "Control Panel" → "System" →"System Restore".
|
|
+ | Turn off System Sounds |
For an audio optimized computer, this is pretty much essential as the computer will otherwise be loading up and playing beeps and bongs which may interfere with your audio. On Windows, go to "Control Panel" → "Sound" and under "Sound Scheme" select "No Sounds".
There's more though. Windows doesn't even need a sound card to beep at you; it can even beep through a system speaker. There are several levels to stopping it. Have a look at this tutorial on howtogeek.com for details. |
|
+ | Stop other programs using your soundcard |
You may be able to prevent other applications from putting notification beeps etc, through your audio production sound devices by preventing them accessing the driver. Getting at the setting is a bit long winded: You can either go via "Device manager" to the audio device properties, or via "Control Panel". The latter route is: "Control Panel" → "Sounds and Audio Devices" → "Hardware" select your audio interface from the list, "Properties" → "Properties" (this is the tab of the resulting device properties window which is also accessible via Device Manager), expand the "Audio Properties" section of the tree, and click the "Properties" button of this audio device. Here there are two checkboxes of interest "Do not map through this device' and "Do not use audio features on this device".
The effect of these checkboxes is not immediately obvious and will depend on the underlying audio architecture you are using. Both checkboxes relate to the device driver: "Do not map through this device" is meant to prevent programs from using the device driver unless they specifically request it. The "Do not use audio features on this device" is intended to prevent programs from using the device driver at all. In the latter case the driver is not removed, but it is not loaded when you start the computer. The somewhat counter-intuitive thing here is that this may not stop the device hardware being accessible to ASIO or DirectSound. Whether another program can access the device will depend on the audio architecture it is using and that will depend on the operating system! A little experimentation with your particular system is probably in order. |
|
+ | Prevent concurrent users |
Most modern operating systems allow multiple users to use the same computer and share its resources by means of "Fast User Switching" (rather than logging out and logging in again, you can "switch user"). This means that multiple users can be logged into one machine concurrently and share the same resources, including sound. Unless you have a compelling reason for keeping this, it should be disabled. In Windows, from "Control Panel" → "User Accounts" → "Change the way users log on or off" and uncheck "Use Fast User Switching". This option will not be available on computers that are part of a Windows domain. |
|
+ | Remove un-used Windows Components |
There are likely to be some components of Windows that are of no use to you and which can be removed. From "Control Panel" → "Add or remove programs" → "Add or remove windows components". Some things you could consider uninstalling:
|
|
+ | Disable Error reporting |
There are times when you might want error reporting on, but while you are recording is probably not one of them. From "Control Panel" → "System" → "Advanced" → "Error Reporting" select "Disable Error Reporting"
|
|
+ | Elevate UAC (User Account Control) |
Windows Vista and later: This is not turning UAC off, but is bypassing the "Are you sure you want to do this?" type message boxes. Open the "Run" command and type "secpol.msc" to open the "Local Security Policy". Browse through the "Local Policy" to the "Security Policy", Click on the "Security Policy" folder. In the window to the right, Locate "User Account Control: Behaviour of the Elevation prompt for administrators in Admin Approval Mode" and change it to "Elevate without Prompting".
|
|
+ | Make sure your BIOS is up to date |
Check with your computer manufacturer's website whether you have the latest BIOS.
|
Useful tools and further reading
DPC latency checker by Thesycon XP, Vista and 7LatencyMon by Resplendence - Latency checker for Vista, 7 and 8
Microsoft Windows Performance Analyzer - from the Windows Assessment and Deployment Kit
Piriform ccleaner - startup, registry and file cleanup utility
Autoruns from Sysinternals - powerful program for finding things that run on startup.
wlanoptimizer - utility for reducing latency caused by certain features of some wireless LAN devices.
scottmetoyer.com blog - an example from a blog of diagnosing and fixing a DPC latency issue
Sysnative DPC latency tutorial - covers using Thesycon latency checker, Resplendence LatencyMon and Microsoft Windows Performance Analyzer