How rhythmicdias/korg-ek50-live-flow works
Purpose and launch
Korg EK50 Live Flow is a desktop Python companion for a USB-connected Korg EK-50. It receives live MIDI, controls keyboard parts, adds arpeggiation, recognizes chords, visualizes performance state, and captures playable MIDI for DAWs. The application starts at src/main.py, with its primary desktop UI in src/ui/main_window.py.
Application orchestration and UI
src/main.py assembles the MIDI, storage, and UI subsystems and owns application lifecycle. src/ui/main_window.py is the live-control surface for mixer/idea-generation and feature control. src/ui/visualizer.py supplies the separate large chord-display surface, consuming analyzed chord state rather than raw device interaction.
MIDI device boundary
src/midi/connection.py encapsulates physical MIDI port discovery, input/output connection, and message transport to/from the EK-50. This is the principal hardware boundary: upstream events enter from USB MIDI, while transformed notes and control changes leave for the keyboard. Device-specific controller/part mappings are centralized in src/midi/ek50_map.py.
Event processing pipeline
Incoming MIDI messages are normalized and classified by src/midi/messages.py, then fan out to live features. src/midi/chord_analyzer.py maintains currently held notes and derives chord names for the UI. src/midi/arpeggiator.py transforms playing into timed, multi-octave note sequences and sends resulting events back through the MIDI connection. The application must coordinate note lifecycle carefully so generated notes, passthrough notes, and note-offs remain consistent.
Recording and DAW export
src/midi/recorder.py captures relevant performance events while excluding unwanted system traffic. Recorded material is persisted as standard MIDI files under captured_midi/. src/storage/daw_export.py defines the export boundary for DAW-oriented output, separating performance capture from downstream file formatting/export behavior.
Persistent musical data and presets
src/storage/presets.py manages saved performance/preset state in saved_presets/. src/storage/database.py provides the storage access layer for bundled or persisted musical metadata. Sound and style catalogs are packaged as src/storage/sounds.json and src/storage/styles.json; these support sound/style selection and idea-generation rather than requiring a remote service.
Runtime and external dependencies
The runtime is Python 3.9+ on macOS or Windows, launched directly with python src/main.py; dependencies are declared in requirements.txt. The only material external integration described is local USB MIDI with the Korg EK-50 and filesystem-based MIDI/preset storage. No server, cloud service, or web application boundary is indicated.
Main entry points: main_window.py Live control UI · connection.py MIDI connection · main.py Application lifecycle · messages.py Message normalization
Components 18
Desktop application
- Application lifecycle · Assembles subsystems and owns desktop lifecycle.
src/main.py - Live control UI · Mixer, idea-generation, and feature controls.
src/ui/main_window.py - Chord visualizer · Large display driven by analyzed chord state.
src/ui/visualizer.py
MIDI pipeline
- MIDI connection · Discovers ports and transports MIDI messages.
src/midi/connection.py - EK-50 mappings · Central controller and part mappings.
src/midi/ek50_map.py - Message normalization · Normalizes and classifies incoming MIDI.
src/midi/messages.py - Chord analyzer · Tracks held notes and derives chord names.
src/midi/chord_analyzer.py - Arpeggiator · Generates timed multi-octave note sequences.
src/midi/arpeggiator.py - Performance recorder · Captures playable events and filters system traffic.
src/midi/recorder.py
Local storage
- DAW export · Separates capture from MIDI formatting and export.
src/storage/daw_export.py - Captured MIDI files
captured_midi - Preset manager · Manages saved performance and preset state.
src/storage/presets.py - Saved presets
saved_presets - Musical metadata · Access layer for bundled or persisted metadata.
src/storage/database.py - Sound catalog
src/storage/sounds.json - Style catalog
src/storage/styles.json
EK-50 device
- USB MIDI · Local connection to the Korg EK-50.
- Korg EK-50
Connections 22
- Application lifecycle → MIDI connection: initializes
- Application lifecycle → Live control UI: launches
- Application lifecycle → Preset manager: loads state
- Application lifecycle → Musical metadata: uses
- USB MIDI → Korg EK-50: connects
- USB MIDI → MIDI connection: MIDI input/output
- MIDI connection → Message normalization: incoming messages
- EK-50 mappings → MIDI connection: device mappings
- Message normalization → Chord analyzer: note state
- Message normalization → Arpeggiator: play events
- Message normalization → Performance recorder: performance events
- Chord analyzer → Chord visualizer: chord state
- Chord analyzer → Live control UI: chord state
- Live control UI → Arpeggiator: feature control
- Arpeggiator → MIDI connection: generated notes
- Performance recorder → DAW export: recorded events
- DAW export → Captured MIDI files: writes MIDI files
- Preset manager → Saved presets: reads and writes
- Musical metadata → Sound catalog: loads
- Musical metadata → Style catalog: loads
- Sound catalog → Live control UI: sound selection
- Style catalog → Live control UI: style and ideas