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:

  1. Load & normalise the audio (peak normalisation to [-1, 1]).

  2. Detect tempo using spectral onset envelope analysis.

  3. Detect onsets — the exact timestamps where drum hits occur.

  4. Classify each hit using DrumScript’s deterministic, physics-based engine (fundamental frequency, spectral centroid, decay time, and energy ratios).

  5. Build & export a PDF score with dual-voice notation (cymbals stems-up, drums stems-down).

For best results, pass an isolated drum stem rather than a full mix. If you have a full song, use ds.transcribe(path, full_song=True) to automatically separate the drums first via Demucs.

(Note: We are using a copyright-free synthetic track for this demonstration.)


from IPython.display import Audio, display

import drumscript as ds

# Load audio
audio_file_path = "audio/test_track_1.wav"
audio_file = ds.load_audio(audio_file_path)
print("Audio loaded!")
display(Audio(audio_file_path))
Audio loaded!
# 1. Basic transcription
# This outputs XML and PDF files by default
basic_transcription = ds.transcribe(audio_path=audio_file_path, output_dir="transcription", full_song=True, full=True)

print("Transcription complete. Files generated:", basic_transcription)
...Separating drum stem...
Starting Demucs separation for: audio/test_track_1.wav...

Example output

Please note: If no output path is specified when running ds.transcribe() the default save location is the outputs/ directory.

alt text