A drum kit from a recording
By the end of this chapter, ten sounds recorded in one room are a drum kit: play MIDI channel 10, and the kick, the snare and the hi-hats are sounds you made.
The project so far
The folder from A project folder, made by subsample --init, whose configuration differs from Subsample's defaults in one line.
mkdir kitchen-kit
cd kitchen-kit
subsample --init
player:
midi_map: midi-map-gm-drums.yaml
Record ten sounds
Find things in one room that make a short sound when you strike them. A kitchen has plenty, and the sounds of one room sit together as a kit. Between them, cover what a drum kit needs:
- low thuds, such as a hand on a wooden table or a cardboard box, for the kick;
- sharp cracks, such as a pan lid, or a chopping board slapped, for the snare;
- short, bright ticks, such as a bunch of keys or a spoon on a glass, for the hi-hats;
- knocks at a few different pitches, such as pans of different sizes, for the toms.
Record about ten of them in one take, one after another:
- Start with about a second of quiet room. Subsample spends the first second of a recording learning how quiet the room is, and a sound inside that second is missed.
- Let each sound die away to the room, then leave a second of quiet before you make the next, so that each one ends up whole, in a sample of its own.
- Strike one of them three or four times, as alike as you can. A later chapter finds them again as near-duplicates.
- Leave the take as it was recorded, with the loudest sound well short of clipping. Subsample trims and fades each sound itself, and measures what it keeps, so normalising, compression, EQ or fades done first change what it measures.
Anything that records a WAV file will do: a portable recorder, a phone app that saves WAV, or a microphone and whichever program you record with. Save the take as hits.wav, in the project folder.
A recording for this step is planned. Until then, use one of your own.
Cut it into samples
Give Subsample the recording:
Example not checked: it is not run when this site is built.
subsample hits.wav
Given a recording, Subsample reads it rather than listening to a microphone. It finds each sound that rises out of the quiet of the room, cuts it out, trims the quiet either side of it to a short fade, measures it, and saves it as a sample, then exits.
The samples are in samples/captures/, named after the recording in the order the sounds came: hits_1.wav is the first, hits_2.wav the second, and so on. Beside each one is what Subsample measured in it, hits_1.wav.analysis.json, and a picture of it to browse by, hits_1.wav.preview.png.
The last line it prints says how many samples it cut. Fewer than the sounds you made means two ran together, because the second came before the first had died away, or that one was too quiet to rise out of the room, or came in the first second. More means something else was loud enough to count, such as a creak or a car going by. Either way, record the take again, with more quiet between the sounds.
Turn the player on
Playing the samples is the player's job, and the player is off until the configuration turns it on. In config.yaml, change two values:
recorder:
enabled: false
player:
enabled: true
player.enabled turns the player on. recorder.enabled is Subsample listening to a microphone while it runs, which a later chapter sets up, so turn it off for now. Both are in the file already, each under its own section, so change their values rather than adding the lines again: Subsample refuses a section written twice, such as a second player: at the end of the file, and names both its lines.
The player plays through your computer's default audio output, and listens to your MIDI input. With one MIDI device connected, it uses that one; with more than one, it asks which each time it starts. To choose them once, copy names subsample --list-devices printed into the configuration: an output's from under Audio outputs into player.audio.device, and a MIDI input's from under MIDI inputs into player.midi_device. Part of a name will do.
Play it
Start Subsample in the project folder, with no recording named this time:
Example not checked: it is not run when this site is built.
subsample
It loads every sample in samples/captures/, opens your MIDI input and audio output, and waits for notes. Among the lines it prints as it starts, one says how many samples it loaded from samples/captures: as many as your recording gave you. On Linux, pw-jack subsample starts it without the lines saying that a JACK server is not running.
Play MIDI channel 10 from your controller or sequencer. Note 36 is the kick, 38 the snare, 42 the closed hi-hat and 46 the open one. Stop Subsample with Ctrl-C.
How the kit chooses
The kit is the map --init wired in, midi-map-gm-drums.yaml. It covers every drum General MIDI names, from note 35 to note 81, and Subsample carries a reference for each of them: what that drum sounds like, measured in the way Subsample measures your samples. When a note arrives, the map plays the sample of yours that sounds most like its drum. With ten samples and a whole kit of drums, one sample is often the closest you have to several drums, and plays for all of them.
Each drum plays through a mix chain made for it, as a mixing desk would treat that drum in a kit:
- a filter that takes out what the drum does not need, such as the rumble under a kick;
- compression, which adapts to each sample, on the kicks, the snares, the side stick and the clap, the toms, the hi-hats, the hand drums, and the cowbell, the agogos, the claves and the wood blocks, and none on the cymbals, or on the percussion that rattles, scrapes, rings or is blown, such as the tambourine, the guiro, the triangle and the whistles;
- a place across the stereo field, as the kit looks from the audience: the hi-hats on the left, the ride on the right, the toms spread between them, and the kick and snare near the centre;
- a level that pulls the cymbals and the small percussion back, so that no one drum stands out.
More sounds, a better kit
The kit improves as samples arrive. Record another take, cut it in the same way, and start Subsample again: it loads every sample in samples/captures/ as it starts, so each drum chooses from more sounds, and the kick is more likely to be something that thuds.
Give each take a name of its own, such as hits-2.wav. A sample takes its name from the recording, so a second take saved over hits.wav and cut again replaces the first take's samples. A take called hits.wav in another folder keeps them, and its own samples take its folder's name too, such as day2_hits_1.wav. One run can cut several takes, subsample hits-2.wav hits-3.wav, or a whole folder of them, subsample takes/*.wav.
With a kit playing, the next chapter looks at what Subsample heard in each of your sounds, and why it chose the ones it did.