Skip to main content
The TruGen JS SDK provides utility methods to control the user’s microphone state and programmatically upload or stream custom audio files to the avatar.

Microphone Management

Start/Stop Microphone

Programmatically start or stop the microphone capturing session:

Muting and Unmuting

Mute or unmute microphone inputs without tearing down the audio track:

Get Microphone State

Get the current mute and permission state of the user’s microphone:

Change Audio Input Device

Change the active microphone input device by passing its deviceId:

Audio Injection

You can inject custom audio clips (e.g., pre-recorded user voice message files) directly into the conversation stream.
The SDK automatically handles switching back to the user’s microphone once the custom audio injection completes.

Upload Audio File

Inject a standard audio file (File or Blob format):

Send Audio Blob

Send raw audio data as a Blob: