Skip to main content

Class: AudioInput

A generic event target class designed for strongly-typed event handling. OdinEventTarget extends the functionality of the standard EventTarget to allow interactions with predefined event types and handlers.

Extends

Constructors

new AudioInput()

new AudioInput(_settings, _capture): AudioInput

Parameters

_settings: InputSettings

_capture: AudioCapture

Returns

AudioInput

Overrides

OdinEventTarget.constructor

Defined in

ari/lib/api/media/audio-input.d.ts:39

Properties

activityHandler()

activityHandler: () => void

Gets called to update PowerLevel and AudioActivity. Primarily for internal usage and might get removed in the future.

Returns

void

Deprecated

Defined in

ari/lib/api/media/audio-input.d.ts:32


kind

readonly kind: "audio-input" = "audio-input"

Defined in

ari/lib/api/media/audio-input.d.ts:12


onAudioActivity()?

optional onAudioActivity: (payload) => void

A callback function that is invoked when audio activity occurs and voice activity detection (VAD) was set to true.

Parameters

payload: AudioActivityPayload

An object containing the AudioMedia.

Returns

void

Defined in

ari/lib/api/media/audio-input.d.ts:18


onPowerLevel()?

optional onPowerLevel: (payload) => void

A callback function invoked when there is an update to the audio power level in rmsDBFS. This function can be used to handle or process audio activity, such as monitoring sound levels or visualizing audio input.

Parameters

payload: AudioActivityPayload

An object containing the AudioMedia.

Returns

void

Defined in

ari/lib/api/media/audio-input.d.ts:26

Accessors

capture

get capture(): AudioCapture

The AudioCapture that is provided by the underling plugin.

Returns

AudioCapture

The AudioCapture of the underling plugin.

Defined in

ari/lib/api/media/audio-input.d.ts:45


isActive

get isActive(): boolean

Whether the AudioInput is currently active or not. Only works when voice activity detection was enabled.

Returns

boolean

True if the instance is active, false otherwise.

Defined in

ari/lib/api/media/audio-input.d.ts:68


powerLevel

get powerLevel(): number

Retrieves the Root Mean Square (RMS) in decibels relative to full scale (dBFS) for the captured audio activity. This is a measure of the average power level of the audio signal.

Returns

number

The RMS value expressed in dBFS.

Defined in

ari/lib/api/media/audio-input.d.ts:83


volume

get volume(): InputVolume

Retrieves the current volume. Is the Volume 'muted', the associated Device was stopped.

Returns

InputVolume

The current volume level.

Defined in

ari/lib/api/media/audio-input.d.ts:52

Methods

addEventListener()

addEventListener<OdinEventType>(eventName, handler, options?): void

Type Parameters

OdinEventType extends keyof MediaEvents

Parameters

eventName: OdinEventType

handler: MediaEvents[OdinEventType]

options?: boolean | AddEventListenerOptions

Returns

void

Inherited from

OdinEventTarget.addEventListener

Defined in

ari/lib/utils/odin-event-target.d.ts:26


close()

close(): void

Closes the AudioInput.

Returns

void

Defined in

ari/lib/api/media/audio-input.d.ts:107


dispatchActivity()

dispatchActivity(): void

Dispatches activity events. This method might get removed and should not be used outside the SDK.

Returns

void

Deprecated

Defined in

ari/lib/api/media/audio-input.d.ts:97


dispatchEvent()

dispatchEvent<T>(event): void

Type Parameters

T extends OdinEvent<any>

Parameters

event: T

Returns

void

Inherited from

OdinEventTarget.dispatchEvent

Defined in

ari/lib/utils/odin-event-target.d.ts:27


dispatchPowerLvl()

dispatchPowerLvl(): void

Dispatches power level events. This method might get removed and should not be used outside the SDK.

Returns

void

Deprecated

Defined in

ari/lib/api/media/audio-input.d.ts:103


removeEventListener()

removeEventListener<OdinEventType>(type, callback): void

Type Parameters

OdinEventType extends keyof MediaEvents

Parameters

type: string | OdinEventType

callback: EventListenerOrEventListenerObject | MediaEvents[OdinEventType]

Returns

void

Inherited from

OdinEventTarget.removeEventListener

Defined in

ari/lib/utils/odin-event-target.d.ts:28


setDevice()

setDevice(device): Promise<void>

Sets the device configuration for the capture process.

Parameters

device: DeviceParameters

The parameters for the device to be set.

Returns

Promise<void>

A promise that resolves when the device has been successfully set.

Defined in

ari/lib/api/media/audio-input.d.ts:75


setInputSettings()

setInputSettings(settings): Promise<void>

Updates the input settings for the current instance and applies necessary changes.

Parameters

settings: InputSettings

The new input settings to be applied. Each key in the settings object determines a specific input property, such as volume, voice activity detection, or audio processing modules.

Returns

Promise<void>

A promise that resolves once all updates and configurations have been processed.

Defined in

ari/lib/api/media/audio-input.d.ts:91


setVolume()

setVolume(value): Promise<void>

Sets the volume of the AudioInput. By setting the value to 'muted', will stop the Capturing of the MediaStream. The volume value should be between 0 and 2 (inclusive). Values outside this range are clamped.

Parameters

value: InputVolume

The desired volume level to be set. It must be a valid Volume instance or a value supported by the underlying _capture object.

Returns

Promise<void>

A Promise that resolves when the volume has been successfully set.

Defined in

ari/lib/api/media/audio-input.d.ts:61