Skip to content

Desuq Cafe

Documentation menu

Mic / Voice Activity Detection

Drive OBS from your microphone. This is the canonical VTuber “talking → animated, idle → resting” loop, entirely in-engine. The plugin watches an input’s audio levels (via OBS InputVolumeMeters), runs them through a debounced hysteresis detector (attack/release timing so brief word-gaps don’t flicker the state), and fires an event when the input crosses talking ⟷ idle.

Usage

UInhyeongOBSSubsystem* OBS = GetGameInstance()->GetSubsystem<UInhyeongOBSSubsystem>();

// Start detecting. ThresholdDb / Attack / Release default to sensible voice values.
OBS->EnableMicActivityDetection(TEXT("Mic/Aux"), /*ThresholdDb=*/-40.f, /*Attack=*/0.05f, /*Release=*/0.5f);

// React to talking <-> idle transitions
OBS->OnMicActivityChanged.AddDynamic(this, &AMyActor::HandleMicActivity);

// ...or poll on demand
bool bTalking = OBS->IsMicActive(TEXT("Mic/Aux"));

// Stop detecting (leaves the underlying meter subscription on for other consumers)
OBS->DisableMicActivityDetection(TEXT("Mic/Aux"));

API

MemberNotes
EnableMicActivityDetection(Input, ThresholdDb=-40, Attack=0.05, Release=0.5)Begin detecting on the named input. Auto-enables that input’s volume meters.
DisableMicActivityDetection(Input)Stop detecting. Leaves the underlying meter subscription on, since other consumers may rely on it.
IsMicActive(Input)Poll the current talking/idle state.
OnMicActivityChangedFires on every talking ⟷ idle transition.

Parameters

  • ThresholdDb: peak-dB level above which the input counts as “talking”.
  • Attack: seconds the level must stay above threshold before flipping to talking.
  • Release: seconds the level must stay below threshold before flipping back to idle (the hangover rides over word-gaps so the state doesn’t flicker).

How it works

EnableMicActivityDetection opts the input’s meters in automatically, so you don’t need to manage the subscription yourself. If you only need the raw levels (e.g. an in-game VU meter), call SetVolumeMetersEnabled(true) and bind OnInputVolumeMeters directly. See the Audio guide.

Talking/idle is also available as a trigger-volume condition. See OBS Trigger Volume.

Note: OBS sends empty levels for a muted input, so detection only flips active on an unmuted, audible source.

See Also