Skip to main content

SoundEventDetector

Sound event detector.

TypeNameInterface Description
Variablesenabled: boolean

• Function: Whether the detector is enabled.

Functionsconstructor()

FunctionsgetResult(): SoundEventResult[]

• Function: get sound event detection result

FunctionsgetSimilarityByType(type: SoundEventType): number

• Function: get similarity of specific sound event type

Examples​

enabled: boolean​

this.audioEventDetector.enabled = false;

constructor()​

let obj = new APJS.SoundEventDetector();

getResult(): SoundEventResult[]​

const results = this.audioEventDetector.getResult();
for (const result of results) {
console.log(result.type, result.similarity);
}

getSimilarityByType(type: SoundEventType): number​

const catResult = this.audioEventDetector.getSimilarityByType(APJS.SoundEventType.Cat);
console.log(catResult);

Use Case​

@component()
export class NewBehaviourScript extends APJS.BasicScriptComponent {
onStart() {
// TODO: instantiate / use SoundEventDetector here
}
onUpdate(deltaTime: number) {
}
}
Copyright © 2026 TikTok. All rights reserved.
About TikTokHelp CenterCareersContactLegalTerms of ServicePrivacy PolicyCookies