OnsetDetector
Detects the onsets (note attacks / transients) in an audio stream in real time.
| Type | Name | Interface Description |
|---|---|---|
| Functions | constructor() | |
| Functions | getResult(): number | • Function: Gets the current onset detection result. The value represents the onset energy of the current audio frame. A higher value indicates a stronger note attack or transient. Returns The onset energy value in the range [0, 1024], or -1 when no result is available. |
Examples
constructor()
let obj = new APJS.OnsetDetector();
Use Case
@component()
export class NewBehaviourScript extends APJS.BasicScriptComponent {
onStart() {
// TODO: instantiate / use OnsetDetector here
}
onUpdate(deltaTime: number) {
}
}