Skip to main content

Audio

Audio Capture

While recording with LCK, all audio captured by the current AudioListener will be included. Since the AudioListener is most commonly attached to the player HMD, this means audio will be captured from the perspective of the player.

Another thing to consider is that maybe not all audio should be captured, but should still be audible for the player. For this we have a Discreet Audio API

Support for third party Audio solutions

LCK comes with support for Wwise and FMOD. These can be activated by

  • Setting one of these scripting define symbols in your project settings
    • LCK_FMOD
    • LCK_WWISE
  • Placing an LckAudioMarker component on the gameobject where LCK should place the capture components.

If you are not using Unity audio but neither of the supported third party engines you can use the scripting define LCK_NOT_UNITY_AUDIO to force LCK to not try to utilize Unity audio settings.

Supplying custom audio

As of v1.2.0 as noted in the upgrade guide devs can implement ILckAudioSource to manually supply game audio to LCK.

note

LCK will still collect microphone audio separately from this custom source.

ILckAudioSource and LCK in general expects all audio to be stereo interleaved floats at 48Khz.

By implementing this interface in a component and placing it next to the Unity AudioListener or an LckAudioMarker LCK will pick it up and feed the provided audio to the encoder. For examples of how such a component could be implementing take a look at LckAudioListener and the FMOD and Wwise variants.

Audio Mixer behaviour

When the LckAudioMixer looks for an audio source for the game, it goes through the following process

  • Looks for an AudioListener in the scene, and if it finds one:
    • Check for a component implementing ILckAudioSource, and use this for audio if it finds one
    • Or add an LckAudioCapture to the gameobject with the listener on it and use it for audio.
  • If no AudioListener is found it looks for an LckAudioMarker and follows the same steps as above to find a component implementing ILckAudioSource

Discreet Audio

For playing back audio that should not be included in the recording - useful for recording states related chimes - regular Unity AudioClips can be passed to the LckService via the PlayDiscreetAudioClip(AudioClip audioClip) method. This will play back the audio outside of Unity's audio system, natively on the device.

All clips, but especially longer ones can also be preloaded using PreloadDiscreetAudio(AudioClip audioClip) to avoid waiting for the audio to be transferred to the native sound manager when playing it back. Once a clip has been played it will stay loaded.

There are not many controls for this API since it is mostly aimed to shorter types of audio cues and chimes, but all playing discret audio can be stopped with StopAllDiscreetAudio().