> ## Documentation Index
> Fetch the complete documentation index at: https://docs.liv.tv/llms.txt
> Use this file to discover all available pages before exploring further.

# Audio Configuration

> Configure audio capture for LIV Camera Kit in Unity. Supports Unity Audio, FMOD, and Wwise. Custom audio sources, microphone control, and discreet audio API.

LCK captures game audio and microphone input during recording and streaming. It supports Unity's built-in audio system, FMOD, and Wwise out of the box.

## How audio capture works

When recording, LCK captures all audio heard by the active **AudioListener** in the scene. Since the AudioListener is typically attached to the player's HMD camera, recordings capture audio from the player's perspective.

The `LckAudioMixer` finds the game audio source using this logic:

1. Look for an **AudioListener** in the scene. If found, check for a component implementing `ILckAudioSource` and use it if available. Otherwise, add an `LckAudioCapture` to that GameObject.
2. If no AudioListener exists, look for an **LckAudioMarker** and follow the same logic.

## Audio settings

For best recording quality, set the DSP buffer size to **Default** or **1024** in your Unity Audio settings. Smaller buffer sizes can cause audio artifacts that are more noticeable in recordings than during live gameplay.

## Third-party audio support

LCK includes built-in support for FMOD and Wwise. Enable them by adding scripting define symbols in **Edit > Project Settings > Player > Scripting Define Symbols**:

| Engine     | Define Symbol   |
| ---------- | --------------- |
| FMOD 2.02  | `LCK_FMOD`      |
| FMOD 2.03+ | `LCK_FMOD_2_03` |
| Wwise      | `LCK_WWISE`     |

After adding the define, place an `LckAudioMarker` component on the GameObject where LCK should attach capture components.

### Special configurations

| Scenario                                           | Define Symbol                            |
| -------------------------------------------------- | ---------------------------------------- |
| Not using Unity Audio at all                       | `LCK_NOT_UNITY_AUDIO`                    |
| FMOD combined with Unity Audio (e.g. Photon Voice) | `LCK_FMOD_WITH_UNITY_AUDIO` + `LCK_FMOD` |

## Custom audio sources

As of v1.2.0, you can implement `ILckAudioSource` to supply custom game audio to LCK:

```csharp theme={null}
public class MyCustomAudio : MonoBehaviour, ILckAudioSource
{
    // LCK expects stereo, interleaved floats, at 48kHz
}
```

Place your implementation next to a Unity `AudioListener` or an `LckAudioMarker`. LCK will still collect microphone audio separately.

## Microphone control

```csharp theme={null}
[InjectLck] private ILckService _lckService;

_lckService.SetMicrophoneCaptureActive(true);   // enable/disable mic
_lckService.SetMicrophoneGain(1.0f);            // adjust mic gain
_lckService.GetMicrophoneOutputLevel();          // current mic level

_lckService.SetGameAudioCaptureActive(true);     // enable/disable game audio
_lckService.SetGameAudioGain(1.0f);              // adjust game audio gain
_lckService.GetGameOutputLevel();                 // current game audio level
```

Microphone permission timing is configurable in **Edit > Project Settings > LCK** (options: Startup, TabletSpawn, Mic Unmute, or Never).

## Discreet audio API

For audio that should be audible to the player but **excluded from recordings** (UI sounds, recording state cues), use the Discreet Audio API:

```csharp theme={null}
// Play a clip once (excluded from recording)
_lckService.PlayDiscreetAudioClip(myAudioClip);

// Preload for longer audio
_lckService.PreloadDiscreetAudio(myAudioClip);

// Stop all discreet audio
_lckService.StopAllDiscreetAudio();
```

The LCK tablet uses discreet audio for its own recording start/stop cues by default.
