Constructor
new Segmenter(options)
Parameters:
Name |
Type |
Description |
options |
Object
|
Override default parameters.
Properties
Name |
Type |
Attributes |
Default |
Description |
logInput |
Boolean
|
<optional>
|
false
|
Apply log on the input. |
minInput |
Number
|
<optional>
|
0.000000000001
|
Minimum value to use as
input. |
filterOrder |
Number
|
<optional>
|
5
|
Order of the internally used moving
average. |
threshold |
Number
|
<optional>
|
3
|
Threshold that triggers a segment
start. |
offThreshold |
Number
|
<optional>
|
-Infinity
|
Threshold that triggers
a segment end. |
minInter |
Number
|
<optional>
|
0.050
|
Minimum delay between two semgents. |
maxDuration |
Number
|
<optional>
|
Infinity
|
Maximum duration of a segment. |
|
- Source:
Example
import * as lfo from 'waves-lfo/client';
// assuming a stream from the microphone
const source = audioContext.createMediaStreamSource(stream);
const audioInNode = new lfo.source.AudioInNode({
sourceNode: source,
audioContext: audioContext,
});
const slicer = new lfo.operator.Slicer({
frameSize: frameSize,
hopSize: hopSize,
centeredTimeTags: true
});
const power = new lfo.operator.RMS({
power: true,
});
const segmenter = new lfo.operator.Segmenter({
logInput: true,
filterOrder: 5,
threshold: 3,
offThreshold: -Infinity,
minInter: 0.050,
maxDuration: 0.050,
});
const logger = new lfo.sink.Logger({ time: true });
audioInNode.connect(slicer);
slicer.connect(power);
power.connect(segmenter);
segmenter.connect(logger);
audioInNode.start();