drumscript.notation_generator.score_builder.build_score#
- build_score(detected_events: list[dict[str, Any]], tempo: float, output_path: str = 'outputs/score.pdf', quantization_subdivision: int = 16, time_signature: str = '4/4', midi_only: bool = False)[source]#
Builds a drum score by saving event data to JSON and rendering to PDF. # Builds a drum score by saving the event data to JSON and then # rendering it directly to PDF using the custom engine. # This bypasses MusicXML entirely to ensure WYSIWYG (What You See Is What You Get) results. # Builds a drum score PDF, respecting the provided Time Signature, or assuming default 4/4 if not provided
- Parameters:
detected_events (List[Dict[str, Any]]) – List of classified drum events.
tempo (int) – Tempo in BPM.
output_path (str, optional) – Path to save the PDF.
quantization_subdivision (int, optional, must be non-zero) – Grid for quantization (e.g., 1/n where n is the subdivision, 16 for 1/16th notes).
time_signature (str, optional) – Time signature string (e.g., “4/4”), default if time_sig is unspecified
midi_only (bool, optional) – If True, write the MIDI file and skip the JSON and PDF exports. The events are still quantised exactly as normal, so the MIDI is identical to the one a full run would produce. Only the other two writes are suppressed.
- Returns:
Mapping of the files that were successfully written, with keys
pdf_path,json_pathandmidi_path. A key is absent if that export failed, so callers can report only files that actually exist.- Return type:
dict[str, str]