Examples » Audio

Shows how to play spatialized audio with Magnum.

Image

The audio scene includes a 3D sound source and a (default) listener, which are visualized as a sphere and a box respectively, the listener initially facing the sound source. The sound source can be moved around the listener using the keyboard.

Key controls

  • Right / Left — rotate source on the Y axis
  • Up / Down — rotate source on the local X axis
  • Page Up / Page Down — move the source away/towards the listener
  • Escape — close the application

Credits

This example was originally contributed by Jonathan Hale. The sound file used is a Chimes Sound Effect from http://www.orangefreesounds.com/chimes-sound-effect/ , licensed under Creative Commons Attribution 4.0 International License.

Source

Full source code is linked below and together with assets also available in the magnum-examples GitHub repository.

The ports branch contains additional patches for Emscripten support that aren't present in master in order to keep the example code as simple as possible.