Constructor
new SegmentEngine(optionsopt)
Parameters:
Name | Type | Attributes | Default | Description | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|
options |
Object |
<optional> |
{} | Default options Properties
|
- Source:
Example
import * as audio from 'waves-audio';
const scheduler = audio.getScheduler();
const segmentEngine = new audio.SegmentEngine();
scheduler.add(segmentEngine);
Extends
Members
abortTime :Number
Fade-out time (when aborted)
Type:
- Number
- Default Value:
- 0.005
- Source:
attackAbs :Number
Absolute attack time in sec
Type:
- Number
- Default Value:
- 0.005
- Source:
attackRel :Number
Attack time relative to segment duration
Type:
- Number
- Default Value:
- 0
- Source:
buffer :AudioBuffer
Audio buffer
Type:
- AudioBuffer
- Default Value:
- null
- Source:
bufferDuration :Number
Get buffer duration (excluding wrapAroundExtension)
Type:
- Number
- Default Value:
- 0
- Source:
cyclic :Bool
Whether the audio buffer and segment indices are considered as cyclic
Type:
- Bool
- Default Value:
- false
- Source:
delay :Number
Time by which all segments are delayed (especially to realize segment offsets)
Type:
- Number
- Default Value:
- 0.005
- Source:
durationAbs :Number
Absolute segment duration in sec
Type:
- Number
- Default Value:
- 0
- Source:
durationArray :Number
Array of segment durations in sec
Type:
- Number
- Default Value:
- [0.0]
- Source:
durationRel :Number
Segment duration relative to given segment duration or inter-segment distance
Type:
- Number
- Default Value:
- 1
- Source:
gain :Number
Linear gain factor
Type:
- Number
- Default Value:
- 1
- Source:
monophonic :Number
Whether the last segment is aborted when triggering the next
Type:
- Number
- Default Value:
- false
- Source:
offsetAbs :Number
Absolute segment offset in sec
Type:
- Number
- Default Value:
- -0.005
- Source:
offsetArray :Array
Array of segment offsets in sec
offset > 0: the segment's reference position is after the given segment position offset < 0: the given segment position is the segment's reference position and the duration has to be corrected by the offset
Type:
- Array
- Default Value:
- [0.0]
- Source:
offsetRel :Number
Segment offset relative to segment duration
Type:
- Number
- Default Value:
- 0
- Source:
periodAbs :Number
Absolute segment period in sec
Type:
- Number
- Default Value:
- 0
- Source:
periodMin :Number
Minimum segment period
Type:
- Number
- Default Value:
- 0.001
- Source:
periodRel :Number
Segment period relative to inter-segment distance
Type:
- Number
- Default Value:
- 1
- Source:
periodVar :Number
Amout of random segment period variation relative to segment period
Type:
- Number
- Default Value:
- 0
- Source:
positionArray :Number
Array of segment positions (onset times in audio buffer) in sec
Type:
- Number
- Default Value:
- [0.0]
- Source:
positionVar :Number
Amout of random segment position variation in sec
Type:
- Number
- Default Value:
- 0
- Source:
releaseAbs :Number
Absolute release time in sec
Type:
- Number
- Default Value:
- 0.005
- Source:
releaseRel :Number
Release time relative to segment duration
Type:
- Number
- Default Value:
- 0
- Source:
resampling :Number
Segment resampling in cent
Type:
- Number
- Default Value:
- 0
- Source:
resamplingVar :Number
Amout of random resampling variation in cent
Type:
- Number
- Default Value:
- 0
- Source:
segmentIndex :Number
Index of the segment to synthesize (i.e. of this.positionArray/durationArray/offsetArray)
Type:
- Number
- Default Value:
- 0
- Source:
wrapAroundExtension :Number
Portion at the end of the audio buffer that has been copied from the beginning to assure cyclic behavior
Type:
- Number
- Default Value:
- 0
- Source:
Methods
abort(time)
Abort the current segment at given time, fade out duration
Parameters:
Name | Type | Description |
---|---|---|
time |
Number | abort time |
- Source:
connect(target)
Connect to an audio node (e.g. audioContext.destination)
Parameters:
Name | Type | Description |
---|---|---|
target |
AudioNode | Target audio node |
- Inherited From:
- Source:
disconnect(target)
Disconnect from an audio node (e.g. audioContext.destination). If undefined disconnect from all target nodes.
Parameters:
Name | Type | Description |
---|---|---|
target |
AudioNode | Target audio node. |
- Inherited From:
- Source:
trigger(time) → {Number}
Trigger a segment. This function can be called at any time (whether the engine is scheduled/transported or not) to generate a single segment according to the current segment parameters.
Parameters:
Name | Type | Description |
---|---|---|
time |
Number | segment synthesis audio time |
- Source:
Returns:
period to next segment
- Type
- Number