Skip to content

08 Sound Effects

In this chapter, we will schedule a hit sound for each note.

Effect Clip

The play section already declared the Perfect, Great, and Good clips in the shared Effects collection. Watch mode reuses those clips.

Scheduling

Edit guide/watch/note.py. Add the shared effect import:

python
from guide.lib.effect import Effects

Then add this line at the end of preprocess, after self.result.target_time:

python
class WatchNote(WatchArchetype):
    # ...

    def preprocess(self):
        # ...

        Effects.perfect.schedule(self.target_time, 0.02)

Play mode calls an effect when the player taps. Watch mode can schedule effects during preprocessing so Sonolus can synchronize them with the level. Effects.perfect.schedule expects a level-time value, so pass target_time rather than the scaled time used by entity lifetimes.

This Perfect schedule is temporary. It gives normal watch mode the intended sound now, but it does not yet distinguish replay judgments or recorded accuracy. Chapter 10 will replace this line with replay-aware scheduling.

Reload normal watch mode. Each note should play the Perfect sound when it reaches the judgment line.