Constructor
new MovingMedian(options)
Parameters:
Name | Type | Description | |||||||||||||||
---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|
options |
Object | Override default parameters. Properties
|
- Source:
- To Do:
-
- - Implement `processSignal`
Example
import * as lfo from 'waves-lfo/common';
const eventIn = new lfo.source.EventIn({
frameSize: 2,
frameType: 'vector',
});
const movingMedian = new lfo.operator.MovingMedian({
order: 5,
fill: 0,
});
const logger = new lfo.sink.Logger({ data: true });
eventIn.connect(movingMedian);
movingMedian.connect(logger);
eventIn.start();
eventIn.processFrame(null, [1, 1]);
> [0, 0]
eventIn.processFrame(null, [2, 2]);
> [0, 0]
eventIn.processFrame(null, [3, 3]);
> [1, 1]
eventIn.processFrame(null, [4, 4]);
> [2, 2]
eventIn.processFrame(null, [5, 5]);
> [3, 3]
Methods
inputScalar(value) → {Number}
Allows for the use of a MovingMedian
outside a graph (e.g. inside
another node), in this case processStreamParams
and resetStream
should be called manually on the node.
Parameters:
Name | Type | Description |
---|---|---|
value |
Number | Value to feed the moving median with. |
- Source:
Returns:
- Median value.
- Type
- Number
Example
import * as lfo from 'waves-lfo/client';
const movingMedian = new MovingMedian({ order: 5 });
movingMedian.initStream({ frameSize: 1, frameType: 'scalar' });
movingMedian.inputScalar(1);
> 0
movingMedian.inputScalar(2);
> 0
movingMedian.inputScalar(3);
> 1
movingMedian.inputScalar(4);
> 2
inputVector(values) → {Float32Array}
Allows for the use of a MovingMedian
outside a graph (e.g. inside
another node), in this case processStreamParams
and resetStream
should be called manually on the node.
Parameters:
Name | Type | Description |
---|---|---|
values |
Array | Values to feed the moving median with. |
- Source:
Returns:
- Median values for each dimension.
- Type
- Float32Array
Example
import * as lfo from 'waves-lfo/client';
const movingMedian = new MovingMedian({ order: 3, fill: 0 });
movingMedian.initStream({ frameSize: 3, frameType: 'vector' });
movingMedian.inputArray([1, 1]);
> [0, 0]
movingMedian.inputArray([2, 2]);
> [1, 1]
movingMedian.inputArray([3, 3]);
> [2, 2]