ArticleslgStudy

computer science

DirectSound

DirectSound is a computer science topic covered in the lgStudy science library. This page brings together a partial reference excerpt, illustrations, worked examples, real-world applications and a short study plan, so you can understand DirectSound rather than just read about it. In short: DirectSound is a deprecated software component of the Microsoft DirectX library for the Windows operating system, superseded by XAudio2. It provides a low-latency interface to sound card drivers written for Windows 95 through Windows XP and can handle the mixing and recording of multiple audio streams.

Key takeaways

  • DirectSound belongs to computer science; place it in that map before memorising details.
  • Learn the definition first, then one example that makes the definition concrete.
  • Connect DirectSound to a quantity you can measure, compute or draw — that is where exam questions come from.
  • Reproduce the core statement of DirectSound from memory before moving on to harder problems.

Reference excerpt

DirectSound is a deprecated software component of the Microsoft DirectX library for the Windows operating system, superseded by XAudio2. It provides a low-latency interface to sound card drivers written for Windows 95 through Windows XP and can handle the mixing and recording of multiple audio streams. DirectSound was originally written for Microsoft by John Miles. Besides providing the essential service of passing audio data to the sound card, DirectSound provides other essential capabilities such as recording and mixing sound, adding sound effects (e.g., reverb, echo, flange, or other audio enhancement effects), using hardware accelerated buffers in Windows 95 through XP, and positioning sounds in 3D space. DirectSound also provides a means to capture sounds from a microphone or other input and controlling capture effects during audio capture. After many years of development, today DirectSound is a mature API, and supplies many other useful capabilities, such as the ability to play multichannel sounds at high resolution. While DirectSound was designed to be used by video games, today it is used to play audio in many audio applications. DirectShow uses DirectSound's hardware audio acceleration capabilities if the sound card's hardware audio acceleration capabilities exist and are exposed by the audio driver.

Features DirectSound is a user mode API that provides an interface between applications and the sound card driver, enabling applications to produce sounds and play back music. DirectSound was considered revolutionary when it was introduced in 1995, as it featured multiple simultaneous audio streams and allowed several applications to access the sound card simultaneously. Before that, the game developers were required to implement their own audio rendering engine in software. DirectSound provides sample rate conversion and sound mixing (volume and pan) for an unlimited number of audio sources; however, the practical limits are the number of hardware audio sources and the performance of software mixers. The DirectSound architecture features a concept of the "ring buffer" which would be continuously played in a cycle. The application programmer creates the sound buffer then continuously queries its state through the "read cursor" and updates it with the "write cursor". There are two types of buffers - a "streaming" buffer, which holds continuous sounds such as background music, and a "static" buffer which holds short sounds. On supported sound cards, DirectSound would try to use "hardware accelerated" buffers, i.e. the ones which either can be placed in local sound card memory, or can be accessed by the sound card from the system memory. If hardware acceleration is not available, DirectSound would create audio buffers in the system memory and use purely software mixing. Some late DOS-era "wavetable" sound cards such as Sound Blaster AWE32 and Gravis Ultrasound featured dedicated DSPs, which were borrowed from the digital music instruments. These cards featured local memory which could be used for buffering multiple audio streams and mixing them on board, thus offloading the CPU and greatly improving the sound quality. However, this was only possible in DOS by directly programming the hardware, and full-featured "hardware acceleration" from the local memory was never implemented on these cards, due to complexities of double buffering. Later cards such as Sound Blaster Live!, Audigy and X-Fi are capable of accessing the system memory buffers directly.

DirectSound3D DirectSound3D (DS3D) is an extension to DirectSound introduced with DirectX 3 in 1996 with the intention to standardize 3D audio in Windows. DirectSound3D allows software developers to utilize audio by writing once for a single audio API instead of rewriting code numerous times to work for each audio card vendor. In DirectX 5, DirectSound3D gained the support for sound cards that use third party 3D audio algorithms in order to accelerate DirectSound3D properly, through methods approved by Microsoft. In DirectX 8, DirectSound and DirectSound3D (DS3D) were officially merged and given the name DirectX Audio, however the API is still commonly referred to as DirectSound.

EAX

EAX is an extension to DirectSound and DirectSound3D which provides sound effects processing to the hardware-accelerated buffers.

OS Support

Windows 9x In Windows 95, 98 and Me, the DirectSound mixer component and the sound card drivers were both implemented as a kernel-mode VxD driver (Dsound.vxd), allowing direct access to the primary buffer used by the audio hardware and thus, providing the lowest possible latency between the user-mode API and the underlying hardware, but in some cases causing instability and blue screen errors. Windows 98 introduced WDM Audio and the Kernel Audio Mixer driver (KMixer), which enabled digital mixing, routing and processing of simultaneous audio streams with a higher quality sample rate conversion as well as kernel streaming. Under WDM, DirectSound sends data to the software-based KMixer. Windows 98 Second Edition improved WDM audio support by adding DirectSound hardware buffering and DirectSound hardware acceleration, DirectSound3D hardware abstraction, KMixer sample-rate conversion (SRC) for capture streams, surround sound (up to 5.1) support and introduction of DirectMusic. If the audio hardware supports hardware mixing (also known as hardware buffering or DirectSound hardware acceleration), DirectSound buffers directly to the rendering device. If DirectSound streams use hardware mixing, KMixer and its latency delay are bypassed. On Windows 98 and Windows Me, WDM audio drivers were preferred but compatibility with VxD driver model was preserved. Although Windows Driver Model (WDM) was available starting with Windows 98, few audio card manufacturers used it for Windows 98 FE. Due to internal buffering, KMixer introduced significant processing latency (30 ms on then-current systems). Windows 98 also includes a WDM streaming class driver (Stream.sys) to address these real time multimedia data stream processing requirements. When the sound card uses a custom driver for use with the system supplied port class driver PortCls.sys or implements a mini-driver for use with the streaming class driver, applications can bypass the KMixer completely and use the kernel streaming interfaces instead to reduce latency. In Windows 95, 98 and Me, DirectSound is designed for older audio devices in that time, such as AC'97 and AudioPCI.

… excerpt ends here. Continue reading the full article.

Worked examples

Example 1 — a first encounter with DirectSound

Start with the simplest possible case. Write down what DirectSound claims or describes in one sentence, then invent the smallest concrete situation in which that sentence is true. In computer science, the smallest case is usually a single object, a single equation or a single measurement. Check that every symbol or term in your sentence has a meaning in that case.

Example 2 — changing one variable

Take the situation from Example 1 and change exactly one quantity: double it, halve it, or set it to zero. Predict what should happen to DirectSound before you calculate. Comparing your prediction with the result is the fastest way to find out whether you understand the idea or only the words.

Example 3 — an exam-style question

Typical questions about DirectSound ask you to (a) state it precisely, (b) apply it to given data, and (c) explain a limitation. Practise writing all three answers in under five minutes; the third part is what separates a full-mark answer from an average one.

Applications of DirectSound

In research
DirectSound appears in computer science research whenever the underlying quantities have to be modelled precisely. Papers usually cite it as a starting assumption and then explore where it breaks down.
In technology and industry
Engineering practice reuses DirectSound in design rules, simulations and safety margins. Knowing the idea lets you read a specification sheet and understand why the numbers look the way they do.
In the classroom
DirectSound is common in secondary-school and first-year university syllabi. It links to neighbouring topics Application programming interfaces, Audio libraries, DirectX, so understanding it makes those chapters shorter.
In everyday life
Look for DirectSound outside the textbook — in sport, cooking, traffic, electronics or the sky above you. An example you found yourself is remembered far longer than one you were given.
Ask Teacher Smith questions about this articleOpens your AI tutor with a question about “DirectSound” →

How to study DirectSound in 20 minutes

  1. Read the reference excerpt below once, without taking notes.
  2. Close the page and write down what DirectSound means in your own words.
  3. Compare your version with the excerpt and mark what you missed.
  4. Work through the three examples above with pen and paper.
  5. Explain DirectSound out loud to somebody else — or to Teacher Smith in the lgStudy chat.

Frequently asked questions

What is DirectSound in simple terms?

DirectSound is a deprecated software component of the Microsoft DirectX library for the Windows operating system, superseded by XAudio2. It provides a low-latency interface to sound card drivers written for Windows 95 through Windows XP and can handle the mixing and recording of multiple audio stre…

Why does DirectSound matter?

Because it connects several computer science ideas at once: it gives you a definition you can apply, a quantity you can calculate, and a way to check whether a result is plausible.

How should I study DirectSound?

Read the excerpt, restate it from memory, then work through the examples and applications listed on this page. The five-step study plan above takes about twenty minutes.

What does this page cover?

It gives you a compact reference excerpt plus original lgStudy explanations, examples, applications and study material on DirectSound.

Tags

  • Application programming interfaces
  • Audio libraries
  • DirectX
  • Music software plugin architectures
  • Windows audio

Keep exploring