Initial commit
[wavedrum/wavedrum-lib.git] / Wavedrum / Algorithm.hs
1 {-
2 wavedrum-lib, a library to parse, edit and write Korg Wavedrum programs.
3 Copyright (C) 2013 Ricardo Wurmus
4
5 This program is free software: you can redistribute it and/or modify
6 it under the terms of the GNU General Public License as published by
7 the Free Software Foundation, either version 3 of the License, or
8 (at your option) any later version.
9
10 This program is distributed in the hope that it will be useful,
11 but WITHOUT ANY WARRANTY; without even the implied warranty of
12 MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
13 GNU General Public License for more details.
14
15 You should have received a copy of the GNU General Public License
16 along with this program. If not, see <http://www.gnu.org/licenses/>.
17 -}
18
19 {-# LANGUAGE OverloadedStrings #-}
20
21 module Wavedrum.Algorithm where
22
23 import Control.Applicative
24 import Control.Monad
25 import qualified Data.Text as T
26 import Wavedrum.Types
27
28 type ParamSetting = (T.Text, Range)
29 data AlgoType = Single | Double deriving (Show, Eq)
30 data Algorithm = Algorithm { algoType :: AlgoType
31 , algoName :: T.Text
32 , algoParams :: [ParamSetting]
33 } deriving (Show, Eq)
34
35 apply3 :: (a -> b -> c -> d) -> (a,b,c) -> d
36 apply3 f (a,b,c) = f a b c
37
38 algorithms :: [Algorithm]
39 algorithms = map (apply3 Algorithm) [
40 (Single, "Udu",
41 [ ("Clang Pitch", (0,100))
42 , ("Clang Decay", (0,100))
43 , ("Clang Color", (0,100))
44 , ("Clang Height", (0,100))
45 , ("Clang Width", (0,100))
46 , ("Clang Level", (0,100))
47 , ("Boom Level", (0,100))
48 , ("Clang Type", (0,100))
49 ])
50 , (Single, "Temple",
51 [ ("Bell Color", ( 0,100))
52 , ("Harmonic Shift", (-50, 50))
53 , ("Bell Type", ( 0,100))
54 , ("Bend Range", ( 0,100))
55 , ("Pressure Level", ( 0,100))
56 , ("Bell Height", ( 0,100))
57 , ("Bell Width", ( 0,100))
58 , ("Bell Thickness", ( 0,100))
59 ])
60 , (Single, "WoodDrum",
61 [ ("Wood Type", ( 0,100))
62 , ("Shell Decay", ( 0,100))
63 , ("Shell Pitch", ( 0,100))
64 , ("Shell Level", ( 0,100))
65 , ("Mute Cutoff", ( 0,100))
66 , ("Mute Resonance", ( 0,100))
67 , ("Mute Pitch", ( 0,100))
68 , ("Velocity Curve", ( 0,100))
69 ])
70 , (Single, "Analog",
71 [ ("Filter Cutoff", ( 0,100))
72 , ("Resonance", ( 0,100))
73 , ("Pitch EG Depth", ( 0,100))
74 , ("Filter EG Depth", ( 0,100))
75 , ("Pressure Resonance", (-50, 50))
76 , ("Filter EG Decay", ( 0,100))
77 , ("Mute Depth", ( 0,100))
78 , ("Effects Level", ( 0,100))
79 ])
80 , (Single, "Arimbao",
81 [ ("Tone Pitch", ( 0,100))
82 , ("Tension Balance", ( 0,100))
83 , ("Tone Level", ( 0,100))
84 , ("Drum Type", ( 0,100))
85 , ("Damping", ( 0,100))
86 , ("Bark Level", ( 0,100))
87 , ("Pitch Interval", ( 0,100))
88 , ("Dry Level", ( 0,100))
89 ])
90 , (Single, "Sawari-A",
91 [ ("Buzz Intensity", ( 0,100))
92 , ("L-R Delay", ( 0,100))
93 , ("Drone Pitch", (-50, 50))
94 , ("Drone Decay", ( 0,100))
95 , ("Drone Balance", (-50, 50))
96 , ("Brightness", ( 0,100))
97 , ("Drone Level", ( 0,100))
98 , ("Drum Level", ( 0,100))
99 ])
100 , (Single, "WindDrum",
101 [ ("Fine Tuning", ( 0,100))
102 , ("Scale Select", ( 0, 7))
103 , ("Balance", (-50, 50))
104 , ("Tone Decay", ( 0,100))
105 , ("Interval", ( 0,100))
106 , ("Noise Filter", ( 0,100))
107 , ("Noise Decay", ( 0,100))
108 , ("Noise Color", ( 0,100))
109 ])
110 , (Single, "Triangle",
111 [ ("Brightness", ( 0,100))
112 , ("Pitch 1", ( 0,100))
113 , ("Pitch 2", ( 0,100))
114 , ("Pitch 3", ( 0,100))
115 , ("Metal Type 1", ( 0,100))
116 , ("Metal Type 2", ( 0,100))
117 , ("Metal Type 3", ( 0,100))
118 , ("Metal Type 4", ( 0,100))
119 ])
120 , (Single, "Water",
121 [ ("Pitch Change", ( 0,100))
122 , ("Brightness", ( 0,100))
123 , ("Drum Type 1", ( 0,100))
124 , ("Drum Type 2", ( 0,100))
125 , ("Portamento", ( 0,100))
126 , ("Pressure = Level", ( 0,100))
127 , ("Water Pitch", ( 0,100))
128 , ("Water Strength", ( 0,100))
129 ])
130 , (Single, "BigHand",
131 [ ("Drum Type", ( 0,100))
132 , ("Bass Tone Level", ( 0,100))
133 , ("Slap Level", ( 0,100))
134 , ("Slap Decay", ( 0,100))
135 , ("Slap Color", ( 0,100))
136 , ("Slap Filter", ( 0,100))
137 , ("Slap Resonance", ( 0,100))
138 , ("Threshold", ( 0,100))
139 ])
140 , (Single, "SteelST",
141 [ ("Brightness", ( 0,100))
142 , ("Pressure Pitch", ( 0,100))
143 , ("Pressure Color", ( 0,100))
144 , ("Pressure Range", (-50, 50))
145 , ("Threshold", ( 0,100))
146 , ("Balance", (-50, 50))
147 , ("Wah Depth", ( 0,100))
148 , ("Gauge", ( 0,100))
149 ])
150 , (Single, "Mo'Daiko",
151 [ ("Drum Type", ( 0,100))
152 , ("Pitch EG Depth", ( 0,100))
153 , ("LFO Rate", ( 0,100))
154 , ("LFO Depth", ( 0,100))
155 , ("Damping", ( 0,100))
156 , ("Pressure Pitch", ( 0,100))
157 , ("Resonance Sweep", ( 0,100))
158 , ("Mute Depth", ( 0,100))
159 ])
160 , (Single, "Sawari-B",
161 [ ("Bend Range", ( 0,100))
162 , ("Decay Balance", (-50, 50))
163 , ("Level Balance", (-50, 50))
164 , ("Top Color", ( 0,100))
165 , ("Drone Color", ( 0,100))
166 , ("Buzz Intensity", ( 0,100))
167 , ("Scale Select", ( 0, 7))
168 , ("Bend/Scale Select", ( 0, 1))
169 ])
170 , (Single, "Tabla",
171 [ ("Baya Pitch", ( 0,100))
172 , ("Baya Level", ( 0,100))
173 , ("Baya Decay", ( 0,100))
174 , ("Bend Curve", ( 0,100))
175 , ("Damping", ( 0,100))
176 , ("Shell Pitch", ( 0,100))
177 , ("Shell Damping", ( 0,100))
178 , ("Shell Decay", ( 0,100))
179 ])
180 , (Single, "Gong1",
181 [ ("Gong Color", ( 0,100))
182 , ("LFO Depth", (-50, 50))
183 , ("LFO Rate", ( 0,100))
184 , ("Damping", ( 0,100))
185 , ("Gong Type", ( 0,100))
186 , ("Harmonic Shift", ( 0,100))
187 , ("Thickness", ( 0,100))
188 , ("Model Select", ( 0, 7))
189 ])
190 , (Single, "Wah Harp",
191 [ ("Damping", ( 0,100))
192 , ("Wah Color", ( 0,100))
193 , ("String Character", ( 0,100))
194 , ("Wah Balance", ( 0,100))
195 , ("LoDamp", ( 0,100))
196 , ("Attack Level", ( 0,100))
197 , ("Attack LoDamp", ( 0,100))
198 , ("Bend Range", (-50, 50))
199 ])
200 , (Single, "TalkDrum",
201 [ ("Bend Range", ( 0,100))
202 , ("Brightness 1", ( 0,100))
203 , ("Brightness 2", ( 0,100))
204 , ("Decay Interval", ( 0,100))
205 , ("Tension", ( 0,100))
206 , ("Drum Type", ( 0,100))
207 , ("Attack", ( 0,100))
208 , ("Pressure Filter", ( 0,100))
209 ])
210 , (Single, "Jingle",
211 [ ("Jingle Type", ( 0,100))
212 , ("Jingle Size", (-50, 50))
213 , ("Repeat", ( 0,100))
214 , ("Bell Decay", ( 0,100))
215 , ("Brightness", ( 0,100))
216 , ("Pressure Decay", (-50, 50))
217 , ("Pressure Pitch", (-50, 50))
218 , ("Model Select", ( 0, 2))
219 ])
220 , (Single, "Bonga",
221 [ ("Shell Size", ( 0,100))
222 , ("Shell Damp", ( 0,100))
223 , ("Sub Harmonics", ( 0,100))
224 , ("Brightness", ( 0,100))
225 , ("Drum Size", ( 0,100))
226 , ("Slap Level", ( 0,100))
227 , ("Slap Decay", ( 0,100))
228 , ("Slap Color", ( 0,100))
229 ])
230 , (Single, "Koto",
231 [ ("Fine Tune", (-50, 50))
232 , ("Pluck Position", (-50, 50))
233 , ("Damping", ( 0,100))
234 , ("String Type 1", ( 0,100))
235 , ("String Type 2", ( 0,100))
236 , ("Plucked Noise", ( 0,100))
237 , ("Bottom String", ( 0, 12))
238 , ("String Range", ( 0, 12))
239 ])
240 , (Single, "Bamboo",
241 [ ("Fine Tune", (-50, 50))
242 , ("Accent Level", ( 0,100))
243 , ("Velocity Range", ( 0,100))
244 , ("2nd Pitch", (-50, 50))
245 , ("Pressure Pitch", (-50, 50))
246 , ("Pressure Range", (-50, 50))
247 , ("Scale Select", ( 0, 7))
248 , ("Sequence Type", ( 0, 2))
249 ])
250 , (Single, "JingDrum",
251 [ ("Jingle Level", ( 0,100))
252 , ("Drum Level", ( 0,100))
253 , ("Brightness 1", ( 0,100))
254 , ("Drum Width", ( 0,100))
255 , ("Pressure Decay", (-50, 50))
256 , ("Jingle Pitch", ( 0,100))
257 , ("Jingle Decay", ( 0,100))
258 , ("Brightness 2", ( 0,100))
259 ])
260 , (Single, "Don-Hya",
261 [ ("Seq. Note Volume", ( 0,100))
262 , ("Motif Select", ( 0, 7))
263 , ("Delay Time", ( 0,100))
264 , ("Portamento", ( 0,100))
265 , ("Brightness", ( 0,100))
266 , ("Noise-Color", ( 0,100))
267 , ("Noise-Level", ( 0,100))
268 , ("Pitch Interval", ( 0,100))
269 ])
270 , (Single, "Mariko",
271 [ ("Tone Pitch", ( 0,100))
272 , ("Pitch Response", ( 0,100))
273 , ("Pressure Pitch", ( 0,100))
274 , ("Tone Level", ( 0,100))
275 , ("Resonance Balance", ( 0,100))
276 , ("Brightness", ( 0,100))
277 , ("Drum Type1", ( 0,100))
278 , ("Drum Type2", ( 0,100))
279 ])
280 , (Single, "Upo",
281 [ ("Pitch EG Depth", ( 0,100))
282 , ("Harmonics", ( 0,100))
283 , ("HiDamp", ( 0,100))
284 , ("Filter Level", ( 0,100))
285 , ("Filter Cutoff", ( 0,100))
286 , ("Pop Level", ( 0,100))
287 , ("Pop Pitch", ( 0,100))
288 , ("Pop Random", ( 0,100))
289 ])
290 , (Single, "1812",
291 [ ("Pressure Pitch", ( 0,100))
292 , ("Brightness", ( 0,100))
293 , ("Ensemble Size", ( 0,100))
294 , ("Delay Control", ( 0,100))
295 , ("Snappy Level", ( 0,100))
296 , ("LoDamp", ( 0,100))
297 , ("HiDamp", ( 0,100))
298 , ("Resonance", ( 0,100))
299 ])
300 , (Double, "Conga", type1)
301 , (Double, "Bongo", type1)
302 , (Double, "Snare Drum 1", type2)
303 , (Double, "Snare Drum 2", type2)
304 , (Double, "Snare Drum 3", type2)
305 , (Double, "Timbales", type2)
306 , (Double, "Cajon", type3)
307 , (Double, "Djembe", type3)
308 , (Double, "Bass Drum + Snare Drum 1", type3)
309 , (Double, "Bass Drum + Snare Drum 2", type3)
310 -- only available on Wavedrum Oriental
311 , (Double, "Darbuka", type4) --37
312 , (Double, "Darbuka ensemble", type4) --38
313 , (Double, "Darbuka Turkish", type4) --39
314 , (Double, "Tar", type4) --40
315 , (Double, "Daf", type4) --41
316 , (Double, "Doyra", type4) --42
317 , (Double, "Req", --43
318 [ ("Switching", ( 0,100))
319 , ("PCM Balance", (-50, 50))
320 , ("Alg-PCM Balance", (-50, 50))
321 , ("Drum Width", ( 0,100))
322 , ("Jingle Pitch", ( 0,100))
323 , ("Jingle Decay", ( 0,100))
324 , ("Brightness 2", ( 0,100)) -- sic
325 , ("Sensitivity", ( 0,100))
326 ])
327 , (Double, "Daf Iranian", type6) --44
328 , (Double, "Bendir", type6) --45
329 ]
330 where
331 type1 = [ ("Switching", ( 0,100))
332 , ("PCM Balance", (-50, 50))
333 , ("Alg-PCM Balance", (-50, 50))
334 , ("Sub Harmonics", ( 0,100))
335 , ("Brightness", ( 0,100))
336 , ("Slap Level", ( 0,100))
337 , ("Slap Decay", ( 0,100)) -- manual wrongly says "Delay"
338 , ("Slap Color", ( 0,100))
339 ]
340 type2 = [ ("Switching", ( 0,100))
341 , ("PCM Balance", (-50, 50))
342 , ("Alg-PCM Balance", (-50, 50))
343 , ("Curve", ( 0,100))
344 , ("Brightness", ( 0,100))
345 , ("Snappy Decay", ( 0,100))
346 , ("Snappy Level", ( 0,100))
347 , ("Shell Type", ( 0, 4))
348 ]
349 type3 = [ ("Switching", ( 0,100))
350 , ("PCM Balance", (-50, 50))
351 , ("Alg-PCM Balance", (-50, 50))
352 , ("Curve", ( 0,100))
353 , ("Brightness", ( 0,100))
354 , ("Snappy Decay", ( 0,100))
355 , ("Snappy Level", ( 0,100))
356 , ("Shell Type", ( 0, 4))
357 ]
358 type4 = [ ("Switching", ( 0,100))
359 , ("PCM Balance", (-50, 50))
360 , ("Alg-PCM Balance", (-50, 50))
361 , ("Drum Type", ( 0,100))
362 , ("Slap Level", ( 0,100))
363 , ("Slap Decay", ( 0,100))
364 , ("Slap Color", ( 0,100))
365 , ("Sensitivity", ( 0,100))
366 ]
367 type6 = [ ("Switching", ( 0,100))
368 , ("PCM Balance", (-50, 50))
369 , ("Alg-PCM Balance", (-50, 50))
370 , ("Curve", ( 0,100))
371 , ("Brightness", ( 0,100))
372 , ("Snappy Decay", ( 0,100))
373 , ("Snappy Level", ( 0,100))
374 , ("Sensitivity", ( 0,100))
375 ]
376
377 headInstruments :: [T.Text]
378 headInstruments =
379 [ "Multi Tubb Kick"
380 , "Dance Kicks w/reverse"
381 , "Whistle Kick"
382 , "Tubby Kick /TOM"
383 , "88 Hat/Kick"
384 , "Kick 99"
385 , "BD Ambi"
386 , "BD Dry"
387 , "Kick & Snare"
388 , "Dance Kick & Snare 2"
389 , "Kick, Snare & Hat"
390 , "Dance BD & 99 SD"
391 , "Voice BD/SD/HH"
392 , "Orch SD to Orchestra BD"
393 , "SD to BD"
394 , "Dance BD & SD"
395 , "Velo Ambi Snare"
396 , "Samba Snare"
397 , "Orch Snare w/ Cym"
398 , "Hand Claps"
399 , "Kompton Klaps"
400 , "Multi Powerful Tom"
401 , "Ambi Drum"
402 , "Two Pitched Tom"
403 , "Rock Toms"
404 , "Brushes 3 Toms"
405 , "Low Tom/ velo Forest"
406 , "Tom Vintage Hi"
407 , "Tom Soul"
408 , "Mark Tree Chord w/Thump"
409 , "E.Tom Velo Set"
410 , "Tiki Tiki Tom Tom"
411 , "Epic Hi-Toms Head"
412 , "Low War Tom Rim"
413 , "Guitar and Ghost"
414 , "Steel Drum (F-A-B -C-F)"
415 , "Mouth Harp C Drone"
416 , "Shaker/Kick"
417 , "Shaker to Clave"
418 , "Caxixi"
419 , "Triangle"
420 , "Conga Clap"
421 , "Conga Hi-Close/Open"
422 , "Bassish Lo Conga"
423 , "Conga Lo-Basstone"
424 , "Conga Gliss"
425 , "Low Conga"
426 , "Super Conga"
427 , "Tumba Open"
428 , "Broken Kalimba (Head)"
429 , "Balafon"
430 , "Djembe"
431 , "Dynamic Djembe"
432 , "Djembe Closed Slap"
433 , "Iya Boca Choke"
434 , "Boca Open"
435 , "Iya Chacha UP"
436 , "Iya Boca Open+Slap"
437 , "Itotele Boca Open"
438 , "Okonkolo → Iya (Open)"
439 , "Tom/Iya Drum Corps"
440 , "Itotele/Iya Mix"
441 , "Darbuka Head"
442 , "Paila Lo"
443 , "Paila Hi"
444 , "Lo Hi Timbales"
445 , "Castanet"
446 , "Guiro"
447 , "RecoReco 4 Velo"
448 , "Surdo Open"
449 , "Pandeiro"
450 , "Tambourine"
451 , "Rek Head"
452 , "Rek"
453 , "Udus/ Shaker"
454 , "Gamelan"
455 , "Tabla\"Tele\""
456 , "Japanese Tsuzumi"
457 , "Tsuzumi 2"
458 , "Oodaiko"
459 , "Timpani Lo/Hi"
460 , "Velo Splash Cym"
461 , "New China Cymbal"
462 , "Mini TamTam"
463 , "Bells"
464 , "Jingle"
465 , "Metal tree"
466 , "Fly in Jungle"
467 , "Vinyl Crash"
468 , "Rainy Day Bird"
469 , "Low Bull Roar Loop"
470 , "Synth Stab (Key of C)"
471 , "Industry"
472 , "Industrial BD/SD/HH"
473 , "Industs"
474 , "Industry Hit"
475 , "Shaker & Church Bell"
476 , "Synthy G Melody"
477 , "Velo Vocoder"
478 , "Berimbau Attack"
479 ]
480
481 rimInstruments :: [T.Text]
482 rimInstruments =
483 [ "Multi Pitched BDs"
484 , "2 Tone Dance Kick"
485 , "Kick 99"
486 , "Snare 3 Velo"
487 , "SD Dance"
488 , "Velo 99 SD"
489 , "Hat/Dance Snare"
490 , "Cybernetik SD"
491 , "Orchestra SD"
492 , "Brush Swirls"
493 , "Deep Tom Tom (Key of C)"
494 , "Ambi Rim"
495 , "Dance Clap"
496 , "Hand Claps"
497 , "Kompton Klaps"
498 , "Kick & Snare"
499 , "Dance Kick & Snare 1"
500 , "Dance Kick & Snare 2"
501 , "Epic Lo-Toms Rim"
502 , "War Toms Head"
503 , "Jazz Tom"
504 , "Cowbell"
505 , "Bongoish"
506 , "Hi Bongoish"
507 , "Conga Gliss"
508 , "Low Conga"
509 , "Super Conga"
510 , "Tumba Open"
511 , "Iya Boca Choke"
512 , "Boca Open"
513 , "Iya Chacha UP"
514 , "Broken Kalimba (Rim)"
515 , "Log drum"
516 , "Djembe Closed Slap"
517 , "Agogo/Cuica"
518 , "Agogo"
519 , "Tambourine"
520 , "Paila Lo"
521 , "Paila Hi"
522 , "Timbale Attack"
523 , "Timbales Lo-Paila"
524 , "Lo Hi Timbales"
525 , "Castanet"
526 , "Guiro"
527 , "RecoReco 4 Velo"
528 , "Pandeiro"
529 , "Rek Head"
530 , "Rek"
531 , "Gamelan"
532 , "Steel Drum (Low F)"
533 , "Udu"
534 , "Udus/ Shaker Accent"
535 , "Shaker 1"
536 , "Shaker 2"
537 , "Velo Accent Shaker"
538 , "Shaker/Kick"
539 , "Shaker to Clave"
540 , "Caxixi"
541 , "Rek Rim"
542 , "Multi-Tabla"
543 , "Darbuka Rim"
544 , "Surdo Hand&Rim"
545 , "Gamelan Celesta"
546 , "Taiko Rim"
547 , "Tsuzumi 1"
548 , "Tsuzumi 2"
549 , "Foot Step"
550 , "Short Finger Cymbal"
551 , "Velo Splash Cym"
552 , "New China Cymbal"
553 , "Orchestra Cymbal"
554 , "Deep Orch Crash"
555 , "Chinese Gong"
556 , "Voice HH/Cym"
557 , "Bells"
558 , "Jingle"
559 , "Metal tree"
560 , "Synth Hits"
561 , "PC Voice"
562 , "Rain → Thunder Velo SW"
563 , "Gop Pitch Up"
564 , "Angry Gods RIM"
565 , "Berimbau Attack"
566 , "Timpani w/Orch Hits"
567 , "Code"
568 , "Synth Switch"
569 , "WaveDrum Splat"
570 , "Industry"
571 , "Industs"
572 , "Industrial 1"
573 , "Industrial 2"
574 , "Industrial Cym"
575 , "Industry Hit"
576 , "Bubble"
577 , "Rain Stick"
578 , "Fly in Jungle"
579 , "Vinyl Crash"
580 , "Rainy Day Bird"
581 , "Low Bull Roar Loop"
582 , "Synth Stab (Key of C)"
583 ]