Sign in Join

Live chat for Free Pascal, Lazarus, Delphi and every Pascal programmer.

Catalog · How the catalog works
Anything · Lazarus or Delphi
Random projectRandom project

MusicalPack

A delphi musical music lib for render Music Score.

View on GitHub

Member rating

No ratings yet.

Sign in to rate this project.

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, and TMusicalClef.
  • 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

pascal
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
ScoreView

Key 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

bash
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:

pascal
{$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.