How promethiuml/justchord works
Project Type and Purpose
• This is a single‐process, desktop GUI application written in Python.
• Purpose: Real-time MIDI chord recognition and visualization. Uses RtMidi for MIDI I/O and PyQt5 for GUI widgets.
File Structure
Top-level:
• main.py – application entry point
• requirements.txt – external dependencies (python-rtmidi, PyQt5)
• assets/ – font files, images
• JustChord/ – application package
– core/ – pure-logic layer (chord detection, harmony calculations, constants, utilities)
– gui/ – PyQt5 widget layer (app launch, windows, widgets, config viewer)
README for Additional Insights
• Core features: chord recognition, auto-key detection, customizable chord dictionary in core/constants.py.
• GUI: multiple draggable widgets (staff, chords, wheel, keyboard).
• External libs: RtMidi, PyQt5.
a. Main Components
1. MIDI Input Layer
– RtMidi driver (external library)
– MIDI event queue
2. Core Processing Layer
– ChordRecognizer (core/chord.py)
– HarmonyCalculator (core/some_harmony_calculator.py)
– Constants & Config (core/constants.py)
– Utilities (core/utils.py)
3. GUI Layer (PyQt5)
– App bootstrap (gui/app.py)
– Windows & Widgets:
• ChordWindow
• StaffWindow
• WheelWindow
• KeyboardWidget
• Monitor
• ConfigViewer
4. Assets & Resources
– Fonts/images under assets/
5. Entry Point
– main.py orchestrates setup of MIDI, core, and GUI
b. Relationships & Data Flow
– User or MIDI device → RtMidi → MIDI events → CoreProcessing
– CoreProcessing → Event signals (PyQt) → GUI Widgets update visuals
– GUI events (drag, right-click, wheel scroll) → ConfigViewer/CoreConstants updates
– Assets loaded by GUI for rendering fonts/images
c. Architectural Patterns & Principles
– Layered architecture: separate MIDI I/O, core logic, and GUI
– Observer/publish-subscribe via PyQt signals for event propagation
– Single responsibility: each widget handles one visualization
d. Key Technologies/Frameworks
– Python 3.6+
– python-rtmidi (RtMidi bindings)
– PyQt5 (Qt Widgets, Signals & Slots)
Essential Elements
• Labels on each component (e.g., “ChordRecognizer”)
• Arrowheads indicating flow direction
• External dependencies (PyQt5, RtMidi) at the edge