OnsetDetectorBuilder
A builder for onset detector to set the source of the detector and build the detector.
| Type | Name | Interface Description |
|---|---|---|
| Functions | constructor() | |
| Functions | build(): OnsetDetector | null | • Function: Build the onset detector. Note that the detector should be built in onInit, otherwise it will return null. |
| Functions | setDetectorSource(type: AudioSourceType, audioComponent: IAudioComponent | null): this | • Function: Set the source of the detector. Parameters • • Returns Builder instance for chaining. |
| Functions | setThreshold(threshold: number): this | • Function: Set the threshold of the onset detection. Parameters • |
Examples
constructor()
let obj = new APJS.OnsetDetectorBuilder();
setDetectorSource(type: AudioSourceType, audioComponent: IAudioComponent | null): this
audioDetectorBuilder
.setDetectorSource(APJS.AudioSourceType.ExternalFile, audioComponent)
.build();
Use Case
@component()
export class NewBehaviourScript extends APJS.BasicScriptComponent {
onStart() {
// TODO: instantiate / use OnsetDetectorBuilder here
}
onUpdate(deltaTime: number) {
}
}