Recording well
By the end of this chapter, Subsample is recording live from a microphone in your room, set for that room: a long ring kept whole, and nothing saved when nothing happened.
The project so far
The project from How Subsample hears a sound: the folder subsample --init made, the player on and the recorder off, the samples cut from your recording, and the attack counted for more. If you gave the kick a reference of your own there, keep it.
mkdir kitchen-kit
cd kitchen-kit
subsample --init
recorder:
enabled: false
player:
midi_map: midi-map-gm-drums.yaml
enabled: true
similarity:
weight_timbre_onset: 2
Listening live
Until now Subsample has cut recordings you made with something else. It can listen to a microphone itself, and save each sound as it happens. Turn the recorder back on, in config.yaml:
recorder:
enabled: true
Then start it, with no recording named:
Example not checked: it is not run when this site is built.
subsample
Subsample opens the microphone, and says Calibrating ambient noise for 1s…: for that first second it listens to the room, so keep still and quiet. From then on, each sound that rises out of the room is cut, measured and saved in samples/captures/, named for the moment it ended, such as 2026-10-05_09-12-44-120.wav, and joins the kit as it arrives. Stop it with Ctrl-C: a sound it was still recording is cut where it stopped, and saved.
With the player on too, whatever your speakers play, the microphone hears, and Subsample saves that as well. Listen on headphones to keep the kit out of the recordings.
Which microphone
With one audio input, Subsample uses it. With more, it asks which each time it starts; to choose once, put a name from under Audio inputs in subsample --list-devices in recorder.audio.device. Part of a name will do.
On Linux, a name can carry a number that moves. An interface called USB Audio (hw:2,0) today can be hw:0,0 tomorrow, if another device was found first, and a name written with the old number stops matching. * stands for any run of characters, so write a star where the number moves and keep the one that does not:
recorder:
audio:
device: "USB Audio (hw:*,0)"
With PipeWire, subsample --list-devices also lists a name PipeWire builds from the device itself, its make, its model and its serial number, beginning alsa_input.usb-, with no number that moves at all. Where your system has one, it is the steadiest name to use.
Set for the room
Subsample does not listen for a fixed loudness. It follows how loud the room is, and records a sound that rises far enough above it: detection.threshold_db says how far, in dB. In a noisy room, with a fridge or traffic, raise it; in a very quiet one, keep it above the room's own wobble, or the air alone can start a recording.
A long ring kept whole
A recording ends when the sound falls back to the threshold it rose past. A short hit is over by then, but something that rings, a bowl or a pan lid, is cut off while it can still be heard.
Record one strike of something that rings for several seconds, and keep recording until it is silent. Save it as ring.wav.
A recording for this step is planned. Until then, use one of your own.
Cut it as you cut your hits:
Example not checked: it is not run when this site is built.
subsample ring.wav
Its sample ends before the ring does. Give the end a lower threshold of its own, and the ring is kept whole:
detection:
release_threshold_db: 4
retrigger_threshold_db: 15
detection.release_threshold_db is how close to the room a sound must fall before its recording ends. detection.retrigger_threshold_db lets the next hit end it sooner: a sound that rises that far above the ring still sounding starts a sample of its own. Copy ring.wav to ring-2.wav and cut that, so its sample does not write over the first, and compare the two: the second rings out.
Nothing from nothing
Every threshold here is relative to the room, so in a very quiet room, a small rise in the room's own noise can pass for a sound, and Subsample saves a sample holding nothing. A floor in absolute terms throws those away:
detection:
min_peak_db: -45
detection.min_peak_db drops any recording whose loudest moment is below it, in dBFS. Set it below the peak of the quietest sound you want to keep: too high, and real sounds are lost without a word.
With the kit recording and playing, the next chapter writes a map of your own, choosing the sound each note plays.