The Problem

Musicians and hobbyists often need a local tool that turns lyrics and a chosen style into a finished track without relying on cloud services or expensive hardware. They also want to tweak the generated audio, add stems, and edit sections offline. This repo provides a self‑contained workflow that runs entirely on a user’s machine, delivering a browser‑based studio that uses the YuE2 audio engine.

What This Does

The project exposes a web UI (studio/static/index.html) that talks to a Flask server (studio/app.py).

  • studio/app.py registers endpoints for generating music, downloading models, and editing audio.
  • studio/engine.py orchestrates the YuE2 engine, calling studio/yue2.py for generation and studio/yue2_edit.py for post‑processing.
  • studio/models.py manages the catalog of available models (config/model-catalog.json).
  • studio/separate.py implements stem separation, delegating to the audio.cpp binary via studio/audio.py.
  • studio/cli.py offers a command‑line wrapper that starts the server or runs the engine directly (./studio.sh uses this).

The UI is bundled in studio/static, with app.js handling the REST calls and lux.js providing styling helpers.

How It Is Wired

Entry Point – studio/app.py is imported by the studio.sh bootstrap script, which first runs scripts/setup.sh.

  1. setup.sh installs Python via uv, resolves dependencies from pyproject.toml, and builds the audio engine (audio.cpp).
  2. Once dependencies are ready, studio/app.py creates a Flask app and registers routes.
  3. A request to /generate triggers engine.generate() in studio/engine.py.
  4. engine.generate() loads the chosen model from config/model-catalog.json, calls yue2.generate(), and returns a WAV file.
  5. The UI fetches this file and streams it to the browser.

The hub of the system is engine.generate(): it is the single function that all generation flows pass through. A change here affects model selection, audio buffer handling, and error reporting. The cycle between engine.generate() and audio.py ensures that audio rendering and post‑processing remain decoupled but tightly coordinated.

How To Use It

  1. Setup – Clone the repo: ``bash git clone https://github.com/moses-y/lux-in-music ` Navigate into the folder and run the bootstrap script: `bash ./studio.sh ` This installs Python, compiles the audio engine, and starts the Flask server on http://127.0.0.1:8000`.
  1. Configuration – Models are listed in config/model-catalog.json. To add a new model, append its metadata there and place the model file in the models/ directory.
  1. Running – The web UI is automatically opened. If it does not, visit http://127.0.0.1:8000 manually. Use the Settings page to choose a model and adjust parameters defined in studio/params.py.

Real‑World Use

A local songwriting workflow could look like this:

# Start the studio
./studio.sh

# In another terminal, generate a track
curl -X POST http://127.0.0.1:8000/generate \
     -H "Content-Type: application/json" \
     -d '{"lyrics":"We walk alone","style":"electro"}' > track.wav

# Edit the track
python studio/edit.py track.wav --trim 0:30 --loop 5

# Separate stems
python studio/separate.py track.wav --output stems/

The resulting stems/ folder can be imported into any DAW for further production.

Code Health & Issues

  • Low (Dependencies) – pyproject.toml declares packages but no lockfile (uv.lock). Non‑reproducible builds may occur if transitive dependencies change.
  • Low (Missing CI) – GitHub Actions exist (.github/workflows/*), but tests are limited to 10 files and do not cover UI or audio rendering paths.
  • Low (Documentation) – While README.md covers installation, the architectural overview (docs/architecture.md) is sparse.

No other static analysis results are available at this time.

The Bottom Line

Lux In Music offers a complete, offline pipeline from lyrics to finished audio, with an approachable web UI and a Python‑based backend. Its modular design lets developers swap out the YuE2 engine or add new models, but the lack of a lockfile and limited test coverage mean caution is advised when integrating into larger systems. This repo is best suited for researchers or hobbyists who need a quick local prototype rather than a production‑grade service.