AudioConfig class

Represents audio input configuration used for specifying what type of input to use (microphone, file, stream).

Methods

close()

Explicitly frees any external resource attached to the object

fromAudioFileOutput(PathLike)

Creates an AudioConfig object representing a specified output audio file

fromDefaultMicrophoneInput()

Creates an AudioConfig object representing the default microphone on the system.

fromDefaultSpeakerOutput()

Creates an AudioConfig object representing the default speaker.

fromMicrophoneInput(string)

Creates an AudioConfig object representing a microphone with the specified device ID.

fromSpeakerOutput(IPlayer)

Creates an AudioConfig object representing the custom IPlayer object. You can use the IPlayer object to control pause, resume, etc.

fromStreamInput(AudioInputStream | PullAudioInputStreamCallback | MediaStream)

Creates an AudioConfig object representing the specified stream.

fromStreamOutput(AudioOutputStream | PushAudioOutputStreamCallback)

Creates an AudioConfig object representing a specified audio output stream

fromWavFileInput(File | Buffer, string)

Creates an AudioConfig object representing the specified file.

getProperty(string, string)

Returns the current value of an arbitrary property.

setProperty(string, string)

Sets an arbitrary property.

Method Details

close()

Explicitly frees any external resource attached to the object

function close()

fromAudioFileOutput(PathLike)

Creates an AudioConfig object representing a specified output audio file

static function fromAudioFileOutput(filename: PathLike): AudioConfig

Parameters

filename

PathLike

the filename of the output audio file

Returns

The audio output configuration being created. Added in version 1.11.0

fromDefaultMicrophoneInput()

Creates an AudioConfig object representing the default microphone on the system.

static function fromDefaultMicrophoneInput(): AudioConfig

Returns

The audio input configuration being created.

fromDefaultSpeakerOutput()

Creates an AudioConfig object representing the default speaker.

static function fromDefaultSpeakerOutput(): AudioConfig

Returns

The audio output configuration being created. Added in version 1.11.0

fromMicrophoneInput(string)

Creates an AudioConfig object representing a microphone with the specified device ID.

static function fromMicrophoneInput(deviceId?: string): AudioConfig

Parameters

deviceId

string

Specifies the device ID of the microphone to be used. Default microphone is used the value is omitted.

Returns

The audio input configuration being created.

fromSpeakerOutput(IPlayer)

Creates an AudioConfig object representing the custom IPlayer object. You can use the IPlayer object to control pause, resume, etc.

static function fromSpeakerOutput(player?: IPlayer): AudioConfig

Parameters

player
IPlayer

the IPlayer object for playback.

Returns

The audio output configuration being created. Added in version 1.12.0

fromStreamInput(AudioInputStream | PullAudioInputStreamCallback | MediaStream)

Creates an AudioConfig object representing the specified stream.

static function fromStreamInput(audioStream: AudioInputStream | PullAudioInputStreamCallback | MediaStream): AudioConfig

Parameters

audioStream

AudioInputStream | PullAudioInputStreamCallback | MediaStream

Specifies the custom audio input stream. Currently, only WAV / PCM is supported.

Returns

The audio input configuration being created.

fromStreamOutput(AudioOutputStream | PushAudioOutputStreamCallback)

Creates an AudioConfig object representing a specified audio output stream

static function fromStreamOutput(audioStream: AudioOutputStream | PushAudioOutputStreamCallback): AudioConfig

Parameters

audioStream

AudioOutputStream | PushAudioOutputStreamCallback

Specifies the custom audio output stream.

Returns

The audio output configuration being created. Added in version 1.11.0

fromWavFileInput(File | Buffer, string)

Creates an AudioConfig object representing the specified file.

static function fromWavFileInput(file: File | Buffer, name?: string): AudioConfig

Parameters

file

File | Buffer

name

string

Returns

The audio input configuration being created.

getProperty(string, string)

Returns the current value of an arbitrary property.

function getProperty(name: string, def?: string): string

Parameters

name

string

The name of the property to query.

def

string

The value to return in case the property is not known.

Returns

string

The current value, or provided default, of the given property.

setProperty(string, string)

Sets an arbitrary property.

function setProperty(name: string, value: string)

Parameters

name

string

The name of the property to set.

value

string

The new value of the property.