Implementing Listeners

A listener is a virtual microphone placed in the simulated world. This chapter explains how interactive audio systems use multiple listeners to mix and model complex acoustic environments in 3D. Interactions between listeners, views, Virtual Voices and voice groups are noted.

Portable code to perform transformations between world coordinates and listener-relative ones is revealed, including C++ data-structures and routines for matrix and vector arithmetic, noting memory usage, alignment, left- and right-handed and row/common-major compatibility considerations while minimising mathematical justifications irrelevant to practical use.

Quirks of Direct3D, GCC, OpenAL, Unity, Unreal Engine and Visual Studio are noted. An efficient C++ implementation of Doppler pitch shift is presented, including edge-case handling, sonic booms and temperature considerations. Directional listeners, with smooth cardioid, figure-of-eight and HRTF-modelling polar patterns, are explained and implemented, with advice on visualising them and their orientations.

Rough cardioid listener polar pattern
An early diagram of the cardioid listener polar pattern - this draft was roughed up with a short program in Sinclair Spectrum ZX BASIC; the book includes equivalent C++ and vector-graphic renditions

Further reading

Split-Screen Multiplayer Audio - next chapter abstract.
Implementing Voice Groups - previous chapter abstract.
Return to the index of chapters.
Click here to get your own copy of Beep To Boom.

Copyright © 2019 Simon N Goodwin     [';']