new EssentiaTFInputExtractor( EssentiaWASM [, extractorType [, isDebug ] ] )

Parameters
Name Type Attributes Default Description
EssentiaWASM EssentiaWASM

Essentia WASM emcripten global module object

extractorType string <optional>
'musicnn'

type of the desired extractor type (eg. 'muscinn', 'vggish' or 'tempocnn').

isDebug boolean <optional>
false

whether to enable EssentiaWASM internal debugger for logs.

Members


essentia

Properties
Name Type Description
this.essentia EssentiaJS

an instance of EssentiaWASM.EssentiaJS.

this.extractorType string

type of the choosen extractor (eg. 'muscinn', 'vggish' or 'tempocnn').

Methods


arrayToVector( inputArray ) → {VectorFloat}

Description

Convert a typed JS Float32Array into VectorFloat type.

Parameters
Name Type Description
inputArray Float32Array

input Float32 typed array.

Returns

returns converted VectorFloat array.


vectorToArray( inputVector ) → {Float32Array}

Description

Convert an input VectorFloat array into typed JS Float32Array

Parameters
Name Type Description
inputVector VectorFloat

input VectorFloat array

Returns

returns converted JS typed array


<async> getAudioBufferFromURL( audioURL, webAudioCtx ) → {Promise.<AudioBuffer>}

Description

Decode and returns the audio buffer from an given audio url or blob uri using Web Audio API. (NOTE: This doesn't work on Safari browser)

Parameters
Name Type Description
audioURL string

web url or blob uri of a audio file

webAudioCtx AudioContext

an instance of Web Audio API AudioContext

Returns

decoded audio buffer as a promise


audioBufferToMonoSignal( buffer ) → {Float32Array}

Description

Convert an AudioBuffer object to a Mono audio signal array. The audio signal is downmixed to mono using essentia MonoMixer algorithm if the audio buffer has 2 channels of audio. Throws an expection if the input AudioBuffer object has more than 2 channels of audio.

Parameters
Name Type Description
buffer AudioBuffer

AudioBuffer object decoded from an audio file.

Returns

audio channel data. (downmixed to mono if its stereo signal).


downsampleAudioBuffer( sourceBuffer ) → {Float32Array}

Description

Downsample a audio buffer to a target audio sample rate using the Web Audio API NOTE: This method will only works on web-browsers which supports the Web Audio API.

Parameters
Name Type Description
sourceBuffer AudioBuffer

AudioBuffer object decoded from an audio file.

Returns

decoded audio buffer object


compute( audioFrame ) → {EssentiaTFInputExtractorOutput}

Description

This method compute the pre-configured features for a given audio signal frame. It throws an exception if the size of audioFrame is not equal to the pre-configured audioFrame size for the selected extractorType setting.

Parameters
Name Type Description
audioFrame Float32Array

a frame of audio signal as Float32 typed JS array.

Returns

returns the computed feature for the input the given audio frame.


computeFrameWise( audioSignal, hopSize? ) → {EssentiaTFInputExtractorOutput}

Description

This method compute the pre-configured feature for a whole audio signal. It is a wrapper on top of the compute method. It throws an exception if the size of audioFrame is not equal to the pre-configured size.

Parameters
Name Type Description
audioSignal Float32Array

decoded audio signal as Float32 typed JS array.

hopSize? number

optional param for specifying hopSize for overlapping-frames. By default use none.

Returns

returns the computed frame-wise feature for the given audio signal.


"delete"() → {null}

Description

Delete essentia session and frees the memory.

Returns

shutdown() → {null}

Description

This method shutdown all the instance of Essentia WASM and frees the memory. NOTE: If you want to just free the memory of the pre-configured extractor, use this.extractor.delete() instead.

Returns