API Reference

This is the auto-generated API reference for DrumScript.

The examples below can also be used as:

import drumscript as ds
ds.transcribe()
ds.extract_drum_stem()
ds.extract_stems()
ds.detect_tempo()

Configuration & Constants

DrumScript uses a set of global constants to ensure audio processing consistency. These are not hidden magic numbers; they are exposed here for transparency.

drumscript.notation_generator.constants

This script defines ALL parameters used throughout modules in DrumScript

Core Functions

drumscript.transcribe

Run the full DrumScript transcription pipeline end-to-end.

drumscript.extract_stems

Extracts drum stems and optionally separates the full track into constituent parts.

drumscript.detect_tempo

Estimates the global tempo (BPM) of a given audio file or pre-loaded audio array.

drumscript.export_pdf

Exports a generated DrumScript score object to a beautifully rendered PDF file.

drumscript.export_midi

Converts a DrumScript score object into a standard MIDI file for DAW integration.

drumscript.export_xml

Exports a DrumScript score object to MusicXML format.

Audio Processing

drumscript.audio_processor.audio_loader

This module handles loading and basic normalisation of audio files.

drumscript.audio_processor.stem_splitter

This module uses the demucs library () to extract stems from multi-layer audio files.

drumscript.audio_processor.stem_splitter.extract_drum_stem(...)

Legacy wrapper for the transcription pipeline.

drumscript.audio_processor.stem_splitter.mix_stems(...)

Uses soundfile + numpy so the WAV output path is ffmpeg-free.

drumscript.audio_processor.stem_splitter.separate_audio(...)

Separates a full audio track using Demucs and processes the outputs based on user-input args (optional)

drumscript.audio_processor.tempo_detector

This module contains functions for automatic tempo detection from audio data.

drumscript.audio_processor.onset_detector

This module will detect the onset (start) times of drum hits in the audio.

drumscript.audio_processor.feature_extractor

This module will extract relevant features from audio segments for drum classification.

Classification

drumscript.drum_classifier.classify

This script determines the classification rules by which the parameters in py are applied to audio_file_path.

drumscript.drum_classifier.classify.classify_rudiment_events(...)

Dedicated classification engine for single beats, paradiddles, and rudiments.

drumscript.drum_classifier.classify.classify_event(physics)

Stage 1: Evaluates both skins and Metals simultaneously.

drumscript.drum_classifier.classify.classify_events(...)

Wrapper to route validated onsets through the Physics-First Classification Engine.

drumscript.drum_classifier.classify.classify_idiophone(p)

Stage 2B: Sorts Metals (Hats, Cymbals).

drumscript.drum_classifier.classify.classify_membranophone(p)

Stage 2A: Sorts skins (kick, snare, toms).

drumscript.drum_classifier.classify.extract_features(...)

Analyses the audio slice and extracts the physical DSP features.

drumscript.drum_classifier.classify.get_audio_slice(...)

Cuts a specific millisecond slice of audio starting exactly at the onset time.

Score Builders

drumscript.notation_generator.constants

This script defines ALL parameters used throughout modules in DrumScript

drumscript.notation_generator.helpers

Helper functions for musical calculations.

drumscript.notation_generator.score_builder

Module to build the final score from classified events.

drumscript.notation_generator.pdf_exporter

Module for rendering the drum score to PDF using ReportLab.

drumscript.notation_generator.midi_exporter

This module takes classified drum events and renders them into a standard MIDI file.

drumscript.notation_generator.xml_exporter

Module for rendering the drum score to MusicXML format.

Utilities