Class: Mel

Mel

Compute the mel bands spectrum from a given spectrum (vector type). Implement the htk mel band style.

support standalone usage

Constructor

new Mel(options)

Parameters:
Name Type Description
options Object

Override default parameters.

Properties
Name Type Attributes Default Description
log Boolean <optional>
false

Apply a logarithmic scale on the output.

nbrBands Number <optional>
24

Number of filters defining the mel bands.

minFreq Number <optional>
0

Minimum frequency to consider.

maxFreq Number <optional>
null

Maximum frequency to consider. If null, is set to Nyquist frequency.

power Number <optional>
1

Apply a power scaling on each mel band.

Source:
To Do:
  • - implement Slaney style mel bands
Example
import lfo from 'waves-lfo/node'

// read a file from path (node only source)
const audioInFile = new lfo.source.AudioInFile({
  filename: 'path/to/file',
  frameSize: 512,
});

const slicer = new lfo.operator.Slicer({
  frameSize: 256,
  hopSize: 256,
});

const fft = new lfo.operator.Fft({
  size: 1024,
  window: 'hann',
  mode: 'power',
  norm: 'power',
});

const mel = new lfo.operator.Mel({
  log: true,
  nbrBands: 24,
});

const logger = new lfo.sink.Logger({ data: true });

audioInFile.connect(slicer);
slicer.connect(fft);
fft.connect(mel);
mel.connect(logger);

audioInFile.start();

Methods

inputVector(spectrum) → {Array}

Use the Mel operator in standalone mode (i.e. outside of a graph).

Parameters:
Name Type Description
spectrum Array

Fft bins.

Source:
Returns:
  • Mel bands.
Type
Array
Example
const mel = new lfo.operator.Mel({ nbrBands: 24 });
// mandatory for use in standalone mode
mel.initStream({ frameSize: 256, frameType: 'vector', sourceSampleRate: 44100 });
mel.inputVector(fftBins);