lovr.audio

The lovr.audio module is responsible for playing sound effects and music. To play a sound, create a Source object and call Source:play on it. Currently ogg, wav, and mp3 audio formats are supported.

Sources

Sources are objects that represent a single sound instance.

lovr.audio.newSourceCreate a new Source.

Listener

The listener is a virtual object in 3D space that "hears" all the sounds that are playing. It can be positioned and oriented in 3D space, which controls how Sources in the world are heard. Usually this would be locked to the headset pose.

lovr.audio.setGeometrySet the geometry for audio effects.
lovr.audio.getOrientationGet the orientation of the listener.
lovr.audio.setOrientationSet the orientation of the listener.
lovr.audio.getPoseGet the pose of the listener.
lovr.audio.setPoseSet the pose of the listener.
lovr.audio.getPositionGet the position of the listener.
lovr.audio.setPositionSet the position of the listener.
lovr.audio.getSpatializerGet the name of the active spatializer
lovr.audio.getVolumeGet the master volume.
lovr.audio.setVolumeSet the master volume.

Devices

It's possible to list the available audio devices on the system, and pick a specific device to use for either playback or capture. Devices can also be manually started and stopped. Other useful features of lovr.audio.setDevice include the ability to stream all audio data to a custom sink and the option to create a device in exclusive mode for higher performance. By default, the default playback device is automatically initialized and started, but this can be configured using lovr.conf.

lovr.audio.setDeviceSwitch audio devices.
lovr.audio.getDevicesGet a list of audio devices.
lovr.audio.startStart an audio device.
lovr.audio.isStartedCheck if an audio device is started.
lovr.audio.stopStop an audio device.