ABSTRACT

Floating-point arithmetic is a precise and powerful way to model real-world curves, but some such operations are disproportionately expensive. Transcendental mathematical functions are often required in 3D audio runtimes to apply psychoacoustic curves or convert between loudness, pitch and coordinate representations and can eat up a lot of processing cycles.

This chapter includes audio-friendly ways to speed those up while still staying accurate enough for audio control purposes. Example C++ and SIMD intrinsic code computes logarithms, exponentials, sines, cosines, arctangents and four distinct sorts of “random” numbers faster than standard library routines.

Concepts: gain and decibel attenuations, rectangular and polar coordinates, bulk conversions, trigonometry, PI, pitch randomisation, shuffling, normal distribution, pseudorandom distribution, “designer random,” compiler arithmetic intrinsics, edge-cases, optimisation-investigation and speed-up settings, IEEE-754 numeric representation, 32- and 64 bit integers, single- and double-precision floating-point values, square roots, Newton-Raphson, processor pipelines, data dependencies and latency.

Platforms discussed: Android, ARM NEON, ARM64, C++20, Clang, GCC, Intel, MIPS, POSIX, SSE, Visual Studio, VMX.