Skip to content

Instantly share code, notes, and snippets.

@ohac
Last active September 2, 2017 13:51
Show Gist options
  • Select an option

  • Save ohac/eeff6c92e23eacca851de482f007c48b to your computer and use it in GitHub Desktop.

Select an option

Save ohac/eeff6c92e23eacca851de482f007c48b to your computer and use it in GitHub Desktop.
mididings patch for KORG nanoPAD2
#!/usr/bin/mididings -f
from mididings import *
config(
out_ports = ['GM1', 'GM2'],
)
def kf(sd, drumkit):
s, d = sd
d2 = drumkit[d]
if type(s) == int:
s = [s]
return KeyFilter(notes=s) >> Key(d2)
gm = {
'Bass2': 35,
'Bass': 36,
'Side': 37,
'Snare': 38, 'BrushTap': 38,
'Clap': 39, 'BrushSlap': 39,
'Snare2': 40, 'BrushSwirl': 40,
'TomL': 41,
'HHC': 42,
'TomL2': 43,
'HHP': 44,
'TomM': 45,
'HHO': 46,
'TomM2': 47,
'TomH2': 48,
'Crash': 49,
'TomH': 50,
'Ride': 51,
'Chinese': 52,
'Ride2': 53,
'Tambourine': 54,
'Splash': 55,
'Cowbell': 56,
'Crash2': 57,
'Vibraslap': 58,
'Ride3': 59,
'BongoH': 60,
'BongoL': 61,
'CongaHM': 62,
'CongaHO': 63,
'CongaL': 64,
'TimbaleH': 65,
'TimbaleL': 66,
'AgogoH': 67,
'AgogoL': 68,
'Cabasa': 69,
'Maracas': 70,
'WhistleA': 71,
'WhistleL': 72,
'GuiroS': 73,
'GuiroL': 74,
'Claves': 75,
'WoodH': 76,
'WoodL': 77,
'CuicaM': 78,
'CuicaO': 79,
'TriangleM': 80,
'TriangleO': 81,
'Shaker': 82,
}
theblackpearl = {
'Bass': 36,
'Side': 37, # Side Stick
'Snare': 38,
'Clap': 39,
'Rim': 40,
'TomL': 41,
'HHC': 42,
'TomL2': 43,
'HHP': 44,
'TomM': 45,
'HHOS': 46, # Swish
'Cowbell': 47,
'Ride': 48,
'Crash': 49,
'Crash2': 50, # Flink
'Splash': 51,
'HHChoke': 52,
'Ride2': 53, # Bell
'Ride3': 54, # Flink
'SplashC': 55, # Choke
'HHSO': 56, # Semi Open
'HHO': 57,
}
ddmfolk = {
'Bass': 36,
'Side': 37,
'Snare': 38,
'Snare2': 40,
'TomL': 41,
'HHC': 42,
'TomL2': 43,
'HHP': 44,
'TomM': 45,
'HHO': 46,
'TomH2': 48,
'Crash': 49,
'Ride': 51,
'Crash2': 57,
'Tambourine': 54, # Soft
'TambourineH': 55, # Hard
'Shaker': 82, # Shake
'ShakerH': 83, # Hit
}
drums1 = [
kf(sd, gm) for sd in [
# SCENE 1 Hand
[36, 'Snare2'], [37, 'Crash'],
[38, 'Snare'], [39, 'TomH'],
[40, 'Snare'], [41, 'TomM'],
[42, 'TomL'], [43, 'Ride'],
[44, 'HHC'], [45, 'HHO'],
[46, 'Side'], [47, 'Ride2'],
# SCENE 2 Foot
[[52,53,54,55,56,57,58,59], 'Bass'],
[[60,61,62,63,64,65,66,67], 'HHP'],
]
] >> Output('GM1', 1, 1)
drums2 = [
kf(sd, gm) for sd in [
# SCENE 1 Hand
[48, 'Splash'], [49, 'Crash'],
[50, 'Ride'], [51, 'Ride2'],
]
] >> Output('GM2', 1, 1)
drums3 = [
kf(sd, ddmfolk) for sd in [
# SCENE 1 Hand
[36, 'Snare2'], [37, 'Crash'],
[38, 'Snare'], [39, 'TomM'],
[40, 'Snare'], [41, 'TomL2'],
[42, 'TomL'], [43, 'Ride'],
[44, 'HHC'], [45, 'HHO'],
[46, 'Side'], [47, 'Crash2'],
[48, 'Tambourine'], [49, 'TambourineH'],
[50, 'Shaker'], [51, 'ShakerH'],
# SCENE 2 Foot
[[52,53,54,55,56,57,58,59], 'HHP'],
[[60,61,62,63,64,65,66,67], 'Bass'],
]
] >> Output('GM1', 1, 1)
pre = Print('input', portnames='in') >> ~Filter(PROGRAM) >> Velocity(curve=-2.5)
post = Print('output', portnames='out')
control = Filter(PROGRAM) >> SceneSwitch()
scenes = {
1: Scene("Drums1", drums3),
2: Scene("Drums2", drums1 // drums2),
3: Scene("Drums3", drums1),
}
run(
control=control,
pre=pre,
post=post,
scenes=scenes,
)
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment