juhara.com

  • Narrow screen resolution
  • Wide screen resolution
  • Decrease font size
  • Default font size
  • Increase font size
Home Articles DirectX Programming 3D Sound Playback with DirectX Audio
3D Sound Playback with DirectX Audio PDF Print E-mail
Written by Zamrony P. Juhara   
Monday, 14 December 2009 17:20
Article Index
3D Sound Playback with DirectX Audio
Get 3D Sound Buffer from AudioPath
What can we do with 3D Listener?
Class Implementation
Creating 3D Sound Application
All Pages

3D games were designed to immerse player into the game. Realistic audio playback plays important part to help game achieve the goal. To create realistic audio playback, audio hardware manufacturer have designed many technologies that mimics sound in real life.

If you ever played recent 3D games, you might hear sounds coming from many directions while you play the game. The question is, how can you do that?

This article was written, inspired by a question posted by Delphindo mailing list member about how to play sound samples on different speakers. To understand this article smoothly and to answer above question, at least you are expected to have basic knowledge about how to play sound with DirectX. You can read my article, DirectX Audio programming, as an introduction.

Ok let's get started..

3D Sound Introduction

Sound perception in real world is affected by many factors, i.e, position and velocity of sound source, environment, and position, velocity and orientation of listener.

Sound Source

Sound source is object that emits sound wave. Parameters that affect sound perception are position, velocity, orientation, environment and etc.

Listener

Main parameters of listener that affect sound perception are position, velocity and orientation of listener. Default position of listener lays at (0,0,0). There are two listener's orientations, i.e, top vector and front vector (take a look at Fig.1 below). Top vector's default value is (0,1,0) and front vector's default value is (0,0,1)

Top vector and front vector illustration

Fig.1 Top vector and front vector illustration.

Sound Cone

Sound can be categorized by orientation as follow:

  • Non-oriented sound.
  • Oriented sound.

Non-oriented sound is sound same in every directions, oriented sound can only be heard in a particular direction. Sound cone is model of intensity of oriented sound (see Fig.2). This cone is divided into two parts, i.e, inside cone and outside cone.

In inside cone area, sound is heard at loudest intensity, while at outside cone, further from the inside cone, weaker sound intensity. How much sound intensity decrease is determined by factor that defined by application.

Distance

Distance between sound source and listener affects listening perception. Closer sound source to listener, louder sound source will be heard. Minimum distance is distance where sound will no longer increase in volume while maximum distance is biggest distance where sound source no longer decrease.

The distance factor is the number of meters in a vector unit. Its default values is 1.0. For example if velocity vector is (2,2,0), then velocity is 2 meter/s to x direction, 2 meter/s to y direction and 0 meter/s to z direction.

Sound cone representation

Fig.2 Sound cone representation.

Doppler Effect

Moving sound source or listener will experience Doppler effect (review your physics class). DirectX automatically calculates this effect on moving sound source or listener base on Doppler factor which its value defined by application.

Rolloff

Rolloff is amount of attenuation that is applied to sounds, based on the listener's distance from the sound source.

DirectX 3D Sound Basic Element

3D AudioPath

Audiopath is object that controls sound sample data flow.

3D Sound Buffer

Sound buffer represents sound source. Sound buffer holds sound sample data. In DirectX, there are two sound buffer type, i.e, ordinary buffer (IDirectSoundBuffer8) and 3D buffer (IDirectSound3DBuffer8). With 3D buffer, we can set sound source paramaters such as position and velocity.

3D Listener

In DirectX, listener object is represented in IDirectSound3DListener8.

Get 3D AudioPath Instance

To play 3D sound, we must create standard audiopath for each sound we want to play. This audiopath must be created with DMUS_APATH_DYNAMIC_3D flag. For example:

FPerformance.CreateStandardAudioPath(
DMUS_APATH_DYNAMIC_3D,
64,
true,
FAudioPath);

To those of you who do not understand CreateStandardAudioPath(), please read article mentioned above for review.



Last Updated on Friday, 18 December 2009 20:48
 

Language

IndonesianEnglish (United Kingdom)

Game Institute
DAZ3D

Is this article helpful? Help this site improve by donating. Any amount is appreciated.