You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Copy file name to clipboardexpand all lines: public/externalLibs/sound/README.md
+8-5
Original file line number
Diff line number
Diff line change
@@ -1,6 +1,8 @@
1
1
To describe a Sound, you need a wave function, and the duration of the Sound in seconds.
2
-
The wave function takes a time *t* (in seconds) as argument and returns the amplitude of the wave
3
-
(a number between -1 and 1) at time *t*. An example wave function `my_wave` has this type:
2
+
The wave function takes a non-negative time *t* (in seconds) as argument and returns the amplitude
3
+
of the wave
4
+
(a number between -1 and 1) at time *t*. In this library, we assume that as duration of a sound
5
+
a non-negative number is given. An example wave function `my_wave` has this type:
4
6
5
7
`my_wave` : Number → Number
6
8
@@ -45,13 +47,14 @@ play(noise_sound(0.5));
45
47
46
48
after which you should hear half a second of noise. (If you don't, your browser does not support sound; use a different one or ask your Avenger for advice).
47
49
48
-
### Sound Discipline
50
+
### Sound Property
49
51
50
52
The `make_sound` constructor ensures that all Sounds have the following property:
51
53
```
52
54
(get_wave(sound))(get_duration(sound) + t) === 0
53
55
```
54
-
for any number `t`> 0, regardless what the original wave of the Sound returns for `t`.
56
+
for any number `t`≥ 0, regardless what the original wave of the Sound returns for `t`.
55
57
The wave will simply return 0 when the duration is up.
56
-
This Sound discipline removes the need to change the wave function when
58
+
This Sound property removes the need to explicitly change the wave function when
0 commit comments