-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathsoftcode_functions.py
More file actions
103 lines (90 loc) · 2.64 KB
/
softcode_functions.py
File metadata and controls
103 lines (90 loc) · 2.64 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
from village.devices.sound_device import sound_device
from sound_functions import crescendo_looming_sound
from village.manager import manager
import time
from gpiozero import LED
def function1():
# stop sound
sound_device.stop()
def function2():
# load the sound loaded in manager
sound_device.load(left=manager.task.crescendo_sound, right=manager.task.crescendo_sound)
def function3():
# play the sound
sound_device.play()
def function4():
amp_for_70dB = 0.1 # ~75 dB SPL
amp_for_20dB = 0.001 # ?? dB SPL
# create a crescendo sound
crescendo_sound = crescendo_looming_sound(
amp_start=amp_for_20dB,
amp_end=amp_for_70dB,
ramp_duration=.4,
ramp_down_duration=0.01,
hold_duration=.59,
n_repeats=4,
)
# load the sound loaded in manager
sound_device.stop()
sound_device.load(right=crescendo_sound, left=crescendo_sound)
# play the sound
sound_device.play()
time.sleep(5)
sound_device.stop()
def function5():
amp_for_70dB = 0.2 # ~75 dB SPL
amp_for_20dB = 0.001 # ?? dB SPL
# create a crescendo sound
crescendo_sound = crescendo_looming_sound(
amp_start=amp_for_20dB,
amp_end=amp_for_70dB,
ramp_duration=.4,
ramp_down_duration=0.01,
hold_duration=.59,
n_repeats=4,
)
# load the sound loaded in manager
sound_device.stop()
sound_device.load(right=crescendo_sound, left=crescendo_sound)
# play the sound
sound_device.play()
time.sleep(5)
sound_device.stop()
def function6():
amp_for_70dB = 0.3 # ~75 dB SPL
amp_for_20dB = 0.001 # ?? dB SPL
# create a crescendo sound
crescendo_sound = crescendo_looming_sound(
amp_start=amp_for_20dB,
amp_end=amp_for_70dB,
ramp_duration=.4,
ramp_down_duration=0.01,
hold_duration=.59,
n_repeats=4,
)
# load the sound loaded in manager
sound_device.stop()
sound_device.load(right=crescendo_sound, left=crescendo_sound)
# play the sound
sound_device.play()
time.sleep(5)
sound_device.stop()
def function7():
amp_for_70dB = 0.5 # ~75 dB SPL
amp_for_20dB = 0.001 # ?? dB SPL
# create a crescendo sound
crescendo_sound = crescendo_looming_sound(
amp_start=amp_for_20dB,
amp_end=amp_for_70dB,
ramp_duration=.4,
ramp_down_duration=0.01,
hold_duration=.59,
n_repeats=4,
)
# load the sound loaded in manager
sound_device.stop()
sound_device.load(right=crescendo_sound, left=crescendo_sound)
# play the sound
sound_device.play()
time.sleep(5)
sound_device.stop()