Reclaiming SATA for audio
I apologize up front for such a long post, but it covers a fairly deep topic which requires a lot of explanation. I did my best to make a long story short wherever I could, and placed links for deeper reading elsewhere. Still, it's definitely not the shortest post in the world, not by a long shot!
I have had some good success recently solving a thorny problem with clicks and pops while using SATA drives for audio. You'll find the gory details of my saga posted
here, but I'm posting the "short"
story here because:
- I am a fellow SONAR 3 Pro user
- Other posts in this forum greatly helped to identify the true nature of the problem, and thus, a workable solution
- Perhaps this post could help others in a similar predicament to dust off their SATA drives and reinstate them to useful audio service (which would be gratifying for me to know).
My configuration is as follows:
ASUS A7N8X Deluxe, Athlon XP 2500+, 1GB RAM Dual-Channel
Enabled onboard peripherals: nVidia LAN, nVidia audio (for system sounds), Firewire, USB (all)
ATI RADEON 9000 Dual-Head
Seagate 80G PATA System Drive
2X Seagate 80G SATA RAID 0 Audio drives
Terratec EWS88D, connected via ADAT to...
...Fostex VM200 Digital Mixer
After some fussing, I have successfully managed to take this system from a glitchy nightmare (even with a measly two tracks) to being able to simultaneously monitor 36 tracks, evenly split through all eight outputs on the soundcard, all while recording on all eight soundcard inputs to eight more tracks, and all without a single glitch!!
Here is the recipe that worked for me (and maybe could work for you):
1) Start where you finished off before. Resolve all IRQ conflicts, and be sure to place your audio card in a non-IRQ-shared PCI slot. Look in the PCI table of your motherboard manual for the highest-priority slot that does not share with another device or another slot. (For the A7N8X Deluxe, the PCI table is on page 17. You should use PCI Slot 4, preferably with no other slots filled.) Don't worry about taking your computer off of ACPI. Judging by other posts, it doesn't make any real difference. I have ACPI enabled and it works fine for me.
2) Install and learn to use
SiSoft SANDRA. This utility reveals secrets about your machine that you never knew existed. Lots of other great performance-testing stuff, too. The PCI info tool will be very useful for verifying the values of the PCI latency timers (more on that later) for every device that hangs on the PCI bus, either logical or physical. (BTW, some of the logical ones will surprise you, too, like the AGP controller for instance.)
3) Install and learn to use a good PCI utility. I do recommend one near the end of this post. If you're interested enough, then read on...
The SATA glitching problem has been discussed at length
elsewhere in the Cakewalk forums and in others as well. In short, it manifests as annoying
glitches (pops and clicks, but
not to be confused with dropouts or stutters) either in playback, recording, or both. The glitches cannot be resolved by any of the standard means, i.e. isolating IRQ's, swapping slots, adjusting audio buffer latencies, yelling at tech support
etc.
The problems are typical for systems configured with:
- an early-design motherboard (i.e. with the nForce2 chipset) featuring onboard SATA, and
- a PCI card for audio I/O, and
- a SATA (or SATA RAID) drive for audio.
The problem has been explained as follows. These earlier SATA motherboards implemented their SATA interface using a controller chip separate from the processor's chipset (on mine, it's the Silicon Image SiI3112). Such SATA controllers are hardwired onto the PCI slot bus, and as such, they must share bandwidth with any and every other PCI card plugged into a PCI slot on the motherboard. Later motherboards integrate the SATA controller into the Southbridge of the processor chipset, and so do not appear to show this problem. Technically, the entire PCI slot bus must communicate with the CPU through the PCI-PCI bridge controller, which in turn bridges the internal high-bandwidth PCI bus to the external one with physical slots running (typically, now) at 66MHz. This causes a bottleneck for high-demand PCI devices like the SATA drive, which then tend to choke the PCI bus from other devices, particularly the sound card, thus leading to the glitches. The problem is fundamental to PCI bus communication and as such, it goes deeper than your typical IRQ and buffer settings.
Like
other posts to this forum, I found out too late that my configuration fit this profile perfectly. My system exhibited the same steady stream of random pops, clicks, and other garbage while monitoring recorded audio from the SATA RAID drive set. At first I just threw my hands up in disgust, but not long afterward I started digging for a solution.
Frankly, such a design limitation really stuck in my craw as a professional researcher. Besides, I knew that the numbers just didn't square up: PCI 66MHz = 66 Msamples/sec at 32 bits/sample = about
1500 tracks at 44.1kHz/32bits (accounting for 24bit samples "unpacked" into 32 bits). Of course, the disk drives themselves would top out way before that (SATA, RAID, or otherwise). Rather, this astronomical number is the theoretical maximum for the external PCI bus itself (bridge controller included) with 100% bus usage by one device, going one way only. So, in terms of raw bandwidth the 66Mhz PCI slot bus is far from a bottleneck, in principle at least. Way far. Adding the audio card only adds a relative few "effective" tracks, even if its I/O capacity is maxed out (in my case, 8I/8O for ADAT).
So, just exactly where is the beef? How do we account for the discrepancy? In general, the major source of overhead for buses lies in how the various devices sharing the bus cooperate with one another. Think of a bunch of kids taking a drink from a water fountain. Plenty of water for everyone, but the kid at the front of the line with the mouthful of water needs to
get out of the way for the next kid in line, or the whole thing grinds to a halt. The SATA controller is like the big kid in front who just won't get out of the way.
So, how to solve this dilemma? I actually stumbled upon a solution that worked for me (and hopefully, for you too). I have yet to hear about anyone else repeating success with this particular problem, besides myself and some gamers. I'm sure I'm not the only SATA audio head that can be helped by this.
The secret for me was revealed by none other than Silicon Image's tech support (that is, after they spoke with their software engineers). It revolves around what are called
PCI latency timers. Scouring the web turned up a lot of interesting info on this intriguing, important, and neglected topic. (One of the better examples can be found
here. You'll find some fascinating material if you read past all of the gaming talk.)
In short, these low-level timers are part of the PCI specification, and regulate how long any PCI device is allowed to lock the PCI bus before yielding control to the next device requesting bus access (e.g. through the IRQ mechanism). The values for these timers range from zero to a max of 255. Zero means the device is extremely cooperative, and 255 means, basically, that it is a PCI hog. The value of this timer relative to those of all other PCI system devices therefore has a huge impact over how the bus will be shared by all other active devices. Now some points:
- Some BIOS's provide settings for these values, and some don't. If they do, it may be for only a limited number of onboard controllers, usually the AGP controller.
- There is no industry standard for the default values of these timers. Most motherboards, to be as universal as possible, just pick a number out of thin air.
- (This point trumps the other two) BIOS settings are allowed to be, and for the most part are, overwritten by device drivers, to whatever value the hardware manufacturer thinks is good for them. Since performance is maximized with high values, you can guess that these values will be set as high as they think they can get away with. For example, AGP cards usually show up just under 255.
Being able to access these timers opens up an entirely new level of control over the flow of time-critical data through the system. So the logical, pivotal question is: How do we get at these timer settings?
A lot of freeware utilities are available on the web,
here and
here for Win9X/Me and
here for Win2K/XP. But instead, I recommend a shareware utility called
PowerStrip since it is much more user-friendly and provides access to various "locked" timers. Also, it does a good job integrating with Windows seamlessly; for instance, it can be configured to run automatically at startup. As Martha Stewart would say, that's "a good thing", because otherwise the timers will be set back at their good old values by the device drivers as they load.
I also recommend that you read up on how to use the PCI utility. Good info
here, and PowerStrip has a user forum. Generally, the philosophy is to set the latencies high enough to get the needed performance,
and no higher. To give you an idea, the default bootup timer settings on my system were as follows (as conveniently reported by PowerStrip):
RADEON 9000 Output 1: 248
RADEON 9000 Output 2: 32
Terratec EWS88D: 32
SiI 3112 SATA: 32
The 248 on the graphics 1 was too high, and the 32 on output 2 was too low. (Yes, it can be too low. Setting the graphics to zero in my case resulted in repeatable dropouts in SONAR, just because the graphics couldn't keep up.) Also, the Terratec and SATA had the same values. Tweaking for optimal performance with two tracks resulted in these settings:
RADEON 9000 Output 1: 88
RADEON 9000 Output 2: 88
Terratec EWS88D: 32
SiI 3112 SATA: 16
Those settings carried through to the 44-track glitch-free scenario described at the top of this post. Well, if you've been patient and/or interested enough to read this far, then I know that you're patient enough to try some of these fixes! If you do manage to reclaim your SATA/RAID drive for audio, then post and let me (and I suppose, the rest of the world) know that it worked. If not, well, I guess that would be useful information, too. But surely, I couldn't be the only person that this works for (besides gamers, that is)?