Transcribe a Drum Track¶
This is the core DrumScript pipeline: give it an audio file and it generates PDF sheet music.
ds.transcribe() runs the full end-to-end pipeline:
Load & normalise the audio (peak normalisation to [-1, 1]).
Detect tempo using spectral onset envelope analysis.
Detect onsets — the exact timestamps where drum hits occur.
Classify each hit using DrumScript’s deterministic, physics-based engine (fundamental frequency, spectral centroid, decay time, and energy ratios).
Build & export a PDF score with dual-voice notation (cymbals stems-up, drums stems-down).
Drum-only audio vs. full songs¶
By default, ds.transcribe() expects an isolated drum stem — i.e. audio that contains drums only, with no bass, vocals, or other instruments.
For an isolated drum stem, call
ds.transcribe(path)directly. (This is the default.)For a full polyphonic mix, pass
full_song=Trueand DrumScript will isolate the drums first via Demucs, then transcribe.
Both cases are demonstrated below.
(Note: We are using copyright-free synthetic tracks for these demonstrations.)
1. Transcribing an isolated drum stem (default)¶
Use this path when your input is already drum-only — for example, a stem exported from a DAW, or a drum recording captured in isolation.
No special flags are needed: just call ds.transcribe(path).
from IPython.display import Audio, display
import drumscript as ds
# Load drum-only audio
drum_only_path = "audio/test.wav"
drum_only_audio = ds.load_audio(drum_only_path)
print("Drum-only audio loaded!")
display(Audio(drum_only_path))
Drum-only audio loaded!