-
Notifications
You must be signed in to change notification settings - Fork 3
/
sound.txt
139 lines (115 loc) · 2.9 KB
/
sound.txt
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
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
//----- Variables -----------------------------------------------------------------------------------------------------
+channel Cycle = 0
+channel ID = 3
+is clone? = 0
i = 0
loop = 4
menu0exit = 0
return = 155.6236834377
//----- Broadcast received events -------------------------------------------------------------------------------------
WhenBroadcastReceived(+audioEngineUpdateAll)
{
If (+is clone? == 0)
{
Call check audio clones;
}
Else
{
If (+channel ID == 4)
{
Call convert pitch to MIDI note((524288 / +sound pitch[+channel ID]));
}
Else
{
Call convert pitch to MIDI note((131072 / (2048 - +sound pitch[+channel ID])));
}
Sound.SetEffectTo(PITCH, ((return - 69) * 10));
}
}
WhenBroadcastReceived(+audioEngineUpdateAll)
{
If (+is clone? == 0)
{
}
Else
{
If (+sound duty cycle[+channel ID] == +channel Cycle)
{
Sound.SetVolumeTo(((+sound volume[+channel ID] * .5) * +globalVol.R));
}
Else
{
Sound.SetVolumeTo(0);
}
}
}
WhenBroadcastReceived(+turnoffaudio)
{
Sound.SetVolumeTo(0);
}
WhenBroadcastReceived(exit emulator)
{
+is clone? = 0;
Control.DeleteThisClone();
}
WhenBroadcastReceived(reset emulator)
{
+is clone? = 0;
Control.DeleteThisClone();
}
//----- Start as clone ------------------------------------------------------------------------------------------------
Control.WhenIStartAsClone()
{
Forever
{
If (+channel ID == 1)
{
Sound.PlayUntilDone(Operator.Join("P", Operator.Join(+channel Cycle, 0)));
}
If (+channel ID == 2)
{
Sound.PlayUntilDone(Operator.Join("P", Operator.Join(+channel Cycle, 1)));
}
If (+channel ID == 4)
{
Sound.PlayUntilDone(Operator.Join("N", Operator.Join(+channel Cycle, 0)));
}
}
}
//----- Custom blocks -------------------------------------------------------------------------------------------------
Define check audio clones (warp=true)
{
control_for_each ?? - probably legacy function from Scratch 2.0;
}
Define clone sound channel (warp=true)
{
+is clone? = 1;
Control.CreateCloneOf(_myself_);
+is clone? = 0;
}
Define convert pitch to MIDI note(string p) (warp=true)
{
return = ((12 * (ln((p / 440)) / ln(2))) + 69);
}
Define fast (warp=true)
{
+channel Cycle = 0;
Repeat (Operator.LetterOf(4402, loop))
{
Call clone sound channel;
+channel Cycle += 1;
}
}
//----- Costumes ------------------------------------------------------------------------------------------------------
costume1.svg
//----- Sounds --------------------------------------------------------------------------------------------------------
N00.wav
N10.wav
P00.wav
P01.wav
P10.wav
P11.wav
P20.wav
P21.wav
P30.wav
P31.wav