You are here

DirectSound

DirectSound hardware acceleration features can be very useful to PC musicians. They can be adjusted in the Audio page of the Control Panel's Multimedia applet.DirectSound hardware acceleration features can be very useful to PC musicians. They can be adjusted in the Audio page of the Control Panel's Multimedia applet.

Confused by DirectSound driver options? Martin Walker explains them all, recaps on the Millennium bug, and makes a packet with his CD‑RW drive.

Many people have now breathed a huge sigh of relief that the Millennium bug hasn't resulted in global chaos and anarchy. Those who were convinced that the end of the world was nigh have no doubt returned from their caves in the hills looking a little sheepish. We'll still have to wait until the end of February to see how January's payroll packages performed, and whether or not most software deals correctly with the leap‑year rollover, but, as I write this towards the end of January, the backlash has started.

Accusations are starting to fly that scaremongering caused some countries to spend far too much on bug related matters — some industry analysts have estimated that US businesses and government departments may have overspent by £25 billion. In contrast, countries such as Italy and Russia spent far less and still experienced few problems. Overall, the cost of work related to the Millennium bug is estimated to be some $400 billion. I hope you have experienced no difficulties with your own PCs, but do let me know if you have any music‑related software that's misbehaving, and I'll publicise it.

Live And Direct

This is AutopOle, a stereo filter that's one of the colourful new range of plug‑ins from FXpansion.This is AutopOle, a stereo filter that's one of the colourful new range of plug‑ins from FXpansion.

Despite the fact that most PC‑based musicians know that DirectSound drivers generally provide much lower latency than MME ones, there's still a lot of mystery surrounding them. So this month I thought I'd provide a few more details of the available options and how they work.

There are various levels of DirectSound acceleration, and you can select between them from the Multimedia applet of the Control Panel, using the 'Advanced Properties' button in its Audio page, or from the Sound page of the DX Diagnostics utility. You will find a slider, labelled Hardware Sound Acceleration level, which offers four positions: None, Basic, Standard, and Full. Microsoft say that changing these settings can help you troubleshoot audio‑related problems, although I've never heard of a situation where reducing the setting from the recommended 'Full Acceleration' was needed. However, describing the differences does explain DirectSound rather well.

With no acceleration, DirectSound forces 'emulation' mode. This is what cards without native DirectSound drivers will be using, and it results in high latency. Basic acceleration uses DirectSound to mix the output, via its software engine, but ignores any hardware acceleration features present on the card itself. This, I suspect, is the mode used by many music‑based soundcards with DirectSound drivers, although many manufacturers seem curiously reticent to specify exactly what DirectSound features they support.

The Standard setting uses output mixing and hardware acceleration, and means that digital mixing takes place on the soundcard using a hardware chip rather than the DirectSound software‑based mixer. This method reduces latency. Hardware mixing is one of the main features of DirectSound, since it reduces the load on the main system CPU. Soundcards such as the SB Live! provide such acceleration for up to 64 DirectSound streams, and up to 32 DirectSound3D streams. Other cards with hardware acceleration include the Emu APS, Guillemot ISIS, Sonorus STUDI/O, Soundscape Mixtreme, the Terratec EWS64 range, and the Turtle Beach Montegos.

The final, Full, setting also uses so‑called 'Property Sets'. These enable special hardware capabilities of the soundcard to be accessed, even though they are not officially recognised by DirectSound. Examples of such features include onboard effects such as reverb. The SB Live!, for instance, can be interrogated by games to see if it provides the correct response to a Property Set query. If it does, the game can automatically use the card's reverb facilities.

DirectSound uses a single 'primary sound buffer' for mixing sounds and sending them to the soundcard, and may also set up one or more 'secondary buffers'. Normally the primary buffer is managed by Windows and automatically takes advantage of any hardware acceleration on the soundcard, such as onboard memory and mixing facilities. However, it is also possible to write to this buffer directly. Some applications may do, in order to perform their own mixing of multiple audio channels, but if this technique is used then secondary buffers cannot be used as well.

Secondary buffers can either be 'static' or 'streaming'. Static buffers hold individual sounds — in games, for instance, secondary static buffers might contain single sounds that are played repeatedly, such as gunshots or explosions. Streaming buffers are far more likely to be used in music applications, which typically pre‑mix their sound data, to emerge as a single stereo stream sent on to the soundcard driver. Games may well use multiple streams to allow sound effects and continuous background music to be treated separately.

When a secondary streaming buffer has been created for a continuous sound, such as the output from a software synth, applications must periodically write new data to it, so that the streamed audio emerges continuously with no gaps or glitches. DirectSound uses a single buffer for streaming, to which the software application has to periodically write additional data to ensure that the buffer never empties. If this happens, the result is a glitch in the streamed audio output.

To avoid such glitches the software must either send large chunk of data occasionally, or a smaller one more often, and this choice of buffer size determines latency, since a response to fresh user input, such as a new note being played, can only happen when the next bufferful of data is sent to the soundcard.

The usual technique for buffer filling is to use interrupts: other running applications are interrupted at regular intervals so that a tiny chunk of data can quickly be sent to the streaming buffer, after which the other applications carry on as if nothing had happened. A faster computer can manage smaller latency values by using a smaller buffer size. As long as it can keep coming back to the task fast enough to keep topping up this tiny buffer, without ever letting it empty altogether, the result will be a smooth flow of audio.

However, each time the interrupt routine is called it requires a tiny processor overhead. While in itself this overhead is minuscule, if it happens often enough the overall load will begin to become noticeable. The smallest size of buffer you can use reliably, therefore, depends not only on how fast your main processor can send the data, but also on how streamlined the soundcard driver is, and in many cases whether it has hardware acceleration on board. To give you an idea of the scale of the task, the RME Hammerfall soundcard can operate with ASIO buffers as small as 64 samples, and at a sample rate of 44.1kHz this means that the buffer will need completely refilling every 1.45 milliseconds, or 690 times a second. Phew!

Keeping Ahead

Since I reviewed version 4.0.3.0 of Ahead's Nero CD‑burning application, back in the August 1999 PC Notes, it has moved on to version 4.0.7.5. Existing users of any version 4.0 release can download a free update from the Ahead web site (www.ahead.de). In addition to a host of small improvements and a clutch of inevitable bug‑fixes, it now has a Wizard to hold your hand during CD burning, supports Video CDs, has 30x MP3 encoding, using the renowned Fraunhofer algorithms, and supports many more CD‑R and CD‑RW drives.

I was impressed with how Nero allows the user to go a little further than most mainstream CD‑burning packages, such as Adaptec's Easy CD Creator but, as I reported in my review, Nero had a problem running when Adaptec's DirectCD packet‑writing software was installed. I have been using DirectCD for some time for file backup, turning my CD‑RW drive into a slow hard drive. Ahead have now posted on their web site a selection of boot‑menu utilities that let you choose between Nero and another CD‑writing program during bootup. On offer are versions for Adaptec's DirectCD, CeQuadrat's PacketCD, and Gear.

I decided to forego these and uninstall DirectCD altogether, due to its continued insistence on reinstating my CD‑ROM Auto Insert Notification. I had disabled this notification by choice since, as most PC musicians will know, it can play havoc with digital audio recording, periodically checking the CD‑ROM drive to see if a new CD has been inserted. However, the latest version 2.5d of DirectCD flagged up an error every time I rebooted my PC, offering to restart the PC with this function reenabled. So I decided to replace DirectCD altogether, with the latest version 1.3.141 of Ahead's own InCD packet‑writing software, which is supplied as part of Nero. At only 454k in size, InCD is far leaner and cleaner to install, and can be disabled and made transparent to the system when you don't need it.

For anyone else who uses packet‑writing software, and is thinking, like me, of changing to another product, there is one important thing to note. While any CD‑RW disk formatted for packet writing can be read by any Windows 98 and Windows 2000 application, and by Windows 95 when a reader driver is installed, the finer details of data writing seem to differ between packet‑writing utilities. InCD flagged an error when I attempted to write more files to my DirectCD‑formatted disks. The solution is to temporarily copy the data to your hard drive, reformat the CD‑RW disks with the new application, and then rewrite the data.

PC Snippets

I mentioned in last month's column that Intel had announced an 800MHz processor in the last few days of 1999. Now, in the first few days of 2000, AMD have hit back with an 800MHz Athlon, which is already available to OEM manufacturers. Having stifled a yawn, I can only point out that this constant speed‑race does have a benefit for those of us in the real world: as soon as a new model is released the previous champion is reduced in price, with a knock‑on effect down the remainder of the product line.

www.amd.com

UK developer Angus Hewlett, whose Amulet VST‑to‑DirectX adaptor was mentioned back in the May '99 PC Notes, has now launched his colourful new FXpansion range of plug‑ins, in both DirectX and VST versions. The plug‑ins draw heavily on the ability of VST 2.0 to be controlled from MIDI signals. Currently available are the Phat.Sync multi‑mode pattern‑controlled filter, which syncs to MIDI clock; the MidiComb eight‑note delay‑line resonator, which is triggered by MIDI notes; the AutopOle stereo filter, with sophisticated envelope and LFO options; and RingModulator, featuring extensive envelope, panning and LFO control. A 14‑band real‑time vocoder is also promised very shortly, and Mac, BeOS and Pulsar versions of the plug‑ins are expected in the spring.

www.fxpansion.com

Ntonyx, whose MIDI Style Enhancer I reviewed in SOS November '99, have announced new style sets for several of their products. Set 3 is now available for version 9 of Cakewalk sequencers, and new Sets 6 and 7 for the stand‑alone Style Enhancer 2.1 application.

www.ntonyx.com

Bitheadz have certainly been busy. Their Unity DS1 digital sampler is now up to version 2.0, with many new features, including varispeed playback for loops without changing the pitch, automatic beat detection for changing loop tempo, and various new filter and effect types. It can now run up to 128 stereo voices, given a suitably powerful host computer. The Retro AS1 soft synth is also up to version 2.0, with a new audio input function for processing external audio signals, the ability to control any parameter using MIDI NRPN data, Rewire compatibility, and a selection of new effects, including pitch‑shift, degrade, and multitap chorus. Bitheadz also have a new low‑cost sample player, Unity, based on the version 2.0 Unity DS1 engine, but without its editing and import facilities.

Finally, the Osmosis sample‑conversion utility is now at version 1.1.2, and available for the PC as well as the Mac. The utility allows Akai S1000, Akai S3000, and now Roland‑format CD‑ROMS to be converted to Unity DS1 or Samplecell format, retaining all multisample and program‑voicing data. It also lets you audition individual samples and then transfer them to hard drive in AIFF, Sound Designer II, WAV, or Unity DS1 format.

www.bitheadz.com