Skip to content

Commit 1cae587

Browse files
committed
feat: add documentation for sound management in Goboscript
1 parent 0ac5265 commit 1cae587

File tree

2 files changed

+41
-0
lines changed

2 files changed

+41
-0
lines changed

docs/language/sounds.md

+40
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,40 @@
1+
# Sounds
2+
3+
!!! note
4+
Scratch only supports MP3 and WAV files.
5+
Other formats will (as of now) not raise a warning or error, and the project will
6+
refuse to load in Scratch.
7+
8+
You can add sounds to a sprite by specifying their file paths relative to the project
9+
directory.
10+
11+
```goboscript
12+
sounds "path/to/sound.mp3";
13+
```
14+
15+
### Listing Multiple Sounds
16+
To add multiple sounds, separate their file paths with commas. Sounds will appear in the
17+
order you list them in the `sounds` statement.
18+
19+
```goboscript
20+
sounds "path/to/sound1.mp3", "path/to/sound2.wav";
21+
```
22+
23+
Each sound's name is taken from the file name without its extension.
24+
25+
### Renaming Sounds
26+
You can rename a sound using the `as` keyword.
27+
28+
```goboscript
29+
sounds "path/to/sound.mp3" as "new name";
30+
```
31+
32+
### Using Wildcards (Globs)
33+
You can use wildcards to include multiple sounds, such as all `.mp3` files in a
34+
directory. Use the `*` wildcard for this.
35+
36+
```goboscript
37+
sounds "path/to/sounds/*.mp3";
38+
```
39+
40+
Sounds added this way are sorted alphabetically.

mkdocs.yml

+1
Original file line numberDiff line numberDiff line change
@@ -8,6 +8,7 @@ nav:
88
- Syntax: language/syntax.md
99
- Sprites: language/sprites.md
1010
- Costumes: language/costumes.md
11+
- Sounds: language/sounds.md
1112
- Variables: language/variables.md
1213
- Lists: language/lists.md
1314
- Operators: language/operators.md

0 commit comments

Comments
 (0)