Skip to main content
Voice Chat

Microphone Level Meter

NOTE

Requires SteamCore PRO 1.2.0 and newer

The Microphone Level Meter shows how loud the player's microphone is, for example as a bar in your audio settings menu, so the player can check that the selected microphone works.

The meter opens its own preview capture of the microphone. It doesn't read from the voice chat stream and doesn't affect voice transmission. It works outside a multiplayer session, for example in the main menu, and while push-to-talk isn't held.

NOTE

The meter uses the microphone saved with Update Voice Input Device, see Select Microphone Input. If no microphone is saved, it uses the default input device.

Prerequisites​

  • Voice has to be enabled in your DefaultEngine.ini, see Voice Chat. If it isn't, Start returns false.
[Voice]
bEnabled=true

Showing the Microphone Level​

  1. Call Create Microphone Level Meter and store the result in a variable, for example in your settings widget. The meter stops when the object is destroyed, so keep the reference for as long as the meter is used.
  2. Call Start. It returns true if the microphone was opened.
  3. Call Get Level on a timer, for example every 0.05 seconds, and set the Percent of a Progress Bar to the returned value.
  4. Call Stop when the settings menu closes to release the microphone.

Image

Image

Image

Changing Microphone​

When the player selects another microphone, call Update Voice Input Device and then call Start again. Start stops the current capture and opens the new device.

Image

Voice chat itself picks up the new device when you join or create a session, see Select Microphone Input.

Nodes​

NodeDescription
Create Microphone Level MeterCreates a new meter.
StartOpens the microphone saved with Update Voice Input Device, or the default device if none is saved. Returns false if the microphone couldn't be opened. Calling it while the meter is running restarts it.
Get LevelReturns the level from 0 (silent) to 1 (loudest). Returns 0 if the meter isn't started.
Get Peak AmplitudeReturns the loudest sample, from 0 to 1, from the last Get Level call that received audio. It isn't scaled to decibels.
Is ActiveReturns true while the meter is capturing.
Get Device NameReturns the name of the device the meter opened. It is empty when the default device is used.
StopReleases the microphone and resets the level to 0.

Settings​

VariableDefaultDescription
Min Decibels-60The quietest level shown. Sound at this level or below gives 0, and 0 dB gives 1. Must be -1 or lower.
Fall Speed1.5How fast the level drops when the sound gets quieter, in level per second. With 1.5, the level drops from 1 to 0 in about 0.7 seconds.

The level rises at once when the sound gets louder, and falls smoothly by Fall Speed when it gets quieter. Because of this, Get Level should be called regularly, for example on a timer or on Tick.