# van0fon/lc2msxmml architecture

> Architecture diagram of the GitHub repository van0fon/lc2msxmml, generated by GitDiagram from its file tree, README and a sample of source files (last updated 2025-03-31). It is an AI-made overview: check details against the source.

- Interactive diagram: https://gitdiagram.com/van0fon/lc2msxmml
- Repository: https://github.com/van0fon/lc2msxmml

## Overview

##### Project Overview and Type
- The project is a conversion tool written in Python. Its purpose is to convert LovelyComposer JSONL files into MSX Basic MML (music macro language) files. It supports both a command-line interface (CLI) and a GUI front-end.

##### Analyzing the File Structure
- At the top level, you have scripts and utility modules:
– File: lc2msxmml.py – this is your main driver script.
– Directory: lcutils – containing modules such as msxmml.py (which encapsulates much of the conversion logic) and an __init__.py file.
- Other files such as .gitignore, LICENSES, and README are supporting documents for version control, licensing, and user instructions.
- This tells you that the primary conversion functionality is modularized; the main script calls functions from lcutils, especially the msxmml module.

##### Main Components
a. Input Handler:
– Represents the part of the system that receives and processes input files. You might show the command-line parameters and file input (the LovelyComposer JSONL file) coming into the system.
b. CLI / GUI Interface:
– Since the tool can be run from the command prompt or invoked with a graphical interface (by simply executing lc2msxmml.py), include a node for the interface layer that handles user interactions (e.g., command options like --start, --step, etc.).
c. Conversion Engine:
d. Configuration & Utility Module:
– Highlight that configuration parameters (such as tempo, note length, etc.) are passed to the conversion engine. This might be handled internally by methods like the ‘configure’ method mentioned in the README.
e. Output Generator:
– Show the generation and writing of the output file (the .bas file that contains the converted MSX MML output).
f. Optional: External Binary:
– Indicate that there’s a Windows executable version available. You might simply treat this as another “interface” to the same underlying engine.

##### Describing Relationships & Data Flow
- From the Input Parser, show the data flowing into the Conversion Engine.

##### Architectural Patterns & Design Principles
- Modularity: The separation between the main driver (lc2msxmml.py) and the conversion logic in the lcutils module.

## Diagram (Mermaid)

```mermaid
flowchart TD
    subgraph "User Input"
        A["User CLI/GUI"]
        B["Input File (LovelyComposer JSONL)"]
        C["Input Handler"]
    end

    subgraph "Processing Engine"
        D["Conversion Engine (lcutils/msxmml.py)"]
        E["Configuration & Utility Module"]
    end

    subgraph "Output Generation"
        F["Output Generator (.bas File Output)"]
    end

    A -->|"provides"| C
    B -->|"contents"| C
    C -->|"parsed_data"| D
    D -->|"applies_config"| E
    D -->|"converts_data"| F
    F -->|"feedback"| A

    click A "https://github.com/van0fon/lc2msxmml/blob/main/lc2msxmml.py"
    click C "https://github.com/van0fon/lc2msxmml/blob/main/lc2msxmml.py"
    click D "https://github.com/van0fon/lc2msxmml/blob/main/lcutils/msxmml.py"
    click E "https://github.com/van0fon/lc2msxmml/blob/main/lcutils/__init__.py"

    classDef interface fill:#85C1E9,stroke:#1F618D,stroke-width:2px;
    classDef io fill:#FAD7A0,stroke:#E67E22,stroke-width:2px;
    classDef processing fill:#ABEBC6,stroke:#27AE60,stroke-width:2px;
    classDef config fill:#F9E79F,stroke:#F1C40F,stroke-width:2px;

    class A,C interface;
    class B,F io;
    class D processing;
    class E config;
```
