AudioCapture
Module: Inworld.AI. Namespace: Inworld.
This is a global audio capture controller. For each individual InworldCharacter, we use the AudioInteraction class to handle AudioClips.
Inspector Variables
Variable | Description |
---|---|
SamplingMode | The current Sampling Mode. |
PlayerVolumeThread | The volume multiplier used to determine whether the player is speaking. |
Buffer Seconds | Specifies the duration, in seconds, for recording and generating a sample to be sent to the server. |
Device Name | The name of the current sampling device. |
Events
Event | Description |
---|---|
OnRecordingStart | Triggered when the microphone begins sampling. |
OnRecordingEnd | Triggered when the microphone stops sampling. |
OnPlayerStartSpeaking | Triggered when the player starts speaking. NOTE: It might not be very accurate based on the background noices. |
OnPlayerStopSpeaking | Triggered when the player stops speaking. NOTE: It might not be very accurate based on the background noices. |
Properties
Property | Description |
---|---|
CurrentPlayingAudioSource | Gets/Sets the current playing audio source. |
Volume | Gets the global setting of the volumes (From 0 to 1). |
IsBlocked | Indicates if audio is currently blocked from being captured. |
IsCapturing | Indicates if the microphone is currently capturing audio. |
AutoPush | Indicates if audio should be automatically pushed to the server as it is captured. |
SampleMode | The Sampling Mode used by the Microphone. Determines how audio input is handled and processed for interactions. |
IsPlayerTurn | A flag to check if player is allowed to speak and without filtering. |
IsAudioAvailable | A flag to check if audio is available to send to server. (Either Enable AEC or it's Player's turn to speak) |
IsPlayerSpeaking | Indicates if the user is speaking based on audio amplitude and threshold. |
BackgroundNoise | Get the background noises, including music. |
DeviceName | Gets the audio input device name for recording. |
Devices | Gets the list of the AudioDevice. |
EnableAEC | Gets if acoustic echo cancellation (AEC) is enabled. By default, this is set to false in the parent class. |
API
Function | Description | Parameters |
---|---|---|
ChangeInputDevice | Changes the microphone input device. | deviceName: The name of the input device. |
StartRecording | Initiates recording using Unity's official microphone module, triggering the OnRecordingStart event. | |
StopRecording | Stops recording using Unity's official microphone module, triggering the OnRecordingEnd event. | |
PushAudio | Manually pushes the audio wave data to the server. | |
StopAudio | Stop the current audio session. | |
StartAudio | Start the current audio session. | |
Calibrate | Recalculate the background noise (including bg music, etc) Please call it whenever audio environment changed in your game. | |
StartWebMicrophone | Start microphone sampling in WebGL. | |
StartMicrophone | Start the microphone sampline by target audio device. | deviceName: the name of the target device. |