Class: LexUtils

LexUtils

A collection of useful lex related functions.

Methods

(static) downsampleAudio(buffer, sourceSampleRate, targetSampleRate) → {Float32Array}

Downsamples the audio to a target sample rate.

Inspired by the following blog post from the Lex team:
https://aws.amazon.com/blogs/machine-learning/capturing-voice-input-in-a-browser/

Parameters:
Name Type Description
buffer Float32Array

Input audio buffer

sourceSampleRate float

Sample rate of the input audio buffer

targetSampleRate float

Sample rate to try to convert to

Returns:

Downsampled audio buffer

Type
Float32Array

(static) encodeWAV(buffer, targetSampleRate) → {DataView}

Converts audio data to WAV.

Inspired by the following blog post from the Lex team:
https://aws.amazon.com/blogs/machine-learning/capturing-voice-input-in-a-browser/

Parameters:
Name Type Description
buffer Float32Array

Input audio buffer

targetSampleRate float

Sample rate for the output audio

Returns:

Converted audio data

Type
DataView