AudioCapture
Module: Inworld.AI. Namespace: Inworld. Inherited from MonoBehavior
This is a global audio capture controller. For each individual InworldCharacter, we use the AudioInteraction class to handle AudioClips.
Inspector Variables
Variable | Description |
---|---|
Sampling Mode | The current Sampling Mode. |
Push To Talk Key | If the keycode is defined, users can hold this key to start sampling, and release this key to stop sampling. |
Player Volume Thread | 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. |
Audio to Push Capacity | Identifies how many audioChunk can be stored before sending. |
Device Name | The name of the current sampling device. |
Detect Player Speaking | If enabled, we will detect the player's speaking by the SNR and only enable it when detected. If not, we will always sample the player's speaking. |
Audio Event | This component's AudioEvents. |
Properties
Property | Description |
---|---|
Event | Gets the AudioEvents. |
CurrentPlayingAudioSource | Gets/Sets the current playing audio source. |
Volume | Gets the global setting of the volumes (From 0 to 1). |
PushToTalkKey | Gets/Sets the Push to talk key. The auto detecting would only be effected if this key is NONE. |
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) |
AutoDetectPlayerSpeaking | Gets/Sets if this component is detecting player speaking automatically. |
IsRecording | By default, it's controlled by the Record UI button in PlayerController. Note: This status is overwritten by Push to talk Hot key. |
IsPlayerSpeaking | Indicates if the user is speaking based on audio amplitude and threshold. |
IsCapturing | Indicates if the microphone is currently capturing audio. |
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. |
PushAudioImmediate | Send the audio chunk in the queue immediately to Inworld server. | |
PushAudio | Manually pushes the audio wave data to the server. | |
StopAudio | Stop the current audio session. | |
StartAudio | Start the current audio session. | |
SendAudio | Send the specific AudioChunk | chunk: the AudioChunk to send. |
Calibrate | Recalculate the background noise (including bg music, etc) Please call it whenever audio environment changed in your game. |