MusicalPack
A delphi musical music lib for render Music Score.
- Active · last change 10-11-2025
- ★ 1 on GitHub
README
🎵 MusicalPack
MusicalPack is a Delphi-based framework for music notation rendering, MIDI score visualization, and symbol layout management. It provides core components and rendering logic for building custom musical applications — from MIDI file playback visualization to music composition tools.
📦 Features
- MIDI File Import — Converts MIDI events (Note On/Off, Tempo, Time Signature) into a structured score format.
- Score & Render Engine — Automatically lays out staves, clefs, measures, notes, and dynamic symbols.
- Layout Components — Custom Delphi controls like
TMusicalStaff,TMusicalNote, andTMusicalClef. - Paging & Measure Alignment — Supports multi-page rendering and consistent layout alignment.
- Symbol Pooling System — Optimizes rendering by reusing symbol instances (for Clefs, Key Signatures, etc.).
- Debug Mode Logging — Tracks symbol creation and reuse behavior for debugging layout mismatches.
🧠 Core Architecture
Structure Overview
MIDI File
??? Import
Events (note on/off, tempo, time sig)
??? Convert
TScore (clefs, staves, measures, notes)
??? Render
Pages with symbol positions
??? Layout
MusicalStaff, MusicalNote, MusicalClef Musical Symbol controls
??? Display
ScoreViewKey Units
| Unit | Description |
|---|---|
MWQ.Midi.Importer |
Handles MIDI-to-score conversion. |
MWQ.Musical.RenderEngine |
Aligns measures, notes, and symbols into pages. |
MWQ.Musical.ScoreView |
Custom visual control for score display. |
MWQ.Musical.Symbol.Pool |
Reuses and tracks symbol instances across render passes. |
⚙️ Development
Prerequisites
- Delphi 11+ (tested with Delphi 12 Athens)
- FMX Framework for graphical rendering
Build Instructions
git clone https://github.com/wqmeng/MusicalPack.git
cd MusicalPack
# Open the project in Delphi IDE
# Build and run the FMX demo application
# Put TScoreView on a form
# Set the MusicFile property 'example.mid' of the TScoreView control.🧩 Debugging
If you notice mismatched symbols (e.g., clef/key signature placeholders differing between background and visible page rendering), enable debug logging:
{$DEFINE DEBUG}The engine will log symbol allocation and class mismatches, helping trace object reuse problems.
🗺️ Roadmap
- [ ] Support multi-voice and chord rendering
- [ ] Add lyric and dynamics layer
- [ ] Improve symbol pooling consistency across layout passes
- [ ] Export to MusicXML / MIDI
📜 License
Creative Commons Attribution-NonCommercial (CC BY-NC 4.0) License © 2025 wqmeng
💬 Contact
For discussions, suggestions, or bug reports, please open an issue on GitHub Issues.

