Your first MIDI map
By the end of this chapter, a map of your own chooses the sound each note plays: one sound by its name, one by how much it sounds like a drum, and one by a rule, and you change it while it plays.
The project so far
The project from Recording well: the folder subsample --init made, recording and playing, with the attack counted for more and the room's thresholds set. If you named your microphone, or gave the kick a reference of your own, keep those.
mkdir kitchen-kit
cd kitchen-kit
subsample --init
recorder:
enabled: true
player:
midi_map: midi-map-gm-drums.yaml
enabled: true
similarity:
weight_timbre_onset: 2
detection:
release_threshold_db: 4
retrigger_threshold_db: 15
min_peak_db: -45
A map of your own
The kit you have been playing chooses every General MIDI drum by itself. A map of your own says what each note plays. --init made one to start from, midi-map.yaml: a drum kit and a keyboard that play as they are, below examples written as comments. Point the player at it, and have Subsample watch it for changes:
player:
midi_map: midi-map.yaml
watch_midi_map: true
player.midi_map names the map, and player.watch_midi_map reloads it whenever you save it.
Start with one sound. Replace everything in midi-map.yaml with this:
assignments:
- name: My kick
channel: 10
notes: 36
select:
where:
name: hits_1
A map is a list of assignments, and an assignment says which notes it answers to, on which MIDI channel, and how it chooses a sample for them. This one answers to note 36 on MIDI channel 10 and always plays hits_1, the first sound your take gave you: name is a sample's file name, without its folder or its extension.
Start Subsample and play note 36 on MIDI channel 10: you hear that one sound, whatever else is in the library.
Notes and MIDI channels
notes takes a note's number or its name, where C4 is note 60, a range such as 36..51, or a list such as [36, 38]. The General MIDI drums have names of their own, such as drum.kick_1, drum.snare_1 and drum.hi_hat_closed, which the kit you have been playing is written in. channel is the MIDI channel, from 1 to 16.
Choosing by likeness
Naming a sample fixes the sound. More often you want a snare, whichever of your sounds is most like one. Add a second assignment, below the first:
- name: My snare
channel: 10
notes: drum.snare_1
select:
where:
reference: GM38_AcousticSnare
With a reference and no ranking of its own, the sample most like the reference plays: the first under GM38_AcousticSnare when you run subsample similar. Record a sound more like a snare, and it takes over.
A recording for this step is planned. Until then, use one of your own.
Choosing by rule
The third way says which samples qualify, how to rank them, and which of the ranked to play. For the closed hi-hat, take the short sounds, loudest first:
- name: My hi-hat
channel: 10
notes: drum.hi_hat_closed
select:
where:
duration: { lte: 0.5 }
order: [{ by: level, dir: desc }]
where keeps the samples half a second long or shorter, and order ranks them by level, loudest first. With nothing more, the first of them plays.
A drum sounds different struck softly, and pick can follow how hard you play. Change the hi-hat to this:
- name: My hi-hat
channel: 10
notes: drum.hi_hat_closed
select:
where:
duration: { lte: 0.5 }
order: [{ by: level, dir: desc }]
pick: velocity
Now a soft note plays from the quiet end of the ranking, and a hard one from the loud end, so the hi-hat's sound follows your hand. pick can also draw a different sample at random on every note, from a range of ranks, which the reference describes.
Change it while it plays
Because the player watches midi-map.yaml, saving it changes what the next note plays, with no restart. Try it as you play: change the kick's hits_1 to another of your samples, and save. A map that fails to load is reported, and the one already loaded keeps playing.
Every file the map is read from is watched, not only the one player.midi_map names: a definitions file it mounts, as in A kit of your own, and the maps it plays, as in Several kits at once, and switching live, reload it too. So does an edit made from another machine to a map on a network drive: such an edit gives no notice of itself, so Subsample checks a file there for changes every two seconds.
With your own notes playing your own choices, the next chapter shapes each sound on its way out: a filter, compression, and a knob on your controller to turn.