annotate doc/sound.md @ 32:85d23328a215 0.10.0

added intro music, logic for browser audio triggering on splash screen
author ark
date 2026-10-20 18:39 +0200
parents fe680946164b
children
Ignore whitespace changes - Everywhere: Within whitespace: At end of lines:
rev   line source
0
7af9dd4e2595 initial art and design/planning docs
ark
parents:
diff changeset
1 sound
7af9dd4e2595 initial art and design/planning docs
ark
parents:
diff changeset
2 -----
7af9dd4e2595 initial art and design/planning docs
ark
parents:
diff changeset
3
4
2d46729a022e sound processing and in-game sounds
ark
parents: 0
diff changeset
4 events with a voice recording play the recording. the others play
2d46729a022e sound processing and in-game sounds
ark
parents: 0
diff changeset
5 placeholder beeps, generated in the browser (web audio oscillator, a few notes
2d46729a022e sound processing and in-game sounds
ark
parents: 0
diff changeset
6 each), until a recording arrives.
0
7af9dd4e2595 initial art and design/planning docs
ark
parents:
diff changeset
7
7af9dd4e2595 initial art and design/planning docs
ark
parents:
diff changeset
8
7af9dd4e2595 initial art and design/planning docs
ark
parents:
diff changeset
9 events
7af9dd4e2595 initial art and design/planning docs
ark
parents:
diff changeset
10 ------
7af9dd4e2595 initial art and design/planning docs
ark
parents:
diff changeset
11
4
2d46729a022e sound processing and in-game sounds
ark
parents: 0
diff changeset
12 the event name is the name of its recordings and its entry in [sound.event]
2d46729a022e sound processing and in-game sounds
ark
parents: 0
diff changeset
13 in config/game.toml.
2d46729a022e sound processing and in-game sounds
ark
parents: 0
diff changeset
14
2d46729a022e sound processing and in-game sounds
ark
parents: 0
diff changeset
15 | event | name | notes |
2d46729a022e sound processing and in-game sounds
ark
parents: 0
diff changeset
16 |----------------------|-------------------|-------|
2d46729a022e sound processing and in-game sounds
ark
parents: 0
diff changeset
17 | t0 attack | t0_attack | recorded, 4 variants |
2d46729a022e sound processing and in-game sounds
ark
parents: 0
diff changeset
18 | t1 shot | t1_shot | recorded, 6 variants |
2d46729a022e sound processing and in-game sounds
ark
parents: 0
diff changeset
19 | t2 shot | t2_shot | recorded, 4 variants |
2d46729a022e sound processing and in-game sounds
ark
parents: 0
diff changeset
20 | t3 shot | t3_shot | recorded, 7 variants |
2d46729a022e sound processing and in-game sounds
ark
parents: 0
diff changeset
21 | monster hit | monster_hit | frequent; keep short or play only some of them |
2d46729a022e sound processing and in-game sounds
ark
parents: 0
diff changeset
22 | monster enters map | monster_enter | recorded, 3 variants. every monster for now; to playtest |
2d46729a022e sound processing and in-game sounds
ark
parents: 0
diff changeset
23 | monster dies | monster_die | recorded, 4 variants |
2d46729a022e sound processing and in-game sounds
ark
parents: 0
diff changeset
24 | monster reaches exit | monster_exit | recorded. a heart is lost |
2d46729a022e sound processing and in-game sounds
ark
parents: 0
diff changeset
25 | boss appears | boss_enter | recorded |
2d46729a022e sound processing and in-game sounds
ark
parents: 0
diff changeset
26 | boss reaches exit | boss_exit | recorded |
2d46729a022e sound processing and in-game sounds
ark
parents: 0
diff changeset
27 | boss dies | boss_die | recorded |
2d46729a022e sound processing and in-game sounds
ark
parents: 0
diff changeset
28 | coins arrive | coins_arrive | at most one per short interval |
2d46729a022e sound processing and in-game sounds
ark
parents: 0
diff changeset
29 | wave starts | wave_start | |
2d46729a022e sound processing and in-game sounds
ark
parents: 0
diff changeset
30 | early start bonus | early_bonus | |
2d46729a022e sound processing and in-game sounds
ark
parents: 0
diff changeset
31 | tower built | tower_built | |
6
910b26feca76 full game flow
ark
parents: 4
diff changeset
32 | tower upgraded | tower_upgraded | |
910b26feca76 full game flow
ark
parents: 4
diff changeset
33 | tower sold | tower_sold | |
4
2d46729a022e sound processing and in-game sounds
ark
parents: 0
diff changeset
34 | placement refused | placement_refused | no legal spot within reach |
2d46729a022e sound processing and in-game sounds
ark
parents: 0
diff changeset
35 | button tap | button_tap | |
2d46729a022e sound processing and in-game sounds
ark
parents: 0
diff changeset
36 | map won | map_won | recorded |
2d46729a022e sound processing and in-game sounds
ark
parents: 0
diff changeset
37 | map lost | map_lost | recorded |
32
85d23328a215 added intro music, logic for browser audio triggering on splash screen
ark
parents: 17
diff changeset
38 | splash screen music | intro | recorded, loops while the splash screen shows |
0
7af9dd4e2595 initial art and design/planning docs
ark
parents:
diff changeset
39
7af9dd4e2595 initial art and design/planning docs
ark
parents:
diff changeset
40 several recordings per event are allowed; the game picks one at random.
7af9dd4e2595 initial art and design/planning docs
ark
parents:
diff changeset
41
4
2d46729a022e sound processing and in-game sounds
ark
parents: 0
diff changeset
42 the map won sound waits until a boss or monster death sound still playing has
2d46729a022e sound processing and in-game sounds
ark
parents: 0
diff changeset
43 ended, and map lost waits for the last exit sound. the boss wave may not stay
2d46729a022e sound processing and in-game sounds
ark
parents: 0
diff changeset
44 the end of a map, so boss_die and map_won are separate sounds.
2d46729a022e sound processing and in-game sounds
ark
parents: 0
diff changeset
45
2d46729a022e sound processing and in-game sounds
ark
parents: 0
diff changeset
46 per event, the config sets a volume, an optional least time between two
2d46729a022e sound processing and in-game sounds
ark
parents: 0
diff changeset
47 plays (plays in between are dropped) and the placeholder beep.
2d46729a022e sound processing and in-game sounds
ark
parents: 0
diff changeset
48
0
7af9dd4e2595 initial art and design/planning docs
ark
parents:
diff changeset
49
7af9dd4e2595 initial art and design/planning docs
ark
parents:
diff changeset
50 recordings
7af9dd4e2595 initial art and design/planning docs
ark
parents:
diff changeset
51 ----------
7af9dd4e2595 initial art and design/planning docs
ark
parents:
diff changeset
52
7af9dd4e2595 initial art and design/planning docs
ark
parents:
diff changeset
53 - recorded on any device, supplied in any common format
4
2d46729a022e sound processing and in-game sounds
ark
parents: 0
diff changeset
54 - art/sound_sources/ holds the recordings as supplied, named after the event.
2d46729a022e sound processing and in-game sounds
ark
parents: 0
diff changeset
55 a recording may hold several variants with pauses between them
2d46729a022e sound processing and in-game sounds
ark
parents: 0
diff changeset
56 - tools/cut_sounds.py turns them into game sounds in art/sounds/. it is run
2d46729a022e sound processing and in-game sounds
ark
parents: 0
diff changeset
57 by hand after a recording changes, not by the build, because it needs
2d46729a022e sound processing and in-game sounds
ark
parents: 0
diff changeset
58 ffmpeg. it lists the number of variants per recording and splits those
2d46729a022e sound processing and in-game sounds
ark
parents: 0
diff changeset
59 recordings at their longest pauses, into NAME_1, NAME_2 and so on. it
2d46729a022e sound processing and in-game sounds
ark
parents: 0
diff changeset
60 trims silence, filters low rumble, fades the ends and brings every sound to
2d46729a022e sound processing and in-game sounds
ark
parents: 0
diff changeset
61 the same peak level. the output is mono mp3, which desktop browsers and
2d46729a022e sound processing and in-game sounds
ark
parents: 0
diff changeset
62 tablets (including safari) play
32
85d23328a215 added intro music, logic for browser audio triggering on splash screen
ark
parents: 17
diff changeset
63 - the script can drop the start of a recording up to a set time, and add a
85d23328a215 added intro music, logic for browser audio triggering on splash screen
ark
parents: 17
diff changeset
64 pause of silence after a sound that loops. intro loses its first 3 s,
85d23328a215 added intro music, logic for browser audio triggering on splash screen
ark
parents: 17
diff changeset
65 which hold a burp before the music, and gets 0.3 s of silence at the end
17
fe680946164b reorganised repo
ark
parents: 8
diff changeset
66 - the build embeds art/sounds/ as base64 in www/data/sounds.js. see
4
2d46729a022e sound processing and in-game sounds
ark
parents: 0
diff changeset
67 architecture.md for why
0
7af9dd4e2595 initial art and design/planning docs
ark
parents:
diff changeset
68
32
85d23328a215 added intro music, logic for browser audio triggering on splash screen
ark
parents: 17
diff changeset
69 browsers only play sound after the first user interaction. on the first
85d23328a215 added intro music, logic for browser audio triggering on splash screen
ark
parents: 17
diff changeset
70 splash screen after loading, a sound button covers the play button. it
85d23328a215 added intro music, logic for browser audio triggering on splash screen
ark
parents: 17
diff changeset
71 pulses with a red glow, like an armed sell button. tapping it starts the
85d23328a215 added intro music, logic for browser audio triggering on splash screen
ark
parents: 17
diff changeset
72 sound and the intro music, and uncovers the play button. when sound was
85d23328a215 added intro music, logic for browser audio triggering on splash screen
ark
parents: 17
diff changeset
73 switched off in an earlier visit, there is no sound button: the play button
85d23328a215 added intro music, logic for browser audio triggering on splash screen
ark
parents: 17
diff changeset
74 shows at once and starts the sound as before, and there is no music.
85d23328a215 added intro music, logic for browser audio triggering on splash screen
ark
parents: 17
diff changeset
75
85d23328a215 added intro music, logic for browser audio triggering on splash screen
ark
parents: 17
diff changeset
76 the intro loops until the play button is tapped, then fades out over the
85d23328a215 added intro music, logic for browser audio triggering on splash screen
ark
parents: 17
diff changeset
77 music_fade setting in [sound]. the splash screen that follows a won game
85d23328a215 added intro music, logic for browser audio triggering on splash screen
ark
parents: 17
diff changeset
78 plays the intro at once, as sound is already running.
0
7af9dd4e2595 initial art and design/planning docs
ark
parents:
diff changeset
79
8
2c4fed8baed9 art update, persistent sound setting, tower selling as double action
ark
parents: 6
diff changeset
80 the sound button in the top bar switches sound on and off. the choice is
2c4fed8baed9 art update, persistent sound setting, tower selling as double action
ark
parents: 6
diff changeset
81 stored in the browser (architecture.md, persistence). until the player first
2c4fed8baed9 art update, persistent sound setting, tower selling as double action
ark
parents: 6
diff changeset
82 uses it, the enabled setting in [sound] applies.