drumscript.export_midi

export_midi(score, output_path=None, **kwargs)[source]

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

The exported MIDI file adheres to the General MIDI (GM) Level 1 Percussion Key Map, ensuring immediate compatibility with virtual drum instruments like Superior Drummer, EZdrummer, or standard DAW drum racks.

Parameters:
  • score (object) – The internal score object generated by build_score().

  • output_path (str, optional) – The exact file path to save the MIDI. Defaults to ‘drumscript.mid’ in CWD.

Returns:

The absolute path to the generated MIDI file.

Return type:

str

Example:

import drumscript as ds

# Assuming `score` is a previously generated score object
midi_path = ds.export_midi(score, output_path="./midi_exports/my_song.mid")