-- maquinitas-tidal
-- parameters for instruments by Korg

module Korg.VolcaBeats where

  import Korg.KorgBase
  import qualified Sound.Tidal.Params
  import Sound.Tidal.Pattern

  -- MIDI notes

  midiNote :: Pattern String -> ControlPattern
  midiNote :: Pattern String -> ControlPattern
midiNote = Pattern Note -> ControlPattern
Sound.Tidal.Params.n forall b c a. (b -> c) -> (a -> b) -> a -> c
. (forall a. Num a => a -> a -> a
subtract Note
60 forall b c a. (b -> c) -> (a -> b) -> a -> c
. forall a. Num a => String -> a
volcaBeatsMidiNote forall (f :: * -> *) a b. Functor f => (a -> b) -> f a -> f b
<$>)

  volcaBeatsMidiNote :: Num a => String -> a
  volcaBeatsMidiNote :: forall a. Num a => String -> a
volcaBeatsMidiNote String
m =
    case String
m of
      String
"bd" -> a
36
      String
"sd" -> a
38
      String
"lt" -> a
43
      String
"ht" -> a
50
      String
"ch" -> a
42
      String
"oh" -> a
46
      String
"cp" -> a
39
      String
"cl" -> a
75
      String
"ag" -> a
67
      String
"cr" -> a
49
      String
_    -> a
0

  -- Korg MR-16 drum machine

  mr16 :: Pattern String -> ControlPattern
  mr16 :: Pattern String -> ControlPattern
mr16 = Pattern Note -> ControlPattern
Sound.Tidal.Params.n forall b c a. (b -> c) -> (a -> b) -> a -> c
. (forall a. Num a => a -> a -> a
subtract Note
60 forall b c a. (b -> c) -> (a -> b) -> a -> c
. forall a. Num a => String -> a
mr16MidiNote forall (f :: * -> *) a b. Functor f => (a -> b) -> f a -> f b
<$>)
  
  mr16MidiNote :: Num a => String -> a
  mr16MidiNote :: forall a. Num a => String -> a
mr16MidiNote String
m =
    case String
m of
      String
"bd" -> a
35 -- bass drum
      String
"rs" -> a
37 -- rimshot
      String
"sd" -> a
38 -- snare drum
      String
"cp" -> a
39 -- clap
      String
"lt" -> a
41 -- low tom
      String
"ch" -> a
42 -- closed hihat
      String
"oh" -> a
46 -- open hihat
      String
"ht" -> a
47 -- high tom
      String
"cr" -> a
49 -- crash
      String
"rd" -> a
51 -- ride
      String
"lc" -> a
52 -- low conga
      String
"hc" -> a
53 -- high conga
      String
"ta" -> a
54 -- tambourine
      String
"cb" -> a
56 -- cow bell
      String
"ti" -> a
57 -- timbale
      String
"ca" -> a
58 -- cabasa
      String
"wb" -> a
60 -- wood block
      String
"la" -> a
61 -- low agogo
      String
"ha" -> a
63 -- high agogo
      String
"mp" -> a
64 -- metronome piano
      String
"mf" -> a
65 -- metronome forte
      String
_    -> a
0  -- no match

  -- ControlChange list

  midiCC :: Pattern String -> ControlPattern
  midiCC :: Pattern String -> ControlPattern
midiCC = Pattern Note -> ControlPattern
Sound.Tidal.Params.n forall b c a. (b -> c) -> (a -> b) -> a -> c
. (forall a. Num a => String -> a
volcaBeatsControlChange forall (f :: * -> *) a b. Functor f => (a -> b) -> f a -> f b
<$>)
  
  volcaBeatsControlChange :: Num a => String -> a
  volcaBeatsControlChange :: forall a. Num a => String -> a
volcaBeatsControlChange String
m =
    case String
m of
      String
"kickLevel"      -> a
40
      String
"snareLevel"  -> a
41
      String
"loTomLevel"  -> a
42
      String
"hiTomLevel"  -> a
43
      String
"clHatLevel"  -> a
44
      String
"opHatLevel"  -> a
45
      String
"clapLevel"   -> a
46
      String
"clavesLevel" -> a
47
      String
"agogoLevel"  -> a
48
      String
"crashLevel"  -> a
49
      String
"clapSpeed"   -> a
50
      String
"clavesSpeed" -> a
51
      String
"agogoSpeed"  -> a
52
      String
"crashSpeed"      -> a
53
      String
"stutterTime"     -> a
54
      String
"stutterDepth"    -> a
55
      String
"tomDecay"        -> a
56
      String
"closedHatDecay"  -> a
57
      String
"openHatDecay"    -> a
58
      String
"hatGrain"        -> a
59
      String
_ -> a
0