-
Notifications
You must be signed in to change notification settings - Fork 3
/
Copy pathengine_factory.py
321 lines (294 loc) · 7.23 KB
/
engine_factory.py
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
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
263
264
265
266
267
268
269
270
271
272
273
274
275
276
277
278
279
280
281
282
283
284
285
286
287
288
289
290
291
292
293
294
295
296
297
298
299
300
301
302
303
304
305
306
307
308
309
310
311
312
313
314
315
316
317
318
319
320
321
# Reference: https://en.wikipedia.org/wiki/Big-bang_firing_order
import synth
import audio_tools
from engine import Engine
import random as rd
_fire_snd = synth.sine_wave_note(frequency=160, duration=1)
audio_tools.normalize_volume(_fire_snd)
audio_tools.exponential_volume_dropoff(_fire_snd, duration=0.06, base=5)
def v_twin_90_deg():
'''Suzuki SV650/SV1000, Yamaha MT-07'''
return Engine(
idle_rpm=1000,
limiter_rpm=10500,
strokes=4,
cylinders=2,
timing=[270, 450],
fire_snd=_fire_snd,
between_fire_snd=synth.silence(1)
)
def v_twin_60_deg():
return Engine(
idle_rpm=1100,
limiter_rpm=10500,
strokes=4,
cylinders=2,
timing=[300, 420],
fire_snd=_fire_snd,
between_fire_snd=synth.silence(1)
)
def v_twin_45_deg():
return Engine(
idle_rpm=800,
limiter_rpm=7000,
strokes=4,
cylinders=2,
timing=[315, 405],
fire_snd=_fire_snd,
between_fire_snd=synth.silence(1)
)
def inline_4():
return Engine(
idle_rpm=800,
limiter_rpm=7800,
strokes=4,
cylinders=4,
timing=[180, 180, 180, 180],
fire_snd=_fire_snd,
between_fire_snd=synth.silence(1)
)
def inline_7():
return Engine(
idle_rpm=800,
limiter_rpm=7800,
strokes=4,
cylinders=7,
timing=[103, 103, 103, 103, 103, 103, 102],
fire_snd=_fire_snd,
between_fire_snd=synth.silence(1)
)
def inline_6():
return Engine(
idle_rpm=800,
limiter_rpm=7800,
strokes=4,
cylinders=6,
timing=[120, 120, 120, 120, 120, 120],
fire_snd=_fire_snd,
between_fire_snd=synth.silence(1)
)
def v_8_LR():
return Engine(
idle_rpm=800,
limiter_rpm=7000,
strokes=4,
cylinders=8,
timing=[90]*8,
fire_snd=_fire_snd,
between_fire_snd=synth.silence(1)
)
def v_8_LS():
return Engine(
idle_rpm=600,
limiter_rpm=7000,
strokes=4,
cylinders=8,
timing=[180, 270, 180, 90, 180, 270, 180, 90],
fire_snd=_fire_snd,
between_fire_snd=synth.silence(1)
)
def v_8_FP():
return Engine(
idle_rpm=800,
limiter_rpm=7000,
strokes=4,
cylinders=8,
timing=[180]*8,
fire_snd=_fire_snd,
between_fire_snd=synth.silence(1)
)
def v_8_FP_TVR():
return Engine(
idle_rpm=800,
limiter_rpm=7000,
strokes=4,
cylinders=8,
timing=[75]*8,
fire_snd=_fire_snd,
between_fire_snd=synth.silence(1)
)
def w_16():
return Engine(
idle_rpm=800,
limiter_rpm=7000,
strokes=4,
cylinders=16,
timing=[27, 90-27, 27, 180-117, 27, 270-207, 27, 360-297, 27, 90-27, 27, 180-117, 27, 270-207, 27, 360-297],
#timing=[180, 270, 180, 90],
fire_snd=_fire_snd,
between_fire_snd=synth.silence(1)
)
def inline_9():
return Engine(
idle_rpm=800,
limiter_rpm=7000,
strokes=4,
cylinders=9,
timing=[80]*9,
fire_snd=_fire_snd,
between_fire_snd=synth.silence(1)
)
def inline_1():
return Engine(
idle_rpm=800,
limiter_rpm=7000,
strokes=4,
cylinders=1,
timing=[720],
fire_snd=_fire_snd,
between_fire_snd=synth.silence(1)
)
def inline_7_4_3():
return Engine(
idle_rpm=800,
limiter_rpm=9000,
strokes=4,
cylinders=7,
timing=[180, 90, 180, 270]+[240]*3,
fire_snd=_fire_snd,
between_fire_snd=synth.silence(1)
)
def inline_16():
whynot=16
return Engine(
idle_rpm=800,
limiter_rpm=7000,
strokes=4,
cylinders=whynot,
timing=[720/whynot]*whynot,
fire_snd=_fire_snd,
between_fire_snd=synth.silence(1)
)
def inline_5():
whynot=5
return Engine(
idle_rpm=800,
limiter_rpm=9000,
strokes=4,
cylinders=whynot,
timing=[720/whynot]*whynot,
fire_snd=_fire_snd,
between_fire_snd=synth.silence(1)
)
def inline_any():
whynot=5
return Engine(
idle_rpm=800,
limiter_rpm=9000,
strokes=4,
cylinders=whynot,
timing=[720/whynot]*whynot,
fire_snd=_fire_snd,
between_fire_snd=synth.silence(1)
)
def inline_5_crossplane():
whynot=5
return Engine(
idle_rpm=800,
limiter_rpm=9000,
strokes=4,
cylinders=whynot,
timing=[180, 90, 180, 90, 180],
fire_snd=_fire_snd,
between_fire_snd=synth.silence(1)
)
def inline_4_uneven_firing():
whynot=4
mini = 170
maxi = 190
return Engine(
idle_rpm=800,
limiter_rpm=7800,
strokes=4,
cylinders=whynot,
timing=[rd.uniform(mini, maxi), rd.uniform(mini, maxi), rd.uniform(mini, maxi), rd.uniform(mini, maxi)],
fire_snd=_fire_snd,
between_fire_snd=synth.silence(1)
)
def boxer_4_crossplane_custom(rando=[0]*4): #wrx
whynot=4
because=180
#because=rando
return Engine(
idle_rpm=750,
limiter_rpm=6700,
strokes=4,
cylinders=whynot,
timing=[because, 360-because]*2,
#timing = [180, 270, 180, 90],
fire_snd=_fire_snd,
between_fire_snd=synth.silence(1),
unequal=rando
)
def boxer_4_half():
whynot=2
return Engine(
idle_rpm=800,
limiter_rpm=6700,
strokes=4,
cylinders=whynot,
timing=[180, 720-180],
fire_snd=_fire_snd,
between_fire_snd=synth.silence(1)
)
def random():
#whynot=rd.choice([4, 8, 16])
whynot=4
print(whynot)
randlist = []
for i in range(whynot):
rando = rd.randrange(int(360/5/whynot), int(1440/5/whynot))*5
randlist = [rd.randrange(int(360/5/whynot), int(1440/5/whynot))*5 for x in range(whynot)]
print(randlist)
return Engine(
idle_rpm=800,
limiter_rpm=9000,
strokes=4,
cylinders=whynot,
timing=randlist,
fire_snd=_fire_snd,
between_fire_snd=synth.silence(1)
)
def v_four_90_deg():
return Engine(
idle_rpm=1100,
limiter_rpm=16500,
strokes=4,
cylinders=4,
timing=[180, 90, 180, 270],
fire_snd=_fire_snd,
between_fire_snd=synth.silence(1)
)
def fake_rotary_2rotor():
difference = 60
return Engine(
idle_rpm=800,
limiter_rpm=8300,
strokes=2,
cylinders=2,
#timing=[90, 720-90],
timing = [difference, 720-difference],
fire_snd=_fire_snd,
between_fire_snd=synth.silence(1)
)
def inline_4_1_spark_plug_disconnected():
return Engine(
idle_rpm=800,
limiter_rpm=7800,
strokes=4,
cylinders=3,
timing=[180, 360, 180],
fire_snd=_fire_snd,
between_fire_snd=synth.silence(1)
)
def V_12(rando=[0]*12):
return Engine(
idle_rpm=800,
limiter_rpm=9000,
strokes=4,
cylinders=12,
timing=[60]*12,
fire_snd=_fire_snd,
between_fire_snd=synth.silence(1),
unequal=rando
)