Class: Multiplier

Multiplier

Multiply a given signal or vector by a given factor. On vector streams, factor can be an array of values to apply on each dimension of the vector frames.

support standalone usage

Constructor

new Multiplier(options)

Parameters:
Name Type Description
options Object

override default values

Properties
Name Type Attributes Default Description
factor Number | Array <optional>
1

factor or array of factor to apply on the incomming frame. Setting an array is only defined in case of a vector stream.

Source:
Example
import * as lfo from 'waves-lfo/common';

const eventIn = new lfo.operator.EventIn({
  type: 'vector',
  frameSize: 2,
  frameRate: 0,
});
const scaler = new lfo.operator.Multiplier({ factor: 0.1 });

eventIn.connect(scaler);

eventIn.process(null, [2, 3]);
> [0.2, 0.3]

Methods

inputSignal(data) → {Array}

Use the Multiplier operator in standalone mode.

Parameters:
Name Type Description
data Float32Array | Array

Input signal.

Source:
Returns:
  • Scaled signal.
Type
Array
Example
const scaler = new Multiplier({ factor: 0.1 });
scaler.initStream({ frameType: 'signal', frameSize: 2 });

scaler.inputVector([1, 2]);
> [0.1, 0.2]

inputVector(data) → {Array}

Use the Multiplier operator in standalone mode.

Parameters:
Name Type Description
data Float32Array | Array

Input vector

Source:
Returns:
  • Scaled values
Type
Array
Example
const scaler = new Multiplier({ factor: [2, 4] });
scaler.initStream({ frameType: 'vector', frameSize: 2 });

scaler.inputVector([3, 2]);
> [6, 8]