Sonolus Wiki

08. SFX

In this chapter, we will add SFX to Note.

Declaring

As before, declare the effect clip to be used:

export const effect = defineEffect({
    clips: {
        perfect: EffectClipName.Perfect,
    },
})
export const effect = defineEffect({
    clips: {
        perfect: EffectClipName.Perfect,
    },
})

Scheduling

Unlike play mode where we play SFX reactively when player taps the note, in watch mode we schedule SFX at the correct time so that Sonolus can sync up the audio perfectly:

export class Note extends Archetype {
    // ...

    preprocess() {
        // ...

        effect.clips.perfect.schedule(this.targetTime, 0.02)

        // ...
    }

    // ...
}
export class Note extends Archetype {
    // ...

    preprocess() {
        // ...

        effect.clips.perfect.schedule(this.targetTime, 0.02)

        // ...
    }

    // ...
}