lovr.audio

The lovr.audio module is responsible for playing sound effects and music. Currently, the only supported audio format is .ogg (Vorbis). Playing a sound involves creating a Source object for the sound and calling Source:play on it.

Sources

Sources are objects that represent a single sound instance.

lovr.audio.newSourceCreate a new Source.
lovr.audio.pausePause all Sources.
lovr.audio.resumeResume all Sources.
lovr.audio.rewindRewind all Sources.
lovr.audio.stopStop all Sources.
lovr.audio.updateUpdates the audio system.

Listener

The listener is a virtual object in 3D space that "hears" all the sounds that are playing. The listener can be positioned and oriented in 3D space, which controls how Sources in the world are heard. For example, sounds further away from the listener will be more quiet, and sounds to the left of the listener will be heard from the left speaker. By default, the listener will be synchronized with any connected headset so audio is positioned properly as the headset is moved around and rotated.

lovr.audio.getDopplerEffectGet the doppler effect parameters.
lovr.audio.setDopplerEffectSet the doppler effect parameters.
lovr.audio.getOrientationGet the orientation of the listener.
lovr.audio.setOrientationSet the orientation of the listener.
lovr.audio.getPositionGet the position of the listener.
lovr.audio.setPositionSet the position of the listener.
lovr.audio.isSpatializedCheck if audio is spatialized.
lovr.audio.getVelocityGet the velocity of the audio listener.
lovr.audio.setVelocitySet the velocity of the audio listener.
lovr.audio.getVolumeGet the master volume.
lovr.audio.setVolumeSet the master volume.

Microphones

Microphones can be used to receive audio input.

lovr.audio.getMicrophoneNamesGet a table containing the names of all connected microphones.
lovr.audio.newMicrophoneCreate a new Microphone.